Search in sources :

Example 1 with StoreUnableToParticipateInClusterException

use of org.neo4j.kernel.ha.StoreUnableToParticipateInClusterException 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());
    }
}
Also used : ForeignStoreException(org.neo4j.kernel.ha.store.ForeignStoreException) StoreUnableToParticipateInClusterException(org.neo4j.kernel.ha.StoreUnableToParticipateInClusterException) MismatchingStoreIdException(org.neo4j.kernel.impl.store.MismatchingStoreIdException) IOException(java.io.IOException)

Example 2 with StoreUnableToParticipateInClusterException

use of org.neo4j.kernel.ha.StoreUnableToParticipateInClusterException 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());
    }
}
Also used : ForeignStoreException(org.neo4j.kernel.ha.store.ForeignStoreException) StoreUnableToParticipateInClusterException(org.neo4j.kernel.ha.StoreUnableToParticipateInClusterException) MismatchingStoreIdException(org.neo4j.kernel.impl.store.MismatchingStoreIdException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 StoreUnableToParticipateInClusterException (org.neo4j.kernel.ha.StoreUnableToParticipateInClusterException)2 ForeignStoreException (org.neo4j.kernel.ha.store.ForeignStoreException)2 MismatchingStoreIdException (org.neo4j.kernel.impl.store.MismatchingStoreIdException)2