Copilot commented on code in PR #64630:
URL: https://github.com/apache/doris/pull/64630#discussion_r3434194158


##########
cloud/src/recycler/recycler.cpp:
##########
@@ -4358,24 +4358,23 @@ int InstanceRecycler::recycle_tablet(int64_t tablet_id, 
RecyclerMetricsContext&
     
TEST_SYNC_POINT_CALLBACK("InstanceRecycler::recycle_tablet.create_rowset_meta", 
&resp);
 
     for (const auto& rs_meta : resp.rowset_meta()) {
-        // The rowset has no resource id and segments when it was generated by 
compaction
-        // with multiple hole rowsets or it's version is [0-1], so we can skip 
it.
-        if (!rs_meta.has_resource_id() && rs_meta.num_segments() == 0) {
-            LOG_INFO("rowset meta does not have a resource id and no segments, 
skip this rowset")
+        // Empty rowsets have no segment objects to delete, so they do not 
need a resource id.
+        if (rs_meta.num_segments() == 0) {
+            LOG_INFO("rowset meta has no segments, skip this rowset")
                     .tag("rs_meta", rs_meta.ShortDebugString())
                     .tag("instance_id", instance_id_)
                     .tag("tablet_id", tablet_id);
             recycle_rowsets_number += 1;
             continue;
         }
-        if (!rs_meta.has_resource_id()) {
+        if (rs_meta.resource_id().empty()) {
             LOG_WARNING("rowset meta does not have a resource id, impossible!")

Review Comment:
   The warning message says the rowset "does not have" a resource id, but the 
condition is `resource_id().empty()`, which also covers the case where the 
field is present but explicitly set to an empty string. Updating the message 
will make the logs less misleading when triaging recycler failures.



##########
cloud/src/recycler/recycler.cpp:
##########
@@ -4358,24 +4358,23 @@ int InstanceRecycler::recycle_tablet(int64_t tablet_id, 
RecyclerMetricsContext&
     
TEST_SYNC_POINT_CALLBACK("InstanceRecycler::recycle_tablet.create_rowset_meta", 
&resp);
 
     for (const auto& rs_meta : resp.rowset_meta()) {
-        // The rowset has no resource id and segments when it was generated by 
compaction
-        // with multiple hole rowsets or it's version is [0-1], so we can skip 
it.
-        if (!rs_meta.has_resource_id() && rs_meta.num_segments() == 0) {
-            LOG_INFO("rowset meta does not have a resource id and no segments, 
skip this rowset")
+        // Empty rowsets have no segment objects to delete, so they do not 
need a resource id.
+        if (rs_meta.num_segments() == 0) {

Review Comment:
   In this loop you treat a rowset as "empty" based on `num_segments() == 0`, 
but elsewhere in the recycler you guard accessor lookup with `num_segments <= 
0`. Using `<= 0` here keeps the behavior consistent and avoids unexpected 
failures if older/invalid metadata ever contains a negative `num_segments` 
value.



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