github-actions[bot] commented on code in PR #63295:
URL: https://github.com/apache/doris/pull/63295#discussion_r3353015646
##########
cloud/test/recycler_test.cpp:
##########
@@ -1376,6 +1400,89 @@ TEST(RecyclerTest, recycle_rowsets) {
check_delete_bitmap_file_size(accessor, tablet_id, 0);
}
+TEST(RecyclerTest, next_recycle_rowset_tablet_key_overwrites_existing_buffer) {
+ std::string next_key = recycle_rowset_key({instance_id, 10002, "rowset"});
+ ASSERT_EQ(InstanceRecycler::next_recycle_rowset_tablet_key(instance_id,
10002, &next_key), 0);
+
+ std::string_view k1 = next_key;
+ k1.remove_prefix(1);
+ std::vector<std::tuple<std::variant<int64_t, std::string>, int, int>> out;
+ ASSERT_EQ(decode_key(&k1, &out), 0);
+ EXPECT_EQ(std::get<int64_t>(std::get<0>(out[3])), 10003);
+ EXPECT_TRUE(std::get<std::string>(std::get<0>(out[4])).empty());
+}
+
+TEST(RecyclerTest,
recycle_rowsets_tablet_batch_limit_recycles_remaining_in_next_round) {
+ config::retention_seconds = 0;
+ auto txn_kv = std::make_shared<MemTxnKv>();
+ ASSERT_EQ(txn_kv->init(), 0);
+
+ InstanceInfoPB instance;
+ instance.set_instance_id(instance_id);
+ auto obj_info = instance.add_obj_info();
+ obj_info->set_id("recycle_rowsets_batch_limit");
+ obj_info->set_ak(config::test_s3_ak);
+ obj_info->set_sk(config::test_s3_sk);
+ obj_info->set_endpoint(config::test_s3_endpoint);
+ obj_info->set_region(config::test_s3_region);
+ obj_info->set_bucket(config::test_s3_bucket);
+ obj_info->set_prefix("recycle_rowsets_batch_limit");
+
+ auto old_worker_pool_size = config::instance_recycler_worker_pool_size;
+ auto old_max_rowsets_per_tablet =
config::recycle_rowsets_per_tablet_batch_size;
+ auto old_enable_mark = config::enable_mark_delete_rowset_before_recycle;
+ config::instance_recycler_worker_pool_size = 1;
+ config::recycle_rowsets_per_tablet_batch_size = 3;
+ config::enable_mark_delete_rowset_before_recycle = false;
+ DORIS_CLOUD_DEFER {
+ config::instance_recycler_worker_pool_size = old_worker_pool_size;
+ config::recycle_rowsets_per_tablet_batch_size =
old_max_rowsets_per_tablet;
+ config::enable_mark_delete_rowset_before_recycle = old_enable_mark;
+ };
+
+ InstanceRecycler recycler(txn_kv, instance, thread_group,
+ std::make_shared<TxnLazyCommitter>(txn_kv));
+ ASSERT_EQ(recycler.init(), 0);
+ auto accessor = recycler.accessor_map_.begin()->second;
+
+ doris::TabletSchemaCloudPB schema;
+ schema.set_schema_version(1);
+ constexpr int64_t index_id = 10001;
+ constexpr int64_t first_tablet_id = 10002;
+ constexpr int64_t second_tablet_id = 10020;
+ std::vector<std::string> first_tablet_rowset_ids;
+ for (int i = 0; i < 5; ++i) {
+ auto rowset =
+ create_rowset("recycle_rowsets_batch_limit", first_tablet_id,
index_id, 1, schema);
+ first_tablet_rowset_ids.push_back(rowset.rowset_id_v2());
+ ASSERT_EQ(create_recycle_rowset(txn_kv.get(), accessor.get(), rowset,
+ RecycleRowsetPB::COMPACT, true),
+ 0);
+ }
+ for (int i = 0; i < 2; ++i) {
+ auto rowset =
+ create_rowset("recycle_rowsets_batch_limit", second_tablet_id,
index_id, 1, schema);
+ ASSERT_EQ(create_recycle_rowset(txn_kv.get(), accessor.get(), rowset,
+ RecycleRowsetPB::COMPACT, true),
+ 0);
Review Comment:
This test directly calls `InstanceRecycler::next_recycle_rowset_tablet_key`,
but that helper is declared in the private section of `InstanceRecycler` in
`recycler.h`. `recycler_test.cpp` includes `recycler/recycler.h` normally and
there is no `friend` or `#define private public`, so this line will fail to
compile with an access-control error. Please either keep the helper testable
through the public recycle path, make the helper accessible intentionally for
tests, or remove this direct unit test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]