This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 9acfc53add1 [fix](cloud-ut)fix bvar kv test count error (#56666)
9acfc53add1 is described below
commit 9acfc53add16794bbf46a2e524e2589e504ffdd8
Author: koarz <[email protected]>
AuthorDate: Tue Sep 30 20:15:34 2025 +0800
[fix](cloud-ut)fix bvar kv test count error (#56666)
`async_notify_refresh_instance` maybe execute after
`clear_memkv_count_bytes`, it would cause test error
---
cloud/test/rpc_kv_bvar_test.cpp | 78 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/cloud/test/rpc_kv_bvar_test.cpp b/cloud/test/rpc_kv_bvar_test.cpp
index c14206b58a4..58ae0c30418 100644
--- a/cloud/test/rpc_kv_bvar_test.cpp
+++ b/cloud/test/rpc_kv_bvar_test.cpp
@@ -56,6 +56,7 @@ int main(int argc, char** argv) {
}
::testing::InitGoogleTest(&argc, argv);
+
return RUN_ALL_TESTS();
}
@@ -514,8 +515,35 @@ void clear_memkv_count_bytes(MemTxnKv* memkv) {
memkv->get_bytes_ = memkv->put_bytes_ = memkv->del_bytes_ = 0;
}
+// setup and cleanup notify_refresh_instance syncpoint
+class NotifyRefreshSyncpointGuard {
+public:
+ NotifyRefreshSyncpointGuard() {
+ auto* sp = SyncPoint::get_instance();
+ if (!sp->get_enable()) {
+ sp->enable_processing();
+ }
+ // Disable notify_refresh_instance to avoid async operations polluting
the counter
+ sp->set_call_back("notify_refresh_instance_return", [](auto&& args) {
+ auto* pred = try_any_cast<bool*>(args.back());
+ *pred = true;
+ });
+ }
+
+ ~NotifyRefreshSyncpointGuard() {
+ auto* sp = SyncPoint::get_instance();
+ sp->clear_call_back("notify_refresh_instance_return");
+ }
+};
+
+// Helper function to create syncpoint guard
+inline std::unique_ptr<NotifyRefreshSyncpointGuard>
setup_notify_refresh_syncpoint() {
+ return std::make_unique<NotifyRefreshSyncpointGuard>();
+}
+
// create_tablets
TEST(RpcKvBvarTest, CreateTablets) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
constexpr auto table_id = 10021, index_id = 10022, partition_id = 10023,
tablet_id = 10024;
@@ -579,6 +607,7 @@ TEST(RpcKvBvarTest, GetTabletStats) {
// update_tablet
TEST(RpcKvBvarTest, UpdateTablet) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
constexpr auto table_id = 10001, index_id = 10002, partition_id = 10003,
tablet_id = 10004;
@@ -608,6 +637,7 @@ TEST(RpcKvBvarTest, UpdateTablet) {
// begin_txn
TEST(RpcKvBvarTest, BeginTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 100201;
@@ -633,6 +663,7 @@ TEST(RpcKvBvarTest, BeginTxn) {
// commit_txn
TEST(RpcKvBvarTest, CommitTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 100201;
@@ -660,6 +691,7 @@ TEST(RpcKvBvarTest, CommitTxn) {
// precommit_txn
TEST(RpcKvBvarTest, PrecommitTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
const int64_t db_id = 563413;
@@ -720,6 +752,7 @@ TEST(RpcKvBvarTest, PrecommitTxn) {
// abort_txn
TEST(RpcKvBvarTest, AbortTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 100201;
@@ -755,6 +788,7 @@ TEST(RpcKvBvarTest, AbortTxn) {
// get_txn
TEST(RpcKvBvarTest, GetTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 100201;
@@ -786,6 +820,7 @@ TEST(RpcKvBvarTest, GetTxn) {
// get_txn_id
TEST(RpcKvBvarTest, GetTxnId) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 100201;
@@ -848,6 +883,7 @@ TEST(RpcKvBvarTest, PrepareRowset) {
// get_rowset
TEST(RpcKvBvarTest, GetRowset) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -874,6 +910,7 @@ TEST(RpcKvBvarTest, GetRowset) {
// update_tmp_rowset
TEST(RpcKvBvarTest, UpdateTmpRowset) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
constexpr auto table_id = 10001, index_id = 10002, partition_id = 10003,
tablet_id = 10004;
@@ -919,6 +956,7 @@ TEST(RpcKvBvarTest, UpdateTmpRowset) {
// commit_rowset
TEST(RpcKvBvarTest, CommitRowset) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -946,6 +984,7 @@ TEST(RpcKvBvarTest, CommitRowset) {
// get_version
TEST(RpcKvBvarTest, GetVersion) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -975,6 +1014,7 @@ TEST(RpcKvBvarTest, GetVersion) {
// get_schema_dict
TEST(RpcKvBvarTest, GetSchemaDict) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
constexpr auto table_id = 10001, index_id = 10002, partition_id = 10003,
tablet_id = 10004;
@@ -1007,6 +1047,7 @@ TEST(RpcKvBvarTest, GetSchemaDict) {
// get_delete_bitmap_update_lock
TEST(RpcKvBvarTest, GetDeleteBitmapUpdateLock) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1047,6 +1088,7 @@ TEST(RpcKvBvarTest, GetDeleteBitmapUpdateLock) {
// update_delete_bitmap
TEST(RpcKvBvarTest, UpdateDeleteBitmap) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1095,6 +1137,7 @@ TEST(RpcKvBvarTest, UpdateDeleteBitmap) {
// get_delete_bitmap
TEST(RpcKvBvarTest, GetDeleteBitmap) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 99999;
@@ -1143,6 +1186,7 @@ TEST(RpcKvBvarTest, GetDeleteBitmap) {
// remove_delete_bitmap_update_lock
TEST(RpcKvBvarTest, RemoveDeleteBitmapUpdateLock) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1195,6 +1239,7 @@ TEST(RpcKvBvarTest, RemoveDeleteBitmapUpdateLock) {
// remove_delete_bitmap
TEST(RpcKvBvarTest, RemoveDeleteBitmap) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 99999;
@@ -1243,6 +1288,7 @@ TEST(RpcKvBvarTest, RemoveDeleteBitmap) {
// start_tablet_job
TEST(RpcKvBvarTest, StartTabletJob) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
constexpr int64_t table_id = 10001;
@@ -1269,6 +1315,7 @@ TEST(RpcKvBvarTest, StartTabletJob) {
// finish_tablet_job
TEST(RpcKvBvarTest, FinishTabletJob) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -1323,6 +1370,7 @@ TEST(RpcKvBvarTest, FinishTabletJob) {
// prepare_index
TEST(RpcKvBvarTest, PrepareIndex) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
std::string instance_id = "test_cloud_instance_id";
@@ -1369,6 +1417,7 @@ TEST(RpcKvBvarTest, PrepareIndex) {
// commit_index
TEST(RpcKvBvarTest, CommitIndex) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
std::string instance_id = "test_cloud_instance_id";
@@ -1419,6 +1468,7 @@ TEST(RpcKvBvarTest, CommitIndex) {
// drop_index
TEST(RpcKvBvarTest, DropIndex) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 4524364;
@@ -1487,6 +1537,7 @@ TEST(RpcKvBvarTest, DropIndex) {
// prepare_partition
TEST(RpcKvBvarTest, PreparePartition) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
std::string instance_id = "test_cloud_instance_id";
@@ -1535,6 +1586,7 @@ TEST(RpcKvBvarTest, PreparePartition) {
// commit_partition
TEST(RpcKvBvarTest, CommitPartition) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
std::string instance_id = "test_cloud_instance_id";
@@ -1585,6 +1637,7 @@ TEST(RpcKvBvarTest, CommitPartition) {
// check_kv
TEST(RpcKvBvarTest, CheckKv) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
std::string instance_id = "test_instance";
@@ -1624,6 +1677,7 @@ TEST(RpcKvBvarTest, CheckKv) {
// drop_partition
TEST(RpcKvBvarTest, DropPartition) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
std::string instance_id = "test_instance";
@@ -1661,6 +1715,7 @@ TEST(RpcKvBvarTest, DropPartition) {
// get_obj_store_info
TEST(RpcKvBvarTest, GetObjStoreInfo) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1694,6 +1749,7 @@ TEST(RpcKvBvarTest, GetObjStoreInfo) {
// alter_storage_vault
TEST(RpcKvBvarTest, AlterStorageVault) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1740,6 +1796,7 @@ TEST(RpcKvBvarTest, AlterStorageVault) {
// alter_obj_store_info
TEST(RpcKvBvarTest, AlterObjStoreInfo) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1807,6 +1864,7 @@ TEST(RpcKvBvarTest, AlterObjStoreInfo) {
// update_ak_sk
TEST(RpcKvBvarTest, UpdateAkSk) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1875,6 +1933,7 @@ TEST(RpcKvBvarTest, UpdateAkSk) {
// create_instance
TEST(RpcKvBvarTest, CreateInstance) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -1926,6 +1985,7 @@ TEST(RpcKvBvarTest, CreateInstance) {
// get_instance
TEST(RpcKvBvarTest, GetInstance) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -2007,6 +2067,7 @@ TEST(RpcKvBvarTest, GetInstance) {
// get_cluster
TEST(RpcKvBvarTest, GetCluster) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
InstanceKeyInfo key_info {mock_instance};
@@ -2054,6 +2115,7 @@ TEST(RpcKvBvarTest, GetCluster) {
// create_stage
TEST(RpcKvBvarTest, CreateStage) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -2148,6 +2210,7 @@ TEST(RpcKvBvarTest, CreateStage) {
// get_stage
TEST(RpcKvBvarTest, GetStage) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -2252,6 +2315,7 @@ TEST(RpcKvBvarTest, GetStage) {
// get_iam
TEST(RpcKvBvarTest, GetIam) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -2338,6 +2402,7 @@ TEST(RpcKvBvarTest, GetIam) {
// alter_iam
TEST(RpcKvBvarTest, AlterIam) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -2380,6 +2445,7 @@ TEST(RpcKvBvarTest, AlterIam) {
// alter_ram_user
TEST(RpcKvBvarTest, AlterRamUser) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -2461,6 +2527,7 @@ TEST(RpcKvBvarTest, AlterRamUser) {
// begin_copy
TEST(RpcKvBvarTest, BeginCopy) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -2518,6 +2585,7 @@ TEST(RpcKvBvarTest, BeginCopy) {
// get_copy_job
TEST(RpcKvBvarTest, GetCopyJob) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -2585,6 +2653,7 @@ TEST(RpcKvBvarTest, GetCopyJob) {
// finish_copy
TEST(RpcKvBvarTest, FinishCopy) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -2657,6 +2726,7 @@ TEST(RpcKvBvarTest, FinishCopy) {
// get_copy_files
TEST(RpcKvBvarTest, GetCopyFiles) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -2721,6 +2791,7 @@ TEST(RpcKvBvarTest, GetCopyFiles) {
// filter_copy_files
TEST(RpcKvBvarTest, FilterCopyFiles) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
brpc::Controller cntl;
@@ -2791,6 +2862,7 @@ TEST(RpcKvBvarTest, FilterCopyFiles) {
// get_cluster_status
TEST(RpcKvBvarTest, GetClusterStatus) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -2853,6 +2925,7 @@ TEST(RpcKvBvarTest, GetClusterStatus) {
// get_current_max_txn_id
TEST(RpcKvBvarTest, GetCurrentMaxTxnId) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
const int64_t db_id = 123;
@@ -2903,6 +2976,7 @@ TEST(RpcKvBvarTest, GetCurrentMaxTxnId) {
// begin_sub_txn
TEST(RpcKvBvarTest, BeginSubTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 98131;
@@ -2970,6 +3044,7 @@ TEST(RpcKvBvarTest, BeginSubTxn) {
// abort_sub_txn
TEST(RpcKvBvarTest, AbortSubTxn) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 98131;
@@ -3049,6 +3124,7 @@ TEST(RpcKvBvarTest, AbortSubTxn) {
// abort_txn_with_coordinator
TEST(RpcKvBvarTest, AbortTxnWithCoordinator) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
const int64_t db_id = 666;
@@ -3111,6 +3187,7 @@ TEST(RpcKvBvarTest, AbortTxnWithCoordinator) {
// check_txn_conflict
TEST(RpcKvBvarTest, CheckTxnConflict) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
@@ -3163,6 +3240,7 @@ TEST(RpcKvBvarTest, CheckTxnConflict) {
// clean_txn_label
TEST(RpcKvBvarTest, CleanTxnLabel) {
+ auto syncpoint_guard = setup_notify_refresh_syncpoint();
auto meta_service = get_meta_service();
auto mem_kv = std::dynamic_pointer_cast<MemTxnKv>(meta_service->txn_kv());
int64_t db_id = 1987211;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]