This is an automated email from the ASF dual-hosted git repository.

liaoxin pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 2f8d63f0521 [fix](load) Fix potential data loss during disk migration 
#42296 (#42386)
2f8d63f0521 is described below

commit 2f8d63f0521f277dd2bda5a6153dc27bfded6c9c
Author: Xin Liao <[email protected]>
AuthorDate: Thu Oct 24 17:19:38 2024 +0800

    [fix](load) Fix potential data loss during disk migration #42296 (#42386)
    
    cherry pick from #42296
---
 be/src/olap/txn_manager.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/be/src/olap/txn_manager.cpp b/be/src/olap/txn_manager.cpp
index 373c398df61..45cf9c84255 100644
--- a/be/src/olap/txn_manager.cpp
+++ b/be/src/olap/txn_manager.cpp
@@ -89,6 +89,15 @@ TxnManager::TxnManager(StorageEngine& engine, int32_t 
txn_map_shard_size, int32_
 Status TxnManager::prepare_txn(TPartitionId partition_id, const Tablet& tablet,
                                TTransactionId transaction_id, const PUniqueId& 
load_id,
                                bool ingest) {
+    // check if the tablet has already been shutdown. If it has, it indicates 
that
+    // it is an old tablet, and data should not be imported into the old 
tablet.
+    // Otherwise, it may lead to data loss during migration.
+    if (tablet.tablet_state() == TABLET_SHUTDOWN) {
+        return Status::InternalError<false>(
+                "The tablet's state is shutdown, tablet_id: {}. The tablet may 
have been dropped "
+                "or migrationed. Please check if the table has been dropped or 
try again.",
+                tablet.tablet_id());
+    }
     return prepare_txn(partition_id, transaction_id, tablet.tablet_id(), 
tablet.tablet_uid(),
                        load_id, ingest);
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to