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


##########
be/src/storage/segment/segment.cpp:
##########
@@ -1379,7 +1387,10 @@ Status 
Segment::_get_segment_footer(std::shared_ptr<SegmentFooterPB>& footer_pb,
                                   _file_reader->size() - 12);
     }
     footer_pb_shared = cache_handle.get<std::shared_ptr<SegmentFooterPB>>();
-    _footer_pb = footer_pb_shared;
+    {
+        std::lock_guard<std::mutex> lock(_footer_pb_lock);
+        _footer_pb = footer_pb_shared;

Review Comment:
   consider removing `_footer_pb` to get footer from cache directly.
   the reason why there is a race is accessing an evicted footer, and try to 
modify the buffer `_footer_pb`, it is essentially a bug breaks the LRU order.
   
   read the cache directly seems fixing both bugs.



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