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


##########
be/src/storage/segment/column_reader_cache.cpp:
##########
@@ -60,6 +60,15 @@ std::shared_ptr<ColumnReader> 
ColumnReaderCache::_lookup(const ColumnReaderCache
 
 void ColumnReaderCache::_insert_locked_nocheck(const ColumnReaderCacheKey& key,
                                                const 
std::shared_ptr<ColumnReader>& reader) {
+    // Replacing an existing key updates its node in place. Pushing a second 
node for the same key
+    // would leave the first one unreachable in the list while eviction erases 
the map entry of
+    // whichever copy reaches the tail, dropping the live reader from the map.
+    if (auto it = _cache_map.find(key); it != _cache_map.end()) {

Review Comment:
   [P1] Preserve the constant reader across concurrent misses. `_lookup` 
releases `_cache_mutex` before construction, so a bare request can miss and 
start building the physical reader, a constant request can then insert and 
return its reader, and the first request reaches this branch last and 
overwrites it. Since a cached `Segment` is shared, a query that already created 
a `ConstantColumnIterator` can then do the bare index lookup and receive the 
placeholder's physical index; for example, real commit TSO 42 with `tso > 20` 
can be eliminated by an index containing 0, with the predicate removed from row 
fallback. This is the inverse concurrent order from the existing sequential 
comment. Please make the compare-and-upsert constant-dominant regardless of 
arrival order, return the selected authoritative reader to the caller, and add 
a barrier-controlled mixed physical/constant miss test.



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