Skip to content

Commit

Permalink
comment clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
henningandersen committed Aug 26, 2024
1 parent d46d105 commit 67ca3c8
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -806,10 +806,12 @@ private static VarHandle findIOVarHandle() {
final RegionKey<KeyType> regionKey;
final SparseFileTracker tracker;
// io can be null when not init'ed or after evict/take
// io does not need volatile access on the read path, since it goes from null to a final value only and "cache.get" never returns
// a `CacheFileRegion` without checking the value is non-null (with a volatile read, ensuring the value is visible in that thread).
// we assume any IndexInput passing among threads (slicing etc) is done with proper happens-before semantics (otherwise they'd
// themselves break).
// io does not need volatile access on the read path, since it goes from null to a single value (and then possbily back to null).
// "cache.get" never returns a `CacheFileRegion` without checking the value is non-null (with a volatile read, ensuring the value is
// visible in that thread).
// We assume any IndexInput passing among threads is done with proper happens-before semantics (otherwise they'd themselves break).
// In general, assertions should use `nonVolatileIO` (when they can) to access this over `volatileIO` to avoid memory visibility
// side effects
private SharedBytes.IO io = null;

CacheFileRegion(SharedBlobCacheService<KeyType> blobCacheService, RegionKey<KeyType> regionKey, int regionSize) {
Expand Down

0 comments on commit 67ca3c8

Please sign in to comment.