From b48ce50fdf4d73e8be3799e3a7c6c2bf9d1b2965 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Sun, 02 Sep 2007 17:58:07 +0000
Subject: [PATCH] fix for #1733 & #845 - Initialization of replication
---
opends/src/server/org/opends/server/replication/server/ReplicationDB.java | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationDB.java b/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
index f1b67af..4f4ea3c 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
@@ -62,11 +62,11 @@
/**
* Creates a new database or open existing database that will be used
* to store and retrieve changes from an LDAP server.
- * @param serverId Identifier of the LDAP server.
- * @param baseDn baseDn of the LDAP server.
- * @param replicationServer the ReplicationServer that needs to be shutdown
- * @param dbenv the Db encironemnet to use to create the db
- * @throws DatabaseException if a database problem happened
+ * @param serverId The identifier of the LDAP server.
+ * @param baseDn The baseDn of the replication domain.
+ * @param replicationServer The ReplicationServer that needs to be shutdown.
+ * @param dbenv The Db environment to use to create the db.
+ * @throws DatabaseException If a database problem happened.
*/
public ReplicationDB(Short serverId, DN baseDn,
ReplicationServer replicationServer,
@@ -77,8 +77,10 @@
this.baseDn = baseDn;
this.dbenv = dbenv;
this.replicationServer = replicationServer;
- db = dbenv.getOrAddDb(serverId, baseDn);
+ // Get or create the associated Replicationcache and Db.
+ db = dbenv.getOrAddDb(serverId, baseDn,
+ replicationServer.getReplicationCache(baseDn, true).getGenerationId());
}
/**
@@ -472,4 +474,19 @@
cursor.delete();
}
}
+
+ /**
+ * Clears this change DB from the changes it contains.
+ *
+ * @throws Exception Throws an exception it occurs.
+ * @throws DatabaseException Throws a DatabaseException when it occurs.
+ */
+ public void clear() throws Exception, DatabaseException
+ {
+ // Clears the changes
+ dbenv.clearDb(this.toString());
+
+ // Clears the reference to this serverID
+ dbenv.clearServerId(baseDn, serverId);
+ }
}
--
Gitblit v1.10.0