HA: Fixed problem with deploy database while servers crash
@@ -1027,11 +1027,21 @@ public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract
throw new ODistributedDatabaseDeltaSyncException("Requested database delta sync but no LSN was found");
}
+ boolean databaseInstalledCorrectly = false;
+
for (Map.Entry<String, OLogSequenceNumber> entry : selectedNodes.entrySet()) {
final String targetNode = entry.getKey();
final OLogSequenceNumber lsn = entry.getValue();
+ if (!isNodeOnline(targetNode, databaseName)) {
+ // SKIP THIS SERVER BECAUSE NOT AVAILABLE
+ ODistributedServerLog.info(this, nodeName, targetNode, DIRECTION.OUT,
+ "Skip synchronizing database delta for '%s' (LSN=%s), because server '%s' is not online", databaseName, lsn,
+ targetNode);
+ continue;
+ }
+
final OSyncDatabaseDeltaTask deployTask = new OSyncDatabaseDeltaTask(lsn,
distrDatabase.getSyncConfiguration().getLastOperationTimestamp());
@@ -1088,7 +1098,10 @@ public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract
databaseName, dbPath, value);
setDatabaseStatus(nodeName, databaseName, DB_STATUS.NOT_AVAILABLE);
- return false;
+
+ throw OException
+ .wrapException(new ODistributedDatabaseDeltaSyncException("Requested database delta sync but no LSN was found"),
+ (Throwable) value);
} else if (value instanceof ODistributedDatabaseChunk) {
// distrDatabase.filterBeforeThisMomentum(((ODistributedDatabaseChunk) value).getMomentum());
@@ -1101,10 +1114,10 @@ public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract
uniqueClustersBackupDirectory, cfg);
ODistributedServerLog
- .info(this, nodeName, targetNode, DIRECTION.IN, "Installed delta of database '%s'...", databaseName);
+ .info(this, nodeName, targetNode, DIRECTION.IN, "Installed delta of database '%s'", databaseName);
- if (!cfg.isSharded())
- // DB NOT SHARDED, THE 1ST BACKUP IS GOOD
+ // DATABASE INSTALLED CORRECTLY
+ databaseInstalledCorrectly = true;
break;
} else
@@ -1113,7 +1126,7 @@ public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract
}
} catch (ODatabaseIsOldException e) {
// FORWARD IT
- throw (ODatabaseIsOldException) e;
+ throw e;
} catch (ODistributedDatabaseDeltaSyncException e) {
// RE-THROW IT
throw e;
@@ -1123,13 +1136,20 @@ public abstract class ODistributedAbstractPlugin extends OServerPluginAbstract
databaseName, e.getMessage());
throw new ODistributedDatabaseDeltaSyncException(lsn, e.toString());
}
+
+ if (databaseInstalledCorrectly && !cfg.isSharded())
+ // DB NOT SHARDED, THE 1ST BACKUP IS GOOD
+ break;
}
+ if (databaseInstalledCorrectly) {
distrDatabase.resume();
-
return true;
}
+ throw new ODistributedDatabaseDeltaSyncException("Requested database delta sync error");
+ }
+
protected boolean requestDatabaseFullSync(final ODistributedDatabaseImpl distrDatabase, final boolean backupDatabase,
final String databaseName, final boolean iAskToAllNodes, final OModifiableDistributedConfiguration cfg) {
// GET ALL THE OTHER SERVERS
