Search in sources :

Example 1 with NotCurrentStoreVersionException

use of org.neo4j.kernel.impl.store.NotCurrentStoreVersionException in project neo4j by neo4j.

the class IndexProviderStore method compareExpectedVersionWithStoreVersion.

private boolean compareExpectedVersionWithStoreVersion(long expectedVersion, boolean allowUpgrade, Long readIndexVersion) {
    boolean versionDiffers = readIndexVersion == null || readIndexVersion.longValue() != expectedVersion;
    if (versionDiffers) {
        // with an older version than the store is.
        if (readIndexVersion != null && expectedVersion < readIndexVersion.longValue()) {
            String expected = versionLongToString(expectedVersion);
            String readVersion = versionLongToString(readIndexVersion.longValue());
            throw new NotCurrentStoreVersionException(expected, readVersion, "Your index has been upgraded to " + readVersion + " and cannot run with an older version " + expected, false);
        } else if (!allowUpgrade) {
            // We try to run with a newer version than the store is but isn't allowed to upgrade.
            throw new UpgradeNotAllowedByConfigurationException();
        }
    }
    return versionDiffers;
}
Also used : UpgradeNotAllowedByConfigurationException(org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException) NotCurrentStoreVersionException(org.neo4j.kernel.impl.store.NotCurrentStoreVersionException) MetaDataStore.versionLongToString(org.neo4j.kernel.impl.store.MetaDataStore.versionLongToString)

Aggregations

MetaDataStore.versionLongToString (org.neo4j.kernel.impl.store.MetaDataStore.versionLongToString)1 NotCurrentStoreVersionException (org.neo4j.kernel.impl.store.NotCurrentStoreVersionException)1 UpgradeNotAllowedByConfigurationException (org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException)1