From 08908175782573c536cb485092e473c7f1729281 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 28 Mar 2014 11:50:04 +0000
Subject: [PATCH] OPENDJ-1177 (CR-3278) Re-implement changelog purging logic
---
opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java b/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
index afe3adc..f755ec8 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2013 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.replication.server.changelog.je;
@@ -186,10 +186,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
@@ -197,9 +198,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());
@@ -208,7 +210,10 @@
insertCounterRecordIfNeeded(change.getCSN());
db.put(null, key, data);
counterCurrValue++;
+
+ totalSize += change.size();
}
+ return totalSize;
}
catch (DatabaseException e)
{
--
Gitblit v1.10.0