This is an automated email from the ASF dual-hosted git repository.
liaoxin pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 5609a4c9331 [fix](load) Fix potential data loss during disk migration
#42296 (#42387)
5609a4c9331 is described below
commit 5609a4c9331bc8db929a7efcab9921d713b0a2b5
Author: Xin Liao <[email protected]>
AuthorDate: Thu Oct 24 16:12:58 2024 +0800
[fix](load) Fix potential data loss during disk migration #42296 (#42387)
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 4d06ab36e97..2497b582eb2 100644
--- a/be/src/olap/txn_manager.cpp
+++ b/be/src/olap/txn_manager.cpp
@@ -91,6 +91,15 @@ Status TxnManager::prepare_txn(TPartitionId partition_id,
const TabletSharedPtr&
const auto& schema_hash = tablet->schema_hash();
const auto& tablet_uid = tablet->tablet_uid();
+ // 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_id);
+ }
return prepare_txn(partition_id, transaction_id, tablet_id, schema_hash,
tablet_uid, load_id,
ingest);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]