From b38c44b5260c498cbe60b6afac6b53266faa1432 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 09 Oct 2013 08:43:46 +0000
Subject: [PATCH] OPENDJ-1116 Introduce abstraction for the changelog DB

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java        |   17 ++++++++++++++++-
 opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java |    3 +++
 opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java
index 0cbd405..bda1390 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ChangeNumberIndexDB.java
@@ -87,6 +87,9 @@
    * <p>
    * This method is blocking if the size of the list of message is larger than
    * its maximum.
+   * <p>
+   * FIXME will be removed when ECLServerHandler will not be responsible anymore
+   * for lazily building the ChangeNumberIndexDB.
    *
    * @param record
    *          The {@link CNIndexRecord} to add to this DB.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java
index bc57fbe..59c62cf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java
@@ -73,6 +73,9 @@
 
   /**
    * Retrieves the latest trim date for the specified replication domain.
+   * <p>
+   * FIXME will be removed when ECLServerHandler will not be responsible anymore
+   * for lazily building the ChangeNumberIndexDB.
    *
    * @param baseDN
    *          the replication domain baseDN
@@ -215,4 +218,34 @@
   boolean publishUpdateMsg(DN baseDN, UpdateMsg updateMsg)
       throws ChangelogException;
 
+  /**
+   * Let the DB know this replica is alive.
+   * <p>
+   * This method allows the medium consistency point to move forward in case
+   * this replica did not publish new changes.
+   *
+   * @param baseDN
+   *          the replication domain baseDN
+   * @param csn
+   *          The CSN heartbeat sent by this replica (contains the serverId and
+   *          timestamp of the heartbeat)
+   */
+  void replicaHeartbeat(DN baseDN, CSN csn);
+
+  /**
+   * Let the DB know this replica is going down.
+   * <p>
+   * This method allows to let the medium consistency point move forward while
+   * this replica is offline.
+   * <p>
+   * Note: This method must not be called to let the DB know the replica is not
+   * sending heartbeats anymore, i.e. it must not be used in case of suspected
+   * network partition.
+   *
+   * @param baseDN
+   *          the replication domain baseDN
+   * @param serverId
+   *          The replica's serverId going offline
+   */
+  void replicaOffline(DN baseDN, int serverId);
 }
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java
index de85252..e7f09eb 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java
@@ -48,7 +48,7 @@
 import static org.opends.server.util.StaticUtils.*;
 
 /**
- * JE implementation of the ChangelogDB.
+ * JE implementation of the ChangelogDB interface.
  */
 public class JEChangelogDB implements ChangelogDB, ReplicationDomainDB
 {
@@ -724,4 +724,19 @@
     return wasCreated;
   }
 
+  /** {@inheritDoc} */
+  @Override
+  public void replicaHeartbeat(DN baseDN, CSN csn)
+  {
+    // TODO implement this when the changelogDB will be responsible for
+    // maintaining the medium consistency point
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public void replicaOffline(DN baseDN, int serverId)
+  {
+    // TODO implement this when the changelogDB will be responsible for
+    // maintaining the medium consistency point
+  }
 }

--
Gitblit v1.10.0