OPENDJ-2183 ECL: changes for new suffix are missing
OPENDJ-2184 ECL: wrong number of changes after adding a new replica
Code review: CR-7431
This problem is linked to OPENDJ-2141, where we introduced a "default" value for a CSN when starting from a changeNumberIndex record.
Explanation: when the server starts up, the newest record is read from the change number index db, so the change number indexer knows where to start.
From there, we must start all the cursors, and we are using the newest CSN as a starting point.
The triplet (LESS_THAN_OR_EQUAL_TO_KEY, ON_MATCHING_KEY, newestCsn) is then used to start all cursors, including the cursors for replica DBs created dynamically much after server startup.
When opening a cursor for any new replica, the provided default CSN cannot be found in the replica DB. Because of this condition and the provided triplet, the file-based changelog code creates an empty cursor.
Empty cursors cannot be recycled to iterate over the populated replica DB (And in that case, the replica DB already has the change csn3!!).
I think this is incorrect. This change fixes this.
LogTest.java, LogFileTest.java, BlockLogReaderWriterTest:
Changed the unit tests, so the returned values match what we need.
Log.java:
In getCursor(), changed the condition that creates a valid cursor to also include LESS_THAN_OR_EQUAL_TO_KEY.
BlockLogReader.java:
In positionToKeySequentially() and getMatchingRecord(), removed the code handling LESS_THAN_OR_EQUAL_TO_KEY and AFTER_MATCHING_KEY.
Renamed positionToKeySequentially() to positionToKey().