bobhan1 commented on code in PR #53824:
URL: https://github.com/apache/doris/pull/53824#discussion_r2227610035


##########
be/src/cloud/cloud_tablet.cpp:
##########
@@ -242,6 +249,169 @@ TabletSchemaSPtr CloudTablet::merged_tablet_schema() 
const {
     return _merged_tablet_schema;
 }
 
+bool CloudTablet::split_rowsets_by_version_overlap(
+        const std::vector<RowsetSharedPtr>& input_rowsets,
+        std::vector<RowsetSharedPtr>* new_rowsets,
+        std::vector<RowsetSharedPtr>* overlapping_rowsets) {
+    auto max_version = max_version_unlocked();
+    for (auto rs : input_rowsets) {
+        if (rs->version().first > max_version) {
+            new_rowsets->push_back(rs);
+        } else if (rs->version().second <= max_version) {
+            overlapping_rowsets->push_back(rs);
+        } else {
+            new_rowsets->clear();
+            overlapping_rowsets->clear();
+            return false;
+        }
+    }
+    return true;
+}
+
+void CloudTablet::warm_up_rowset_unlocked(RowsetSharedPtr rowset, bool 
version_overlap,
+                                          bool delay_add_rowset) {
+    if (_rowset_warm_up_states.find(rowset->rowset_id()) != 
_rowset_warm_up_states.end()) {
+        return;
+    }
+    if (delay_add_rowset) {
+        g_file_cache_shield_delayed_rowset_num << 1;
+        LOG(INFO) << "triggered a warm up for overlapping rowset " << 
rowset->version()
+                  << ", will add it to tablet meta latter";
+    }
+    // warmup rowset data in background
+    bool download_task_submitted = false;
+    for (int seg_id = 0; seg_id < rowset->num_segments(); ++seg_id) {
+        const auto& rowset_meta = rowset->rowset_meta();
+        constexpr int64_t interval = 600; // 10 mins
+        // When BE restart and receive the `load_sync` rpc, it will sync all 
historical rowsets first time.
+        // So we need to filter out the old rowsets avoid to download the 
whole table.
+        if (!version_overlap &&
+            ::time(nullptr) - rowset_meta->newest_write_timestamp() >= 
interval) {
+            continue;
+        }
+
+        auto storage_resource = rowset_meta->remote_storage_resource();
+        if (!storage_resource) {
+            LOG(WARNING) << storage_resource.error();
+            continue;
+        }

Review Comment:
   These conditions are checked repeatedly for every segment



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