This is an automated email from the ASF dual-hosted git repository.

yiguolei 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 fdec286e823 [optimize](cooldown)Shorten the _meta_lock lock interval 
(#27118)
fdec286e823 is described below

commit fdec286e82361a46cbd56874dbae38daaee62622
Author: xy <[email protected]>
AuthorDate: Fri Nov 17 16:59:36 2023 +0800

    [optimize](cooldown)Shorten the _meta_lock lock interval (#27118)
    
    Change the two passes of _rs_version_map to one, reducing cpu overhead and 
shortening the lock interval of _meta_lock
    
    Co-authored-by: [email protected] <[email protected]>
---
 be/src/olap/tablet.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index aed65ee231f..b9818589650 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2296,23 +2296,22 @@ Status Tablet::_follow_cooldowned_data() {
             return Status::InternalError<false>("tablet not running");
         }
 
-        for (auto& [v, rs] : _rs_version_map) {
-            if (v.second == cooldowned_version) {
-                version_aligned = true;
-                break;
-            }
-        }
-        if (!version_aligned) {
-            return Status::InternalError<false>("cooldowned version is not 
aligned");
-        }
         for (auto& [v, rs] : _rs_version_map) {
             if (v.second <= cooldowned_version) {
                 overlap_rowsets.push_back(rs);
+                if (!version_aligned && v.second == cooldowned_version) {
+                    version_aligned = true;
+                }
             } else if (!rs->is_local()) {
                 return Status::InternalError<false>(
                         "cooldowned version larger than that to follow");
             }
         }
+
+        if (!version_aligned) {
+            return Status::InternalError<false>("cooldowned version is not 
aligned");
+        }
+
         std::sort(overlap_rowsets.begin(), overlap_rowsets.end(), 
Rowset::comparator);
         auto rs_pb_it = cooldown_meta_pb.rs_metas().begin();
         auto rs_it = overlap_rowsets.begin();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to