From 2a09adec857fd42ef4b9369f98d51343fda5ae56 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 04 Apr 2014 13:25:49 +0000
Subject: [PATCH] OPENDJ-1177 (CR-3278) Re-implement changelog purging logic
---
opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
index 30b0516..a6e3a01 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -187,10 +187,11 @@
*
* @param changes
* The list of changes to add to the underlying db.
+ * @return the total size of all the changes
* @throws ChangelogException
* If a database problem happened
*/
- public void addEntries(List<UpdateMsg> changes) throws ChangelogException
+ public int addEntries(List<UpdateMsg> changes) throws ChangelogException
{
dbCloseLock.readLock().lock();
try
@@ -198,9 +199,10 @@
// If the DB has been closed then return immediately.
if (isDBClosed())
{
- return;
+ return 0;
}
+ int totalSize = 0;
for (UpdateMsg change : changes)
{
final DatabaseEntry key = createReplicationKey(change.getCSN());
@@ -209,7 +211,10 @@
insertCounterRecordIfNeeded(change.getCSN());
db.put(null, key, data);
counterCurrValue++;
+
+ totalSize += change.size();
}
+ return totalSize;
}
catch (DatabaseException e)
{
--
Gitblit v1.10.0