Search in sources :

Example 11 with StorageException

use of com.alipay.sofa.jraft.rhea.errors.StorageException in project sofa-jraft by sofastack.

the class MemoryKVStoreSnapshotFile method doSnapshotLoad.

@Override
void doSnapshotLoad(final String snapshotPath, final LocalFileMeta meta, final Region region) throws Exception {
    final File file = new File(snapshotPath);
    if (!file.exists()) {
        throw new StorageException("Snapshot file [" + snapshotPath + "] not exists");
    }
    final Region snapshotRegion = readMetadata(meta, Region.class);
    if (!RegionHelper.isSameRange(region, snapshotRegion)) {
        throw new StorageException("Invalid snapshot region: " + snapshotRegion + ", current region is: " + region);
    }
    this.kvStore.doSnapshotLoad(this, snapshotPath);
}
Also used : Region(com.alipay.sofa.jraft.rhea.metadata.Region) File(java.io.File) StorageException(com.alipay.sofa.jraft.rhea.errors.StorageException)

Aggregations

StorageException (com.alipay.sofa.jraft.rhea.errors.StorageException)11 DistributedLock (com.alipay.sofa.jraft.rhea.util.concurrent.DistributedLock)9 Timer (com.codahale.metrics.Timer)9 Lock (java.util.concurrent.locks.Lock)9 ReadWriteLock (java.util.concurrent.locks.ReadWriteLock)9 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)9 RocksDBException (org.rocksdb.RocksDBException)9 File (java.io.File)8 IOException (java.io.IOException)4 BackupableDBOptions (org.rocksdb.BackupableDBOptions)3 Region (com.alipay.sofa.jraft.rhea.metadata.Region)2 EnumMap (java.util.EnumMap)2 Map (java.util.Map)2 BackupEngine (org.rocksdb.BackupEngine)2 ColumnFamilyHandle (org.rocksdb.ColumnFamilyHandle)2 IngestExternalFileOptions (org.rocksdb.IngestExternalFileOptions)2 RestoreOptions (org.rocksdb.RestoreOptions)2 RocksDBOptions (com.alipay.sofa.jraft.rhea.options.RocksDBOptions)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 BackupInfo (org.rocksdb.BackupInfo)1