-
Notifications
You must be signed in to change notification settings - Fork 529
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
Conversation
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
Outdated
Show resolved
Hide resolved
String snapshotPrefix = "snapshot"; | ||
for (BackendStore store : this.stores.values()) { | ||
store.writeSnapshot(snapshotPrefix); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer call store.writeSnapshot() through tx, and remove writeSnapshot() from AbstractBackendStoreProvider class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only memory backend will share store provider
hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
Outdated
Show resolved
Hide resolved
9eb4eb4
to
1c8460b
Compare
* The goal is to ensure that snapshots can be generated in hard link Change-Id: Idfa9387e46ac094a9c4cd69fee310b271127d889
Change-Id: I829ad9eaaf399b5fc1b8d25a90b2d1dd88c54894
Change-Id: I2b212decb8f0639354e032a09e9ca40988b001da
Change-Id: I67d88d798c6a16a66681296fbf29d73fb8bc356a
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
...raph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftBackendStoreProvider.java
Outdated
Show resolved
Hide resolved
...raph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftBackendStoreProvider.java
Outdated
Show resolved
Hide resolved
if (ids.size() == 1) { | ||
eventHub.call(Events.CACHE, action, type, ids.get(0)); | ||
} else { | ||
eventHub.call(Events.CACHE, action, type, ids.toArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems can delete if-branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't delete.
In CachedSchemaTransaction
if (Cache.ACTION_INVALID.equals(args[0])) {
event.checkArgs(String.class, HugeType.class, Id.class);
the 3rd param must be Id class.
In CachedGraphTransaction
if (Cache.ACTION_INVALID.equals(args[0])) {
event.checkArgs(String.class, HugeType.class, Object.class);
the 3rd param can be Id or Id[] class
@@ -48,7 +47,7 @@ | |||
|
|||
private static final Logger LOG = Log.logger(StoreSnapshotFile.class); | |||
|
|||
private static final String SNAPSHOT_DIR = "snapshot"; | |||
public static final String SNAPSHOT_DIR = "snapshot"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractBackendStoreProvider has used it.
hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Show resolved
Hide resolved
Change-Id: I845cc78b20b94eee6bd2aff43038dd22c1a7834a
1c8460b
to
372657d
Compare
Change-Id: Iebf742426aa6b696b2397ec90368a13d04c04b56
372657d
to
74d2a33
Compare
Codecov Report
@@ Coverage Diff @@
## master #1392 +/- ##
============================================
+ Coverage 62.04% 62.07% +0.02%
- Complexity 5838 5853 +15
============================================
Files 386 386
Lines 32192 32290 +98
Branches 4497 4506 +9
============================================
+ Hits 19975 20043 +68
- Misses 10186 10207 +21
- Partials 2031 2040 +9
Continue to review full report at Codecov.
|
...graph-core/src/main/java/com/baidu/hugegraph/backend/store/AbstractBackendStoreProvider.java
Outdated
Show resolved
Hide resolved
...graph-core/src/main/java/com/baidu/hugegraph/backend/store/AbstractBackendStoreProvider.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/StoreSnapshotFile.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStore.java
Outdated
Show resolved
Hide resolved
RocksDB rocksdb = sessions.createSnapshotRocksDB( | ||
snapshotPath.toString()); | ||
Path snapshotLinkPath = Paths.get(originDataPath + "_link"); | ||
createCheckpoint(rocksdb, snapshotLinkPath.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why createCheckpoint in resumeSnapshot()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when under raft mode, need reserve the origin snapshot dir, so need create hard link from snapshot
Change-Id: Idd420fd98be6668cf0db03178530eda3b9529ea5
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java
Outdated
Show resolved
Hide resolved
snapshotLinkDir, originDataDir); | ||
Path parentPath = snapshotPath.getParent(); | ||
if (Files.list(parentPath).count() == 0) { | ||
FileUtils.deleteDirectory(parentPath.toFile()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems still not use "move directory" if needed to delete snapshot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand.
Change-Id: I29adb7df352bbbba3fbd416831b11b0968818cb0
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/StoreSnapshotFile.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
699d03b
to
607076f
Compare
Change-Id: I0561be1a71322644465e745ded9ca1636bff078a
607076f
to
fcb5860
Compare
hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Show resolved
Hide resolved
@@ -614,15 +614,12 @@ protected Session session(HugeType tableType) { | |||
Set<String> uniqueParents = new HashSet<>(); | |||
// Every rocksdb instance should create an snapshot | |||
for (Map.Entry<String, RocksDBSessions> entry : this.dbs.entrySet()) { | |||
// Like: parent_path/rocksdb-data/m | |||
// parent_path/rocksdb-vertex/g | |||
// Like: parent_path/rocksdb-data/*, * maybe g,m,s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe => can be
Change-Id: I045690d244ad83e81e7ea7624ae9388f88521142
@@ -322,7 +330,8 @@ public void checkPropertiesAccess() { | |||
public void checkPropertyAccess(String key) { | |||
if (!callFromAcceptClassLoaders() && callFromGremlin() && | |||
!WHITE_SYSTEM_PROPERTYS.contains(key) && !callFromBackendHbase() && | |||
!callFromRaft() && !callFromSofaRpc()) { | |||
!callFromBackendRocksDB() && !callFromRaft() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe exist some dup part, but indeed need it.
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
...raph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java
Outdated
Show resolved
Hide resolved
hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStore.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java
Show resolved
Hide resolved
Change-Id: Ie7367816e681438dd4bc82287d1b810d781845aa
Change-Id: I70d1b3f70ac347f8e75a95d50654cf3f7f5536e8
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/StoreSnapshotFile.java
Outdated
Show resolved
Hide resolved
Change-Id: I88b39003107652f6ff8eae071e88dc888dd21959
Change-Id: Idfa9387e46ac094a9c4cd69fee310b271127d889