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


##########
be/src/olap/base_tablet.cpp:
##########
@@ -104,11 +103,143 @@ Status BaseTablet::capture_rs_readers_unlocked(const 
std::vector<Version>& versi
             return Status::Error<CAPTURE_ROWSET_READER_ERROR>(
                     "failed to create reader for rowset:{}", 
it->second->rowset_id().to_string());
         }
-        rs_splits->push_back(RowSetSplits(std::move(rs_reader)));
+        rs_splits->emplace_back(std::move(rs_reader));
     }
     return Status::OK();
 }
 
+// snapshot manager may call this api to check if version exists, so that
+// the version maybe not exist
+RowsetSharedPtr BaseTablet::get_rowset_by_version(const Version& version,
+                                                  bool find_in_stale) const {
+    auto iter = _rs_version_map.find(version);
+    if (iter == _rs_version_map.end()) {
+        if (find_in_stale) {
+            return get_stale_rowset_by_version(version);
+        }
+        return nullptr;
+    }
+    return iter->second;
+}
+
+RowsetSharedPtr BaseTablet::get_stale_rowset_by_version(const Version& 
version) const {
+    auto iter = _stale_rs_version_map.find(version);
+    if (iter == _stale_rs_version_map.end()) {
+        VLOG_NOTICE << "no rowset for version:" << version << ", tablet: " << 
tablet_id();
+        return nullptr;
+    }
+    return iter->second;
+}
+
+// Already under _meta_lock
+RowsetSharedPtr BaseTablet::get_rowset_with_max_version() const {
+    Version max_version = _tablet_meta->max_version();
+    if (max_version.first == -1) {
+        return nullptr;
+    }
+
+    auto iter = _rs_version_map.find(max_version);
+    if (iter == _rs_version_map.end()) {
+        DCHECK(false) << "invalid version:" << max_version;
+        return nullptr;
+    }
+    return iter->second;
+}
+
+Status BaseTablet::get_all_rs_id(int64_t max_version, RowsetIdUnorderedSet* 
rowset_ids) const {
+    std::shared_lock rlock(_meta_lock);
+    return get_all_rs_id_unlocked(max_version, rowset_ids);
+}
+
+Status BaseTablet::get_all_rs_id_unlocked(int64_t max_version,
+                                          RowsetIdUnorderedSet* rowset_ids) 
const {

Review Comment:
   warning: method 'get_all_rs_id_unlocked' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static Status BaseTablet::get_all_rs_id_unlocked(int64_t max_version,
                                             RowsetIdUnorderedSet* rowset_ids) {
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to