This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 929431bbc83 branch-3.1: [fix](mow) fix update delete bitmap lock not
removed if schema change for empty tablet #51780 (#52214)
929431bbc83 is described below
commit 929431bbc8320486e499f900ea3f089681b6969f
Author: meiyi <[email protected]>
AuthorDate: Tue Jun 24 23:09:17 2025 +0800
branch-3.1: [fix](mow) fix update delete bitmap lock not removed if schema
change for empty tablet #51780 (#52214)
Cherry-pick from #51780
---
cloud/src/meta-service/meta_service_job.cpp | 32 ++++++++++++++---------------
cloud/test/meta_service_job_test.cpp | 23 +++++++++++++++++++++
2 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/cloud/src/meta-service/meta_service_job.cpp
b/cloud/src/meta-service/meta_service_job.cpp
index 0c77d5d33b8..dea58d7fa15 100644
--- a/cloud/src/meta-service/meta_service_job.cpp
+++ b/cloud/src/meta-service/meta_service_job.cpp
@@ -1270,6 +1270,22 @@ void process_schema_change_job(MetaServiceCode& code,
std::string& msg, std::str
new_tablet_meta.SerializeToString(&new_tablet_val);
txn->put(new_tablet_key, new_tablet_val);
+ // process mow table, check lock
+ if (new_tablet_meta.enable_unique_key_merge_on_write()) {
+ bool success = check_and_remove_delete_bitmap_update_lock(
+ code, msg, ss, txn, instance_id, new_table_id, new_tablet_id,
+ SCHEMA_CHANGE_DELETE_BITMAP_LOCK_ID,
schema_change.delete_bitmap_lock_initiator(),
+ use_version);
+ if (!success) {
+ return;
+ }
+
+ std::string pending_key = meta_pending_delete_bitmap_key({instance_id,
new_tablet_id});
+ txn->remove(pending_key);
+ LOG(INFO) << "xxx sc remove delete bitmap pending key, pending_key="
<< hex(pending_key)
+ << " tablet_id=" << new_tablet_id << ", job_id=" <<
schema_change.id();
+ }
+
//==========================================================================
// move rowsets [2-alter_version] to recycle
//==========================================================================
@@ -1399,22 +1415,6 @@ void process_schema_change_job(MetaServiceCode& code,
std::string& msg, std::str
return;
}
- // process mow table, check lock
- if (new_tablet_meta.enable_unique_key_merge_on_write()) {
- bool success = check_and_remove_delete_bitmap_update_lock(
- code, msg, ss, txn, instance_id, new_table_id, new_tablet_id,
- SCHEMA_CHANGE_DELETE_BITMAP_LOCK_ID,
schema_change.delete_bitmap_lock_initiator(),
- use_version);
- if (!success) {
- return;
- }
-
- std::string pending_key = meta_pending_delete_bitmap_key({instance_id,
new_tablet_id});
- txn->remove(pending_key);
- LOG(INFO) << "xxx sc remove delete bitmap pending key, pending_key="
<< hex(pending_key)
- << " tablet_id=" << new_tablet_id << "job_id=" <<
schema_change.id();
- }
-
for (size_t i = 0; i < schema_change.txn_ids().size(); ++i) {
auto tmp_rowset_key =
meta_rowset_tmp_key({instance_id,
schema_change.txn_ids().at(i), new_tablet_id});
diff --git a/cloud/test/meta_service_job_test.cpp
b/cloud/test/meta_service_job_test.cpp
index f0e5cb8fe3d..a81e9c843d6 100644
--- a/cloud/test/meta_service_job_test.cpp
+++ b/cloud/test/meta_service_job_test.cpp
@@ -3458,6 +3458,29 @@ TEST(MetaServiceJobTest, SchemaChangeJobWithMoWTest) {
ASSERT_EQ(res_code, MetaServiceCode::OK);
res.Clear();
}
+
+ // alter version < 2
+ {
+ int64_t new_tablet_id = 16;
+ ASSERT_NO_FATAL_FAILURE(create_tablet(meta_service.get(), table_id,
index_id, partition_id,
+ new_tablet_id, true, true));
+ StartTabletJobResponse sc_res;
+ ASSERT_NO_FATAL_FAILURE(start_schema_change_job(meta_service.get(),
table_id, index_id,
+ partition_id,
tablet_id, new_tablet_id,
+ "job2", "be1",
sc_res));
+ std::vector<doris::RowsetMetaCloudPB> output_rowsets;
+ auto res_code = get_delete_bitmap_lock(meta_service.get(), table_id,
-2, 12345);
+ ASSERT_EQ(res_code, MetaServiceCode::OK);
+ FinishTabletJobResponse res;
+ finish_schema_change_job(meta_service.get(), tablet_id, new_tablet_id,
"job2", "be1",
+ output_rowsets, res);
+ ASSERT_EQ(res.status().code(), MetaServiceCode::OK);
+ res_code = get_delete_bitmap_lock(meta_service.get(), table_id, 100,
-1);
+ ASSERT_EQ(res_code, MetaServiceCode::OK);
+ res_code = remove_delete_bitmap_lock(meta_service.get(), table_id,
100, -1);
+ ASSERT_EQ(res_code, MetaServiceCode::OK);
+ res.Clear();
+ }
}
TEST(MetaServiceJobTest, ConcurrentCompactionTest) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]