anton-vinogradov commented on PR #13447:
URL: https://github.com/apache/ignite/pull/13447#issuecomment-5232188446

   An entry from a cache without an expiry policy now arrives already expired.
   
   `initTime == 0` is the "no expiration" mark, but `initTime` has no `@Order`, 
so it does not go on the wire, and the empty constructor the message factory 
uses always sets it:
   
   ```java
   public GridCacheEntryInfo() {
       initTime = System.currentTimeMillis();
   }
   ```
   
   So on the receiver `initTime` is never zero and `expireTime()` returns 
`initTime + expireTimeDelta`, the moment the message object was created. Every 
expiration check in the code reads that as expired, `expireTime > 0 && 
expireTime <= U.currentTimeMillis()`.
   
   * sender, no expiry policy: `initTime = 0`, `expireTimeDelta = 0`, and only 
the delta is transferred
   * receiver: `initTime = <read time>`, `expireTimeDelta = 0`, `expireTime() = 
<read time>`
   
   That is every entry of every cache that has no expiry policy, on rebalance 
and on every get response. On rebalance 
`IgniteCacheOffheapManagerImpl.storeEntries` puts the value into the data row, 
so the entries land with a pending expiration and the TTL thread removes them.
   
   `GridCacheRebalancingSyncCheckDataTest` catches it. Green on master, red on 
bc38d2b2:
   
   ```
   [ERROR] Tests run: 1, Failures: 1 -- GridCacheRebalancingSyncCheckDataTest
   
GridCacheRebalancingSyncCheckDataTest.access$100:37->JUnitAssertAware.assertNotNull:180
   ```
   
   Same thing at the unit level:
   
   ```java
   assertEquals(0, writeAndReadBack(entryInfo(0)).expireTime());
   
   java.lang.AssertionError: expected:<0> but was:<1786287823668>
   ```
   
   The mark has to live in a transferred field. `-1` in the delta itself does 
that, and in the varint wire format it costs the same single byte as `0`, so it 
is free. That, together with the clamp that keeps the negative range 
unambiguous, is what https://github.com/Vladsz83/ignite/pull/1 does.
   


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