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

Jean-Noel Rouvignac
07.02.2013 e828cedbf4a929233339ac8c8bdb03134eb155c1
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Monday, October 7, 2013 13:02 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Monday, October 7, 2013 13:02 +0200
commite828cedbf4a929233339ac8c8bdb03134eb155c1
tree 0582598ce1bb0f5942ddb3f74a4d7154a154feb3 tree | zip | gz
parent ffa2b6d64ffa66e288e462c7714f01f1c5d8c6b5 view | diff
OPENDJ-1116 Introduce abstraction for the changelog DB


Slayered walking dead code.
Walking dead code is code that looks it is alive, tastes just like if it was alive, but there is funny smell about it, and actually... it turns out this code is dead.
ReplicationServerDomain.getEligibleState() is walking dead code because:
- JEChangelogDB.getCSNAfter() always returns null: the API of ReplicaDBCursor mandates to call call next() before calling getChange(), however getCSNAfter() fails to do so, hence getChange() always returns null, which means getCSNAfter() always returns null.
- the "result" local variable is a duplicate of "latestState", which means it starts of with the exact same state. The code iterates through "latestState" to get its CSNs, calling update() on "result" with these CSNs. But... since "result" duplicates "latestState", it has the exact same CSNs, which means calling update() will have no effect on "result", leaving it on the same state as it was before the iterations.


ECLServerHandler.java, ReplicationServer.java:
Replaced ReplicationServerDomain.getEligibleState() with ReplicationServerDomain.getLatestServerState().duplicate() where applicable.

ReplicationServerDomain.java:
Removed getEligibleState() which does literally nothing, but in a very inneficient way.

ReplicationDomainDB.java, JEChangelogDB.java:
Removed getCSNAfter(), now become unused.
5 files modified
121 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java 5 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java 6 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 65 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java 18 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java 27 ●●●●● diff | view | raw | blame | history