Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let snapshot saved disk same as rocksdb data path #1392

Merged
merged 13 commits into from
Apr 1, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ private String writeManifest(SnapshotWriter writer,
// Write all backend compressed snapshot file path to manifest
String jraftSnapshotPath = Paths.get(writerPath, SNAPSHOT_DIR)
.toString();
File snapshotManifest = new File(jraftSnapshotPath, MANIFEST);
File snapshotManifestFile = new File(jraftSnapshotPath, MANIFEST);
try {
FileUtils.writeLines(snapshotManifest, snapshotFiles);
FileUtils.writeLines(snapshotManifestFile, snapshotFiles);
} catch (IOException e) {
done.run(new Status(RaftError.EIO,
"Failed to write backend snapshot file path " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public class HugeSecurityManager extends SecurityManager {
ImmutableSet.of("execute")
);

private static final Map<String, Set<String>> ROCKSDB_SNAPSHOT = ImmutableMap.of(
Linary marked this conversation as resolved.
Show resolved Hide resolved
"com.baidu.hugegraph.backend.store.rocksdb.RocksDBStore",
ImmutableSet.of("createSnapshot", "resumeSnapshot")
);

private static final Set<String> HBASE_CLASSES = ImmutableSet.of(
// Fixed #758
"com.baidu.hugegraph.backend.store.hbase.HbaseStore",
Expand All @@ -103,10 +108,6 @@ public class HugeSecurityManager extends SecurityManager {
"com.baidu.hugegraph.backend.store.hbase.HbaseSessions$RowIterator"
);

private static final Set<String> ROCKSDB_CLASSES = ImmutableSet.of(
"com.baidu.hugegraph.backend.store.rocksdb.RocksDBStore"
);

private static final Set<String> RAFT_CLASSES = ImmutableSet.of(
"com.baidu.hugegraph.backend.store.raft.RaftNode",
"com.baidu.hugegraph.backend.store.raft.StoreStateMachine",
Expand Down Expand Up @@ -451,7 +452,7 @@ private static boolean callFromBackendHbase() {
}

private static boolean callFromBackendRocksDB() {
return callFromWorkerWithClass(ROCKSDB_CLASSES);
return callFromMethods(ROCKSDB_SNAPSHOT);
}

private static boolean callFromRaft() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

package com.baidu.hugegraph.backend.store.rocksdb;

import java.nio.file.Path;
import java.util.List;
import java.util.Set;

import org.apache.commons.lang3.tuple.Pair;
import org.rocksdb.RocksDBException;

import com.alipay.sofa.jraft.storage.snapshot.remote.Session;
import com.baidu.hugegraph.backend.store.BackendEntry.BackendColumnIterator;
import com.baidu.hugegraph.backend.store.BackendSession.AbstractBackendSession;
import com.baidu.hugegraph.backend.store.BackendSessionPool;
Expand All @@ -52,10 +52,10 @@ public abstract RocksDBSessions copy(HugeConfig config,

public abstract void resumeSnapshot(String snapshotPath);

public abstract Path buildSnapshotPath(Path originDataPath,
String snapshotPrefix,
boolean deleteSnapshot)
throws RocksDBException;
public abstract String buildSnapshotPath(String snapshotPrefix);

public abstract String hardLinkSnapshot(String snapshotPath)
throws RocksDBException;

public abstract void reloadRocksDB() throws RocksDBException;

Expand Down
Loading