-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add failing test for deletion of index segments on sequence reset.
Users have spotted exceptions like the following: ``` java.lang.IllegalStateException: Replay index header file did not exist, but the following segment files did: [/hydra/data/log/replay-index-3-1-1, /hydra/data/log/replay-index-3-1-2] at uk.co.real_logic.artio.engine.logger.ReplayIndex$SessionIndex.checkSegmentFilesDoNotExist(ReplayIndex.java:561) at uk.co.real_logic.artio.engine.logger.ReplayIndex$SessionIndex.<init>(ReplayIndex.java:536) at uk.co.real_logic.artio.engine.logger.ReplayIndex.lambda$new$0(ReplayIndex.java:63) at org.agrona.collections.Long2ObjectHashMap.computeIfAbsent(Long2ObjectHashMap.java:382) at uk.co.real_logic.artio.engine.logger.ReplayIndex.sessionIndex(ReplayIndex.java:475) at uk.co.real_logic.artio.engine.logger.ReplayIndex.onFixMessage(ReplayIndex.java:417) at uk.co.real_logic.artio.engine.logger.ReplayIndex.onFragment(ReplayIndex.java:287) at uk.co.real_logic.artio.engine.logger.ReplayIndex.onFragment(ReplayIndex.java:253) at uk.co.real_logic.artio.engine.logger.Indexer.onFragment(Indexer.java:180) at io.aeron.Image.controlledPoll(Image.java:369) at io.aeron.Subscription.controlledPoll(Subscription.java:240) at uk.co.real_logic.artio.engine.logger.Indexer.doWork(Indexer.java:78) at org.agrona.concurrent.CompositeAgent.doWork(CompositeAgent.java:120) at org.agrona.concurrent.AgentRunner.doWork(AgentRunner.java:304) at org.agrona.concurrent.AgentRunner.workLoop(AgentRunner.java:296) at org.agrona.concurrent.AgentRunner.run(AgentRunner.java:162) ``` It appears `uk.co.real_logic.artio.engine.logger.ReplayIndex.SessionIndex#reset` loops over `segmentBufferFiles` and deletes them on a sequence reset; however, files are added to `segmentBufferFiles` lazily in `onRecord`. Therefore, it will only delete all segments files only when the indexer has written records to _all_ segments since it started. One of the tests I've added (the ignored one) demonstrates this behaviour.
- Loading branch information
Showing
2 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters