anton-vinogradov commented on code in PR #13316:
URL: https://github.com/apache/ignite/pull/13316#discussion_r3588149486


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java:
##########
@@ -153,6 +157,9 @@ public abstract class GridNearAtomicAbstractUpdateFuture 
extends GridCacheFuture
     /** Handle binary in interceptor operation flag. */
     protected boolean keepBinaryInInterceptor;
 
+    /** Near entries reserved against eviction for the time of update. */
+    protected Map<KeyCacheObject, GridNearCacheEntry> reservedEntries;

Review Comment:
   Your change keeps `entry.reserveEviction()` and only drops the map `put`, so 
the near entry is still created and still reserved for the window — that's why 
the four race tests still pass: the placeholder exists and can't be removed 
while the reordered response is in flight.
   
   What dropping the `put` actually breaks is the *release*: the reservation 
taken by `reserveEviction()` is never released (the map is what 
`releaseNearCacheEntry` / `releaseNearCacheEntries` iterate), so 
`evictReservations` stays > 0 and the entry becomes permanently non-evictable.
   
   The four race tests don't notice because they configure no near eviction 
policy and only assert the final value — they never exercise eviction after the 
operation. `testNearEvictionPolicyOnUpdates` does, and with your change it 
fails:
   
   ```
   expected:<3> but was:<100>
   ```
   
   i.e. a FIFO(3) near cache can no longer evict down to its limit, because 
every entry is stuck reserved.
   
   So `reservedEntries` isn't there to make the entry *exist* (that's 
`entryExx`) — it's the bookkeeping that *releases* the reservation once the 
operation completes, making the entry evictable again. For a cache without near 
eviction that release is effectively a no-op, but the code path is shared and 
for a cache with near eviction it's mandatory. (The reservation itself is still 
needed even without a configured policy: otherwise the empty near placeholder 
is removed via `markObsoleteIfEmpty` in `touch()` during the window and the 
race reappears.)



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

Reply via email to