devabhishekpal commented on PR #1320:
URL: https://github.com/apache/ratis/pull/1320#issuecomment-3566353728

   It seems the tests are failing because in `findLatestSnapshot()` we are 
doing:
   ```
   getSingleFileSnapshotInfos(dir, true).iterator()
   ```
   Now if we create an initial snapshot with md5 file, this will return null 
from the check:
   ```
   if (!i.hasNext()) {
         return null;
   }
   ```
   
   We now create a second snapshot with no MD5 hash, this will still return 
null as the iterator still has one element.
   Hence when we run a scenario as below:
   ```
   try {
         createSnapshot(simpleStateMachineStorage, 1, 100, true);
         simpleStateMachineStorage.loadLatestSnapshot();
   
         createSnapshot(simpleStateMachineStorage, 1, 200, false);
         simpleStateMachineStorage.loadLatestSnapshot();
   
         SingleFileSnapshotInfo latest = 
simpleStateMachineStorage.getLatestSnapshot();
         Assertions.assertNotNull(latest);
   }
   ```
   latest is always returned as null even though there are two snapshots 
present.
   Previous behaviour would have been that it would have returned one snapshot.
   
   This is also causing gRPC test failures as 
`SimpleStateMachineStorage.findLatestSnapshot()` filters out every snapshot 
that lacks an MD5 file as we are passing `(requireMd5 == true)`. So on the 
follower that just copied the snapshot, `findLatestSnapshot` now returns `null` 
- `loadLatestSnapshot()` never updates the cache, and the snapshot install is 
effectively ignored.
   Hence follower never recognises the installed snapshot, it fails to catch up 
and doesn’t participate in the new configuration. setConfiguration therefore 
keeps retrying and times-out
   
   @szetszwo do you think we might need to change the test case? Or should the 
behaviour be changed?


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