use of org.neo4j.kernel.ha.store.UnableToCopyStoreFromOldMasterException in project neo4j by neo4j.
the class SwitchToSlave method copyStoreFromMasterIfNeeded.
private void copyStoreFromMasterIfNeeded(URI masterUri, URI me, CancellationRequest cancellationRequest) throws Throwable {
if (!isStorePresent(pageCache, storeDir)) {
boolean success = false;
monitor.storeCopyStarted();
LifeSupport copyLife = new LifeSupport();
try {
MasterClient masterClient = newMasterClient(masterUri, me, null, copyLife);
copyLife.start();
boolean masterIsOld = MasterClient.CURRENT.compareTo(masterClient.getProtocolVersion()) > 0;
if (masterIsOld) {
throw new UnableToCopyStoreFromOldMasterException(MasterClient.CURRENT.getApplicationProtocol(), masterClient.getProtocolVersion().getApplicationProtocol());
} else {
copyStoreFromMaster(masterClient, cancellationRequest, MoveAfterCopy.moveReplaceExisting());
success = true;
}
} finally {
monitor.storeCopyCompleted(success);
copyLife.shutdown();
}
}
}
use of org.neo4j.kernel.ha.store.UnableToCopyStoreFromOldMasterException in project neo4j by neo4j.
the class SwitchToSlaveCopyThenBranch method copyStore.
private void copyStore(URI masterUri, URI me, CancellationRequest cancellationRequest, MoveAfterCopy moveAfterCopy) throws Throwable {
boolean success = false;
monitor.storeCopyStarted();
LifeSupport copyLife = new LifeSupport();
try {
MasterClient masterClient = newMasterClient(masterUri, me, null, copyLife);
copyLife.start();
boolean masterIsOld = MasterClient.CURRENT.compareTo(masterClient.getProtocolVersion()) > 0;
if (masterIsOld) {
throw new UnableToCopyStoreFromOldMasterException(MasterClient.CURRENT.getApplicationProtocol(), masterClient.getProtocolVersion().getApplicationProtocol());
} else {
copyStoreFromMaster(masterClient, cancellationRequest, moveAfterCopy);
success = true;
}
} finally {
monitor.storeCopyCompleted(success);
copyLife.shutdown();
}
}
Aggregations