Skip to content

Commit

Permalink
Improved reliability on db delta sync Issue #5455
Browse files Browse the repository at this point in the history
Missing the periodic LSN gossip message
  • Loading branch information
lvca committed Dec 11, 2015
1 parent 74586fc commit e5d4f2d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
Expand Up @@ -640,7 +640,7 @@ public void memberRemoved(final MembershipEvent iEvent) {


if (n.startsWith(CONFIG_DBSTATUS_PREFIX)) if (n.startsWith(CONFIG_DBSTATUS_PREFIX))
if (n.substring(CONFIG_DBSTATUS_PREFIX.length()).equals(nodeLeftName)) { if (n.substring(CONFIG_DBSTATUS_PREFIX.length()).equals(nodeLeftName)) {
ODistributedServerLog.debug(this, nodeLeftName, null, DIRECTION.NONE, ODistributedServerLog.debug(this, nodeName, null, DIRECTION.NONE,
"removing dbstatus for the node %s that just left: %s", nodeLeftName, n); "removing dbstatus for the node %s that just left: %s", nodeLeftName, n);
it.remove(); it.remove();
} }
Expand All @@ -657,7 +657,7 @@ public void memberRemoved(final MembershipEvent iEvent) {
if (nodeLeftName.startsWith("ext:")) { if (nodeLeftName.startsWith("ext:")) {
final List<String> registeredNodes = getRegisteredNodes(); final List<String> registeredNodes = getRegisteredNodes();


ODistributedServerLog.error(this, nodeLeftName, null, DIRECTION.NONE, ODistributedServerLog.error(this, nodeName, null, DIRECTION.NONE,
"removed node id=%s name=%s has not being recognized. Remove the node manually (registeredNodes=%s)", member, "removed node id=%s name=%s has not being recognized. Remove the node manually (registeredNodes=%s)", member,
nodeLeftName, registeredNodes); nodeLeftName, registeredNodes);
} }
Expand All @@ -680,39 +680,39 @@ public void entryAdded(final EntryEvent<String, Object> iEvent) {
if (key.startsWith(CONFIG_NODE_PREFIX)) { if (key.startsWith(CONFIG_NODE_PREFIX)) {
if (!iEvent.getMember().equals(hazelcastInstance.getCluster().getLocalMember())) { if (!iEvent.getMember().equals(hazelcastInstance.getCluster().getLocalMember())) {
final ODocument cfg = (ODocument) iEvent.getValue(); final ODocument cfg = (ODocument) iEvent.getValue();
final String nodejoinedName = (String) cfg.field("name"); final String joinedNodeName = (String) cfg.field("name");


if (this.nodeName.equals(nodejoinedName)) { if (this.nodeName.equals(joinedNodeName)) {
ODistributedServerLog.error(this, nodejoinedName, getNodeName(iEvent.getMember()), DIRECTION.IN, ODistributedServerLog.error(this, joinedNodeName, getNodeName(iEvent.getMember()), DIRECTION.IN,
"Found a new node with the same name as current: '" + nodejoinedName "Found a new node with the same name as current: '" + joinedNodeName
+ "'. The node has been excluded. Change the name in its config/orientdb-dserver-config.xml file"); + "'. The node has been excluded. Change the name in its config/orientdb-dserver-config.xml file");


throw new ODistributedException("Found a new node with the same name as current: '" + nodejoinedName throw new ODistributedException("Found a new node with the same name as current: '" + joinedNodeName
+ "'. The node has been excluded. Change the name in its config/orientdb-dserver-config.xml file"); + "'. The node has been excluded. Change the name in its config/orientdb-dserver-config.xml file");
} }


// NOTIFY NODE IS GOING TO BE ADDED. EVERYBODY IS OK? // NOTIFY NODE IS GOING TO BE ADDED. EVERYBODY IS OK?
for (ODistributedLifecycleListener l : listeners) { for (ODistributedLifecycleListener l : listeners) {
if (!l.onNodeJoining(nodejoinedName)) { if (!l.onNodeJoining(joinedNodeName)) {
// DENY JOIN // DENY JOIN
ODistributedServerLog.info(this, nodejoinedName, getNodeName(iEvent.getMember()), DIRECTION.IN, ODistributedServerLog.info(this, nodeName, getNodeName(iEvent.getMember()), DIRECTION.IN,
"denied node to join the cluster id=%s name=%s", iEvent.getMember(), getNodeName(iEvent.getMember())); "denied node to join the cluster id=%s name=%s", iEvent.getMember(), getNodeName(iEvent.getMember()));
return; return;
} }
} }


activeNodes.put(nodejoinedName, (Member) iEvent.getMember()); activeNodes.put(joinedNodeName, (Member) iEvent.getMember());


ODistributedServerLog.info(this, nodejoinedName, getNodeName(iEvent.getMember()), DIRECTION.IN, ODistributedServerLog.info(this, nodeName, getNodeName(iEvent.getMember()), DIRECTION.IN,
"added node configuration id=%s name=%s, now %d nodes are configured", iEvent.getMember(), "added node configuration id=%s name=%s, now %d nodes are configured", iEvent.getMember(),
getNodeName(iEvent.getMember()), activeNodes.size()); getNodeName(iEvent.getMember()), activeNodes.size());


installNewDatabases(false); installNewDatabases(false);
}


// NOTIFY NODE WAS ADDED SUCCESSFULLY // NOTIFY NODE WAS ADDED SUCCESSFULLY
for (ODistributedLifecycleListener l : listeners) for (ODistributedLifecycleListener l : listeners)
l.onNodeJoined(nodeName); l.onNodeJoined(joinedNodeName);
}


} else if (key.startsWith(CONFIG_DATABASE_PREFIX)) { } else if (key.startsWith(CONFIG_DATABASE_PREFIX)) {
// SYNCHRONIZE ADDING OF CLUSTERS TO AVOID DEADLOCKS // SYNCHRONIZE ADDING OF CLUSTERS TO AVOID DEADLOCKS
Expand Down Expand Up @@ -1019,12 +1019,12 @@ else if (value instanceof ODiscardedResponse) {
"Requesting sync of delta database '%s' on local server failed, retrying...", databaseName); "Requesting sync of delta database '%s' on local server failed, retrying...", databaseName);
return false; return false;
} else if (value instanceof ODistributedDatabaseDeltaSyncException) { } else if (value instanceof ODistributedDatabaseDeltaSyncException) {
ODistributedServerLog.error(this, nodeName, r.getKey(), DIRECTION.IN, "Error on installing database %s in %s", ODistributedServerLog.error(this, nodeName, r.getKey(), DIRECTION.IN,
databaseName, dbPath); "Error on installing database delta %s, requesting full database sync...", databaseName, dbPath);
throw (ODistributedDatabaseDeltaSyncException) value; throw (ODistributedDatabaseDeltaSyncException) value;
} else if (value instanceof Throwable) { } else if (value instanceof Throwable) {
ODistributedServerLog.error(this, nodeName, r.getKey(), DIRECTION.IN, "Error on installing database %s in %s", ODistributedServerLog.error(this, nodeName, r.getKey(), DIRECTION.IN, "Error on installing database delta %s in %s (%s)",
(Exception) value, databaseName, dbPath); (Exception) value, databaseName, dbPath, value);
} else if (value instanceof ODistributedDatabaseChunk) { } else if (value instanceof ODistributedDatabaseChunk) {


final Set<String> toSyncClusters = installDatabaseFromNetwork(dbPath, databaseName, distrDatabase, r.getKey(), final Set<String> toSyncClusters = installDatabaseFromNetwork(dbPath, databaseName, distrDatabase, r.getKey(),
Expand Down
Expand Up @@ -33,8 +33,8 @@ public ODistributedDatabaseDeltaSyncException(final ODistributedDatabaseDeltaSyn
super(exception); super(exception);
} }


public ODistributedDatabaseDeltaSyncException(final OLogSequenceNumber requested, final OLogSequenceNumber found) { public ODistributedDatabaseDeltaSyncException(final OLogSequenceNumber requested) {
super("Requested database delta sync with LSN=" + requested + " while last available LSN=" + found); super("Requested database delta sync with LSN=" + requested + " but not found in database");
} }


public ODistributedDatabaseDeltaSyncException(final String iMessage) { public ODistributedDatabaseDeltaSyncException(final String iMessage) {
Expand Down
Expand Up @@ -149,7 +149,7 @@ public void run() {


if (endLSN.get() == null) if (endLSN.get() == null)
// DELTA NOT AVAILABLE, TRY WITH FULL BACKUP // DELTA NOT AVAILABLE, TRY WITH FULL BACKUP
exception.set(new ODistributedDatabaseDeltaSyncException(startLSN, ((OAbstractPaginatedStorage) storage).getLSN())); exception.set(new ODistributedDatabaseDeltaSyncException(startLSN));


lastOperationId.set(database.getStorage().getLastOperationId()); lastOperationId.set(database.getStorage().getLastOperationId());


Expand All @@ -158,8 +158,8 @@ public void run() {


} catch (Exception e) { } catch (Exception e) {
// UNKNOWN ERROR, DELTA NOT AVAILABLE, TRY WITH FULL BACKUP // UNKNOWN ERROR, DELTA NOT AVAILABLE, TRY WITH FULL BACKUP
exception.set((ODistributedDatabaseDeltaSyncException) OException.wrapException( exception.set((ODistributedDatabaseDeltaSyncException) OException
new ODistributedDatabaseDeltaSyncException(startLSN, ((OAbstractPaginatedStorage) storage).getLSN()), e)); .wrapException(new ODistributedDatabaseDeltaSyncException(startLSN), e));


} finally { } finally {
try { try {
Expand Down

0 comments on commit e5d4f2d

Please sign in to comment.