justinli500 commented on code in PR #49855:
URL: https://github.com/apache/arrow/pull/49855#discussion_r3725723253
##########
cpp/src/arrow/io/caching.cc:
##########
@@ -151,11 +152,19 @@ struct ReadRangeCache::Impl {
IOContext ctx;
CacheOptions options;
- // Ordered by offset (so as to find a matching region by binary search)
- std::vector<RangeCacheEntry> entries;
+ // Ordered by offset (so as to find a matching region by binary search).
+ // Mutation of `entries` and of individual entries' futures must be
+ // serialized via `entry_mutex`. Every public method that touches either
+ // acquires the mutex before delegating to the protected *Locked helpers
+ // below, so both the eager and lazy variants are safe to call concurrently
+ // from multiple threads.
+ std::deque<RangeCacheEntry> entries;
+ std::mutex entry_mutex;
virtual ~Impl() = default;
+ // -- Polymorphic hooks. Always called with entry_mutex held. --
Review Comment:
Agreed, removed.
--
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]