mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
02.34.2015 a10168c9109c212c5fb12d86221420a11290f0d1
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Thursday, July 2, 2015 17:34 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Thursday, July 2, 2015 17:34 +0200
commita10168c9109c212c5fb12d86221420a11290f0d1
tree 7cb1902fceec6f6e4d52b3a819971cb06ebabc6a tree | zip | gz
parent e9a5411d31a65ab3bcd3313f7bb567fcaa908ef6 view | diff
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().
5 files modified
54 ■■■■■ changed files
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/BlockLogReader.java 27 ●●●● diff | view | raw | blame | history
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java 6 ●●●● diff | view | raw | blame | history
opendj-sdk/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java 13 ●●●●● diff | view | raw | blame | history
opendj-sdk/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/LogFileTest.java 4 ●●●● diff | view | raw | blame | history
opendj-sdk/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/LogTest.java 4 ●●●● diff | view | raw | blame | history