gavinchou commented on code in PR #52709:
URL: https://github.com/apache/doris/pull/52709#discussion_r2189859592


##########
cloud/src/recycler/recycler.cpp:
##########
@@ -2381,23 +2394,31 @@ int InstanceRecycler::recycle_rowsets() {
             return 0;
         }
         if (!rowset.has_type()) {
-            if (!rowset.has_resource_id()) [[unlikely]] {
-                return 0;
-            }
-            if (rowset.resource_id().empty()) [[unlikely]] {
+            if (!rowset.has_resource_id() || rowset.resource_id().empty()) 
[[unlikely]] {
                 return 0;
             }
+            auto rowset_meta = rowset.rowset_meta();
+            metrics_context.total_need_recycle_data_size += 
rowset_meta.total_disk_size();
+            metrics_context.total_recycled_num++;
+            segment_metrics_context_.total_need_recycle_num += 
rowset_meta.num_segments();
+            segment_metrics_context_.total_need_recycle_data_size += 
rowset_meta.total_disk_size();
             return 0;
         }
-        auto* rowset_meta = rowset.mutable_rowset_meta();
-        if (!rowset_meta->has_resource_id()) [[unlikely]] {
+        auto rowset_meta = rowset.mutable_rowset_meta();
+        if (!rowset_meta->has_resource_id()) [[unlikely]] { // impossible
             if (rowset.type() == RecycleRowsetPB::PREPARE || 
rowset_meta->num_segments() != 0) {
                 return 0;
             }
         }
-        if (rowset.type() != RecycleRowsetPB::PREPARE) {
-            if (rowset_meta->num_segments() > 0) {
-                metrics_context.total_need_recycle_num++;
+
+        if (rowset.type() == RecycleRowsetPB::PREPARE) {

Review Comment:
   total_recycled_num  表示 rowset 数量的话, segment 数量是不是0   它都要++  
   这里是重复代码
   所有的metrics 应该都能直接加上 meta里的值.



##########
cloud/src/recycler/recycler.cpp:
##########
@@ -2381,23 +2394,31 @@ int InstanceRecycler::recycle_rowsets() {
             return 0;
         }
         if (!rowset.has_type()) {
-            if (!rowset.has_resource_id()) [[unlikely]] {
-                return 0;
-            }
-            if (rowset.resource_id().empty()) [[unlikely]] {
+            if (!rowset.has_resource_id() || rowset.resource_id().empty()) 
[[unlikely]] {

Review Comment:
   原来的代码不影响,  最好不要动



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