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


##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -1285,9 +1315,24 @@ void BlockFileCache::remove(FileBlockSPtr file_block, T& 
cache_lock, U& block_lo
         key.offset = offset;
         key.meta.type = type;
         key.meta.expiration_time = expiration_time;
-        Status st = _storage->remove(key);
-        if (!st.ok()) {
-            LOG_WARNING("").error(st);
+        if (sync) {
+            Status st = _storage->remove(key);
+            if (!st.ok()) {
+                LOG_WARNING("").error(st);
+            }
+        } else {
+            // the file will be deleted in the bottom half
+            // so there will be a window that the file is not in the cache but 
still in the storage
+            // but it's ok, because the rowset is stale already
+            // in case something unexpected happen, set the _recycle_keys 
queue to zero to fallback
+            bool ret = _recycle_keys->push(key);
+            if (!ret) {
+                LOG_WARNING("Failed to push recycle key to queue, do it 
synchronously");
+                Status st = _storage->remove(key);
+                if (!st.ok()) {
+                    LOG_WARNING("").error(st);

Review Comment:
   put some key word in the log e.g.
   "failed to remove, key = {}" ...
   
   



##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -1285,9 +1315,24 @@ void BlockFileCache::remove(FileBlockSPtr file_block, T& 
cache_lock, U& block_lo
         key.offset = offset;
         key.meta.type = type;
         key.meta.expiration_time = expiration_time;
-        Status st = _storage->remove(key);
-        if (!st.ok()) {
-            LOG_WARNING("").error(st);
+        if (sync) {
+            Status st = _storage->remove(key);
+            if (!st.ok()) {
+                LOG_WARNING("").error(st);
+            }
+        } else {
+            // the file will be deleted in the bottom half
+            // so there will be a window that the file is not in the cache but 
still in the storage
+            // but it's ok, because the rowset is stale already
+            // in case something unexpected happen, set the _recycle_keys 
queue to zero to fallback
+            bool ret = _recycle_keys->push(key);
+            if (!ret) {
+                LOG_WARNING("Failed to push recycle key to queue, do it 
synchronously");
+                Status st = _storage->remove(key);
+                if (!st.ok()) {
+                    LOG_WARNING("").error(st);

Review Comment:
   put some key word in the log e.g.
   "failed to remove async, key = {}" ...
   
   



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