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

Jean-Noel Rouvignac
07.29.2014 2f54bf6d307ffcdd3c65937e181b16bffb277a2c
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Monday, July 7, 2014 17:29 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Monday, July 7, 2014 17:29 +0200
commit2f54bf6d307ffcdd3c65937e181b16bffb277a2c
tree aa5cfe6f2f9ef9bc8d7989ac7e72b9929c7606c8 tree | zip | gz
parent a4727fc35615f0b8968da45f7917a0eea9a7aefe view | diff
OPENDJ-1453 Replica offline messages should be synced with updates

In r10840, the change to JE/FileChangelogDB.getCursorFrom(DN, ServerState) unnecessarily triggers a lot of calls to the underlying DB (JE or file based) to retrieve the ChangelogState.
As an optimization, keeping an in-memory version of the ChangelogState in synch with the on-disk version will help.


ChangelogState.java:
Now thread safe.
Added removeOfflineReplica(), isEqualTo().
Changed domainToServerIds from Map<DN, List<Integer>> to Map<DN, Set<Integer>>.
In getOfflineReplicas(), now return a MultiDomainServerState.

ChangeNumberIndexer.java:
Consequence of the changes to ChangelogState.


ReplicationDbEnv.java:
Added changelogState field, updated at the same time as the on-disk changelogstate DB
Added getChangelogState(), called by client code instead of readChangelogState().
Renamed readChangelogState() to private readOnDiskChangelogState().
Added stateLock field to sync updates to in-memory and on-disk changelog state.

ReplicationEnvironment.java:
Added changelogState field, updated at the same time as the on-disk changelogstate DB
Added getChangelogState(), called by client code instead of readChangelogState().
Renamed readChangelogState() to private readOnDiskChangelogState().
Renamed domainLock field to domainsLock.

replication.properties:
Removed now unused error message.

FileChangelogDB.java, JEChangelogDB.java:
Consequence of the changes to ChangelogState and ReplicationEnvironment/ReplicationDbEnv.


MultiDomainServerState.java, ServerState.java:
Added getSnapshot() for unit tests.

ReplicationEnvironmentTest.java, ReplicationDbEnvTest.java:
Consequence of the changes to ReplicationEnvironment and ChangelogState.
Used the fake server.
11 files modified
425 ■■■■ changed files
opendj-sdk/opends/src/messages/messages/replication.properties 2 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/common/MultiDomainServerState.java 27 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java 14 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/ChangelogState.java 89 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/FileChangelogDB.java 19 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/file/ReplicationEnvironment.java 100 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java 13 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java 19 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDbEnv.java 72 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/file/ReplicationEnvironmentTest.java 52 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/changelog/je/ReplicationDbEnvTest.java 18 ●●●●● diff | view | raw | blame | history