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

Jean-Noel Rouvignac
26.19.2014 6e14a8394d193af0fa32b83d3cc424787d41eadd
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Thursday, June 26, 2014 15:19 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Thursday, June 26, 2014 15:19 +0200
commit6e14a8394d193af0fa32b83d3cc424787d41eadd
tree c2cf10e4aca637c7344ab8fcde920ddb2730c8cc tree | zip | gz
parent 933e60b44df8950bb3df2e8908d991bcb6edfc1a view | diff
OPENDJ-1453 (CR-3870) Replica offline messages should be synced with updates

Added a new ReplicaOfflineMsg to communicate that a replica is offline. ReplicaOfflineMsg extends UpdateMsg. It is possible that OPENDJ-1260 will piggy back on this new message type.
This patch makes a DS send a ReplicaOfflineMsg to its preferred RS on shutdown.
This works when we have split DS-RS, but works only 50% (guesstimate) of the time with combined DS-RS. There is a race condition between shutdown and the ReplicaOfflineMsg being forwarded by the collocated RS.
Last but not least, RSs can communicate such ReplicaOfflineMsg to other RSs via ServerWriter / ServerReader.

Another last item: Due to current change, replication is querying the changelogstate a lot more often. This is not playing nice with ExternalChangeLogTest and GenerationIdTest and required changing the File-based changelog ReplicationEnvironment class.
It might be necessary to reduce I/O to maintain an in memory copy of the changelogstate. I might do this in a subsequent commit.




ReplicaOfflineMsg.java: ADDED

ReplicationMsg.java:
Added support for ReplicaOfflineMsg.

ProtocolVersion.java:
Updated javadoc for REPLICATION_PROTOCOL_V8.

LDAPReplicationDomain.java, ReplicationDomain.java:
Added publishReplicaOfflineMsg().

ReplicationBroker.java:
In stop(), called ReplicationDomain.publishReplicaOfflineMsg().

ReplicationServerDomain.java:
In publishUpdateMsg(UpdateMsg), handled ReplicaOfflineMsg.



PendingChange.java:
Changed msg field + getMsg() return type from LDAPUpdateMsg to UpdateMsg.
Added getLDAPUpdateMsg().

PendingChanges.java:
Added putReplicaOfflineMsg().
In pushCommittedChanges(), changed the code as a consequence of the change to PendingChange.getMsg().

RemotePendingChanges.java:
Changed the code as a consequence of the change to PendingChange.getMsg().



JEChangelogDB.java:
Added ReplicaOfflineCursor inner class, decorator for a DBCursor + used it in getCursorFrom() to return ReplicaOfflineMsg to ServerWriter thread.

JEChangelogDBTest.java: ADDED
Tested ReplicaOfflineCursor.

ECLServerHandler.java:
In getNextMessage(), ignore ReplicaOfflineMsg which are useless to searches on cn=changelog.



SynchronizationMsgTest.java:
Added a test for ReplicaOfflineMsg (de)serialization.

FakeUpdateMsg.java: ADDED, extracted from CompositeDBCursorTest

CompositeDBCursorTest.java:
Replaced call to newUpdateMsg() by calling FakeUpdateMsg ctor.



ReplicationEnvironment.java:
Fixes to make ExternalChangeLogTest and GenerationIdTest work.

replication.properties:
Removed now useless messages.
4 files added
16 files modified
638 ■■■■■ changed files
opends/src/messages/messages/replication.properties 5 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java 7 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/PendingChange.java 22 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/PendingChanges.java 30 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java 12 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ProtocolVersion.java 2 ●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ReplicaOfflineMsg.java 113 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ReplicationMsg.java 5 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java 8 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 7 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/file/FileChangelogDB.java 26 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/file/ReplicationEnvironment.java 33 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java 23 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicaOfflineCursor.java 126 ●●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java 1 ●●●● diff | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java 9 ●●●●● diff | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java 11 ●●●●● diff | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursorTest.java 22 ●●●● diff | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/FakeUpdateMsg.java 47 ●●●●● diff | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/ReplicaOfflineCursorTest.java 129 ●●●●● diff | view | raw | blame | history