Skip to content

Commit

Permalink
fix cloud ut
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhan1 committed Jan 13, 2025
1 parent 4830ea9 commit ffb41a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions cloud/src/meta-service/meta_service_txn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ void process_mow_when_commit_txn(
}

if (pending_info.has_lock_id() && pending_info.lock_id() != lock_id) {
TEST_SYNC_POINT_CALLBACK("commit_txn:check_pending_delete_bitmap_lock_id", &tablet_id);
LOG_WARNING(
"wrong lock_id in pending delete bitmap infos, expect lock_id={}, but "
"found {} tablet_id={} instance_id={}",
Expand Down
17 changes: 16 additions & 1 deletion cloud/test/meta_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5479,6 +5479,15 @@ TEST(MetaServiceTest, WrongPendingBitmapTest) {
const std::string& cloud_unique_id);
auto instance_id = get_instance_id(meta_service->resource_mgr(), "test_cloud_unique_id");

std::set<int64_t> real_wrong_pending_delete_bitmap_tablet_ids;
std::set<int64_t> expected_wrong_pending_delete_bitmap_tablet_ids;
auto sp = SyncPoint::get_instance();
sp->set_call_back("commit_txn:check_pending_delete_bitmap_lock_id", [&](auto&& args) {
auto* tablet_id = try_any_cast<int64_t*>(args[0]);
real_wrong_pending_delete_bitmap_tablet_ids.insert(*tablet_id);
});
sp->enable_processing();

// case: first version of rowset
{
int64_t txn_id = 56789;
Expand Down Expand Up @@ -5587,6 +5596,8 @@ TEST(MetaServiceTest, WrongPendingBitmapTest) {
ASSERT_TRUE(pending_info.SerializeToString(&pending_val));
txn->put(pending_key, pending_val);
ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);

expected_wrong_pending_delete_bitmap_tablet_ids.insert(tablet_id_base);
}

// commit txn
Expand All @@ -5600,9 +5611,13 @@ TEST(MetaServiceTest, WrongPendingBitmapTest) {
CommitTxnResponse res;
meta_service->commit_txn(reinterpret_cast<::google::protobuf::RpcController*>(&cntl),
&req, &res, nullptr);
ASSERT_EQ(res.status().code(), MetaServiceCode::PENDING_DELETE_BITMAP_WRONG);
ASSERT_EQ(expected_wrong_pending_delete_bitmap_tablet_ids,
real_wrong_pending_delete_bitmap_tablet_ids);
}
}

SyncPoint::get_instance()->disable_processing();
SyncPoint::get_instance()->clear_all_call_backs();
}

TEST(MetaServiceTest, GetDeleteBitmapWithRetryTest1) {
Expand Down

0 comments on commit ffb41a8

Please sign in to comment.