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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 74915ad34fc [Fix](Top-N opt) evicting quering rowsets in prior to 
correct use_count (#30925)
74915ad34fc is described below

commit 74915ad34fcac8f7d16e468d29da5d1f57ebb393
Author: lihangyu <[email protected]>
AuthorDate: Wed Feb 7 10:14:58 2024 +0800

    [Fix](Top-N opt) evicting quering rowsets in prior to correct use_count 
(#30925)
    
    This addresses the scenario where a rowset cannot be removed.
---
 be/src/exec/rowid_fetcher.cpp  | 5 ++++-
 be/src/olap/storage_engine.cpp | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/be/src/exec/rowid_fetcher.cpp b/be/src/exec/rowid_fetcher.cpp
index c7519c5b05a..b986830888e 100644
--- a/be/src/exec/rowid_fetcher.cpp
+++ b/be/src/exec/rowid_fetcher.cpp
@@ -230,7 +230,10 @@ Status RowIDFetcher::fetch(const vectorized::ColumnPtr& 
column_row_ids,
     std::vector<PRowLocation> rows_locs;
     rows_locs.reserve(rows_locs.size());
     RETURN_IF_ERROR(_merge_rpc_results(mget_req, resps, cntls, res_block, 
&rows_locs));
-
+    if (rows_locs.size() != res_block->rows() || rows_locs.size() != 
column_row_ids->size()) {
+        return Status::InternalError("Miss matched return row loc count {}, 
expected {}, input {}",
+                                     rows_locs.size(), res_block->rows(), 
column_row_ids->size());
+    }
     // Final sort by row_ids sequence, since row_ids is already sorted if need
     std::map<GlobalRowLoacation, size_t> positions;
     for (size_t i = 0; i < rows_locs.size(); ++i) {
diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp
index d95d6c8bc47..e48ecb56d05 100644
--- a/be/src/olap/storage_engine.cpp
+++ b/be/src/olap/storage_engine.cpp
@@ -1064,9 +1064,11 @@ void StorageEngine::start_delete_unused_rowset() {
         std::lock_guard<std::mutex> lock(_gc_mutex);
         for (auto it = _unused_rowsets.begin(); it != _unused_rowsets.end();) {
             uint64_t now = UnixSeconds();
-            if (it->second.use_count() == 1 && it->second->need_delete_file() 
&&
+            if (now > it->second->delayed_expired_timestamp()) {
                 // We delay the GC time of this rowset since it's maybe still 
needed, see #20732
-                now > it->second->delayed_expired_timestamp()) {
+                evict_querying_rowset(it->second->rowset_id());
+            }
+            if (it->second.use_count() == 1 && it->second->need_delete_file()) 
{
                 if (it->second->is_local()) {
                     unused_rowsets_copy[it->first] = it->second;
                 }


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

Reply via email to