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/ServerWriter.java | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ServerWriter.java b/opends/src/server/org/opends/server/replication/server/ServerWriter.java
index 9a865a0..b051836 100644
--- a/opends/src/server/org/opends/server/replication/server/ServerWriter.java
+++ b/opends/src/server/org/opends/server/replication/server/ServerWriter.java
@@ -30,6 +30,7 @@
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
+import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import static org.opends.messages.ReplicationMessages.*;
import java.io.IOException;
@@ -97,12 +98,35 @@
TRACER.debugInfo("LDAP server writer starting " + serverId);
}
}
- try {
+ try
+ {
while (true)
{
UpdateMessage update = replicationCache.take(this.handler);
if (update == null)
return; /* this connection is closing */
+
+ // Ignore update to be sent to a replica with a bad generation ID
+ long referenceGenerationId = replicationCache.getGenerationId();
+ if (referenceGenerationId != handler.getGenerationId())
+ {
+ logError(ERR_IGNORING_UPDATE_TO.get(
+ update.getDn(),
+ this.handler.getMonitorInstanceName()));
+ continue;
+ }
+
+ if (debugEnabled())
+ {
+ TRACER.debugInfo(
+ "In " + replicationCache.getReplicationServer().
+ getMonitorInstanceName() +
+ ", writer to " + this.handler.getMonitorInstanceName() +
+ " publishes" + update.toString() +
+ " refgenId=" + referenceGenerationId +
+ " server=" + handler.getServerId() +
+ " generationId=" + handler.getGenerationId());
+ }
session.publish(update);
}
}
@@ -130,7 +154,8 @@
* An unexpected error happened.
* Log an error and close the connection.
*/
- Message message = ERR_WRITER_UNEXPECTED_EXCEPTION.get(handler.toString());
+ Message message = ERR_WRITER_UNEXPECTED_EXCEPTION.get(handler.toString() +
+ " " + stackTraceToSingleLineString(e));
logError(message);
}
finally {
--
Gitblit v1.10.0