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

Jean-Noel Rouvignac
31.40.2014 14e5a18a4ba3146470fd4d82152b6f061b442dce
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Monday, March 31, 2014 11:40 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Monday, March 31, 2014 11:40 +0200
commit14e5a18a4ba3146470fd4d82152b6f061b442dce
tree 2ea2b441aa81da7270fef608ba54ebcbabcd48fc tree | zip | gz
parent 4fe6d52250310fca8e2fc2887f3717a78e2ebaa9 view | diff
OPENDJ-1177 Re-implement changelog purging logic

Code review: Matthew Swift

Code fix after r10601.
Several problems shown by continuous integration:
* Deadlocks,
* Long waits

JEReplicaDB.java:
In clear(), calling collectAllPermits() while holding the flushLock actually prevented flushing to happen because it also needed the flushLock. Calling collectAllPermits() does not require to hold the flushLock, and once this method returns the msgQueue should be empty anyway and all the changes should have been pushed to the DB (flush() first removes messages from msgQueue, then add to DB, then releases all permits). In effect, there is no need to synchronize on flushLock anymore.
In trim(), the check for queue being below low mark was wrong (comparing queue size with number of bytes): extracted isQueueAboveLowMark() and fixed its definition + removed synchronized (flushLock) because it is now deemed unnecessary.
In generateCursorFrom(), Removed unnecessary call to flush() because that method is also called from JEReplicaDBCursor ctor.
1 files modified
117 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java 117 ●●●● diff | view | raw | blame | history