Catch JournalReader.next() violations in Mode.COMMITS 04/110704/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2024 09:39:30 +0000 (10:39 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2024 13:11:49 +0000 (14:11 +0100)
commit3e0157ea7d1e5cc48831695ebb399ac352f5cb22
tree6dce17e1eff7eec6aa33d9ce070c5c78214b14c5
parent0ce0ed5f87ff222b7c5c51ba27b69b1ddb57e965
Catch JournalReader.next() violations in Mode.COMMITS

JournalReader.next() is specified as an Iterator and should be throwing
NSEs. This is not the case when we ask for only commits, as the
corresponding check is done only in hasNext() and thus we would give out
uncommitted entries.

Fix this by adding an override to check for this condition.

JIRA: CONTROLLER-2106
Change-Id: I1f391cc19b9674646786c93656b83519e0f1f47b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 86ff19a91c2d4aa71f88135898ebc75fd3caee85)
atomix-storage/src/main/java/io/atomix/storage/journal/CommitsSegmentJournalReader.java
atomix-storage/src/main/java/io/atomix/storage/journal/JournalReader.java
atomix-storage/src/main/java/io/atomix/storage/journal/SegmentedJournalReader.java
atomix-storage/src/test/java/io/atomix/storage/journal/AbstractJournalTest.java