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

Jean-Noel Rouvignac
07.02.2013 4cd3d75a0c4b165101245c51f7ca4b8f8bdad7dc
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
commit4cd3d75a0c4b165101245c51f7ca4b8f8bdad7dc
tree 828352697a8f45447d421a0f1850544662095412 tree | zip | gz
parent 64a414d1e8790f167e26819dc5d5322face58182 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
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java 5 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServer.java 6 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 65 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java 18 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java 27 ●●●●● diff | view | raw | blame | history