github-actions[bot] commented on code in PR #64630:
URL: https://github.com/apache/doris/pull/64630#discussion_r3434281820


##########
cloud/test/recycler_test.cpp:
##########
@@ -7265,6 +7265,37 @@ TEST(RecyclerTest, recycle_tablet_without_resource_id) {
     
EXPECT_EQ(recycler.accessor_map_.at("success_vault")->exists("data/0/test.csv"),
 0);
 }
 
+TEST(RecyclerTest, recycle_tablet_with_empty_resource_id_and_no_segments) {
+    auto* sp = SyncPoint::get_instance();
+    DORIS_CLOUD_DEFER {
+        sp->clear_all_call_backs();
+        sp->clear_trace();
+        sp->disable_processing();
+    };
+
+    auto txn_kv = std::make_shared<MemTxnKv>();
+    EXPECT_EQ(txn_kv->init(), 0);
+    InstanceInfoPB instance;
+    instance.set_instance_id("test_instance");
+
+    sp->set_call_back("InstanceRecycler::recycle_tablet.create_rowset_meta", 
[](auto&& args) {
+        auto* resp = try_any_cast<GetRowsetResponse*>(args[0]);
+        auto* rs = resp->add_rowset_meta();
+        rs->set_num_segments(0);
+        rs->set_resource_id("");
+        EXPECT_TRUE(rs->has_resource_id());
+        EXPECT_TRUE(rs->resource_id().empty());
+    });
+    sp->enable_processing();
+
+    InstanceRecycler recycler(txn_kv, instance, thread_group,
+                              std::make_shared<TxnLazyCommitter>(txn_kv));
+    EXPECT_EQ(recycler.init(), 0);
+
+    RecyclerMetricsContext ctx;
+    EXPECT_EQ(recycler.recycle_tablet(0, ctx), 0);

Review Comment:
   This test covers only rowsets returned from `internal_get_rowset`, but 
`recycle_tablet` immediately scans `job_restore_rowset_key` entries afterward 
and that parallel loop still requires a resource id before considering whether 
the rowset has any segment objects. `prepare_restore_job` persists the 
request's `tablet_meta.rs_metas()` verbatim, so an expired/aborted restore job 
can contain the same zero-segment rowset shape this PR is fixing. In that case 
the normal rowset loop succeeds, then the restore-job loop returns `-1` on a 
missing `resource_id` or falls through to `accessor_map_.find("")` for an 
explicitly empty one, leaving the restore/tablet cleanup to fail and retry. 
Please mirror the empty-rowset skip in the restore-job rowset loop as well, and 
add a restore-job rowset test for the missing/empty resource-id case.



-- 
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]

Reply via email to