use of org.neo4j.kernel.ha.store.ForeignStoreException in project neo4j by neo4j.
the class SwitchToSlaveCopyThenBranch method checkDataConsistency.
void checkDataConsistency(MasterClient masterClient, TransactionIdStore txIdStore, StoreId storeId, URI masterUri, URI me, CancellationRequest cancellationRequest) throws Throwable {
try {
userLog.info("Checking store consistency with master");
checkMyStoreIdAndMastersStoreId(storeId, masterUri, resolver);
checkDataConsistencyWithMaster(masterUri, masterClient, storeId, txIdStore);
userLog.info("Store is consistent");
} catch (StoreUnableToParticipateInClusterException upe) {
userLog.info("The store is inconsistent. Will treat it as branched and fetch a new one from the master");
msgLog.warn("Current store is unable to participate in the cluster; fetching new store from master", upe);
try {
stopServicesAndHandleBranchedStore(config.get(HaSettings.branched_data_policy), masterUri, me, cancellationRequest);
} catch (IOException e) {
msgLog.warn("Failed while trying to handle branched data", e);
}
throw upe;
} catch (MismatchingStoreIdException e) {
userLog.info("The store does not represent the same database as master. Will remove and fetch a new one from " + "master");
if (txIdStore.getLastCommittedTransactionId() == BASE_TX_ID) {
msgLog.warn("Found and deleting empty store with mismatching store id", e);
stopServicesAndHandleBranchedStore(BranchedDataPolicy.keep_none, masterUri, me, cancellationRequest);
throw e;
}
msgLog.error("Store cannot participate in cluster due to mismatching store IDs", e);
throw new ForeignStoreException(e.getExpected(), e.getEncountered());
}
}
use of org.neo4j.kernel.ha.store.ForeignStoreException in project neo4j by neo4j.
the class SwitchToSlaveBranchThenCopy method checkDataConsistency.
void checkDataConsistency(MasterClient masterClient, TransactionIdStore txIdStore, StoreId storeId, URI masterUri, URI me, CancellationRequest cancellationRequest) throws Throwable {
try {
userLog.info("Checking store consistency with master");
checkMyStoreIdAndMastersStoreId(storeId, masterUri, resolver);
checkDataConsistencyWithMaster(masterUri, masterClient, storeId, txIdStore);
userLog.info("Store is consistent");
} catch (StoreUnableToParticipateInClusterException upe) {
userLog.info("The store is inconsistent. Will treat it as branched and fetch a new one from the master");
msgLog.warn("Current store is unable to participate in the cluster; fetching new store from master", upe);
try {
stopServicesAndHandleBranchedStore(config.get(HaSettings.branched_data_policy));
} catch (IOException e) {
msgLog.warn("Failed while trying to handle branched data", e);
}
throw upe;
} catch (MismatchingStoreIdException e) {
userLog.info("The store does not represent the same database as master. Will remove and fetch a new one from " + "master");
if (txIdStore.getLastCommittedTransactionId() == BASE_TX_ID) {
msgLog.warn("Found and deleting empty store with mismatching store id", e);
stopServicesAndHandleBranchedStore(BranchedDataPolicy.keep_none);
throw e;
}
msgLog.error("Store cannot participate in cluster due to mismatching store IDs", e);
throw new ForeignStoreException(e.getExpected(), e.getEncountered());
}
}
Aggregations