use of com.orientechnologies.orient.server.distributed.ODistributedDatabase in project orientdb by orientechnologies.
the class OUnreachableServerLocalTask method execute.
@Override
public Object execute(final ODistributedRequestId msgId, final OServer iServer, ODistributedServerManager iManager, final ODatabaseDocumentInternal database) throws Exception {
ODistributedServerLog.debug(this, iManager.getLocalNodeName(), getNodeSource(), DIRECTION.IN, "Freeing all the resources owned by the unreachable server '%s'...", unreachableServer);
final ODistributedDatabase dDatabase = iManager.getMessageService().getDatabase(database.getName());
dDatabase.unlockResourcesOfServer(database, unreachableServer);
return Boolean.TRUE;
}
use of com.orientechnologies.orient.server.distributed.ODistributedDatabase in project orientdb by orientechnologies.
the class OAbstractSyncDatabaseTask method checkIfCurrentDatabaseIsNotOlder.
protected ODistributedDatabase checkIfCurrentDatabaseIsNotOlder(final ODistributedServerManager iManager, final String databaseName, final OLogSequenceNumber startLSN) {
final ODistributedDatabase dDatabase = iManager.getMessageService().getDatabase(databaseName);
if (startLSN != null) {
final OLogSequenceNumber currentLSN = dDatabase.getSyncConfiguration().getLastLSN(iManager.getLocalNodeName());
if (startLSN.equals(currentLSN))
// REQUESTING LSN IS THE LAST ONE, FINE
return dDatabase;
}
// CHECK THE DATE OF LAST OPERATION
if (dDatabase.getSyncConfiguration().getLastOperationTimestamp() < lastOperationTimestamp) {
final OLogSequenceNumber currentLSN = dDatabase.getSyncConfiguration().getLastLSN(getNodeSource());
if (currentLSN == null)
return dDatabase;
if (lastLSN != null) {
// USE THE LSN TO COMPARE DATABASES
if (lastLSN.equals(currentLSN))
return dDatabase;
}
databaseIsOld(iManager, databaseName, dDatabase);
}
return dDatabase;
}
Aggregations