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

Jean-Noel Rouvignac
18.25.2014 b6ccb560e9056cc9c028812f5f63ff2e80c95c87
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Friday, July 18, 2014 15:25 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Friday, July 18, 2014 15:25 +0200
commitb6ccb560e9056cc9c028812f5f63ff2e80c95c87
tree 46f56410d5ea4c463d511737f66964cb40c3cd5f tree | zip | gz
parent 22ec3dd24c3af40cc6e67318cf83b88e55242d06 view | diff
OPENDJ-1441 (CR-4037) Persistent searches on external changelog do not return changes for new replicas and new domains



This commit only fixes the "new replicas" case.

For this, I made the existing CompositeDBCursor abstract and implemented 2 new cursors: DomainDBCursor and MultiDomainDBCursor which iterate on a single replication domain or in a cross domain fashion.

These new cursors are able to react to topology changes like a new domain or a new replica.
However, ECL persistent search cannot take advantage of them right now because their list of ECLServerHandler.domainCtxts is initialized at the start of the search and never updated after.


Please note that I added new methods to ReplicationDomainDB, but several of them are just called by DomainDBCursor, MultiDomainDBCursor or ChangeNumberIndexer which are considered internal classes to the changelog DB. So maybe should we find a way to hide them from code client to the changelogDB.

These changes meant I could remove the awful double way to use the CompositeDBCursor + I could also remove most cursor management from ChangeNumberIndexer. I think I might find a way in a subsequent commit to also get rid of ChangeNumberIndexer.replicasOffline.

Alas the same changes are duplicated in JE + file based changelog.



DomainDBCursor.java, MultiDomainDBCursor.java: ADDED

ReplicationDomainDB.java:
Added getCursorFrom(MultiDomainServerState startAfterState) and unregisterCursor(DBCursor) called by DomainDBCursor and MultiDomainDBCursor.

FileChangelogDB.java, JEChangelogDB.java:
Added registeredDomainCursors and registeredMultiDomainCursors fields.
In getExistingOrNewDomainMap(), updated MultiDomainDBCursors when a new domain is created.
In getCursorFrom(DN baseDN, int serverId, CSN), created the ReplicaOfflineCSN there from getCursorFrom(DN baseDN, ServerState).
Added newDomainDBCursor().
Reworked newOfflineCSN().
Implemented new methods in ReplicationDomainDB.
In getOrCreateReplicaDB(), updated DomainDBCursors when a new replica is created.
Synchronized the two files to ease diffing them together.

ChangeNumberIndexer.java:
Removed the responsibility to manage cursors from this class.
Removed allCursors, newCursors fields.
In publishUpdateMsg(), initialize(), moveForwardMediumConsistencyPoint() and run() removed code that dealt with creating/opening/recreating/removing cursors.
Removed resetNextChangeForInsertDBCursor(), ensureCursorExists(), removeCursors(), getCursor(), recycleExhaustedCursors(), createNewCursors(), getPrecedingCSN().
Made getPrecedingCSN() public static.
Added logUnexpectedException().


CompositeDBCursor.java:
Now abstract.
Removed ctor.
Removed recycleExhaustedCursors field.
Added incorporateNewCursors, isCursorNoLongerNeededFor(), cursorRemoved() and addCursor() + used them in next().
In next(), extracted recycleExhaustedCursors + used newly added removeNoLongerNeededCursors().
In close(), completed code.

ChangeNumberIndexerTest.java:
Consequence of the changes to ChangeNumberIndexer.
Renamed cursors field to replicaDBCursors.
Added multiDomainCursor, domainDBCursors fields.
Added eclEnabledDomains field to separate it from startCNIndexer().
Changed setup() and addReplica().

CompositeDBCursorTest.java:
Consequence of the change to CompositeDBCursor.
2 files added
7 files modified
1367 ■■■■■ changed files
opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java 37 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/file/FileChangelogDB.java 161 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java 359 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java 154 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/DomainDBCursor.java 132 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java 244 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/MultiDomainDBCursor.java 130 ●●●●● diff | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexerTest.java 115 ●●●●● diff | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursorTest.java 35 ●●●●● diff | view | raw | blame | history