-
Notifications
You must be signed in to change notification settings - Fork 590
Let snapshot saved disk same as rocksdb data path #1392
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
Changes from all commits
10b1bfe
de8b72b
bbb6faf
bce32ec
5adb2c6
74d2a33
084bca2
060f190
fcb5860
9ffda82
74c0764
6d06009
319ae66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
|
|
||
| import com.baidu.hugegraph.HugeGraph; | ||
| import com.baidu.hugegraph.backend.BackendException; | ||
| import com.baidu.hugegraph.backend.store.raft.StoreSnapshotFile; | ||
| import com.baidu.hugegraph.event.EventHub; | ||
| import com.baidu.hugegraph.event.EventListener; | ||
| import com.baidu.hugegraph.util.E; | ||
|
|
@@ -151,13 +152,19 @@ public void initSystemInfo(HugeGraph graph) { | |
| } | ||
|
|
||
| @Override | ||
| public void writeSnapshot() { | ||
| // TODO: to be implemented | ||
| public void createSnapshot() { | ||
| String snapshotPrefix = StoreSnapshotFile.SNAPSHOT_DIR; | ||
| for (BackendStore store : this.stores.values()) { | ||
| store.createSnapshot(snapshotPrefix); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer call store.writeSnapshot() through tx, and remove writeSnapshot() from AbstractBackendStoreProvider class
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only memory backend will share store provider |
||
| } | ||
|
|
||
| @Override | ||
| public void readSnapshot() { | ||
| // TODO: to be implemented | ||
| public void resumeSnapshot() { | ||
| String snapshotPrefix = StoreSnapshotFile.SNAPSHOT_DIR; | ||
| for (BackendStore store : this.stores.values()) { | ||
| store.resumeSnapshot(snapshotPrefix, true); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| import java.io.File; | ||
| import java.io.IOException; | ||
| import java.nio.file.Paths; | ||
| import java.util.List; | ||
| import java.util.concurrent.BlockingQueue; | ||
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.LinkedBlockingQueue; | ||
|
|
@@ -43,6 +44,7 @@ | |
| import com.baidu.hugegraph.HugeException; | ||
| import com.baidu.hugegraph.HugeGraphParams; | ||
| import com.baidu.hugegraph.backend.cache.Cache; | ||
| import com.baidu.hugegraph.backend.id.Id; | ||
| import com.baidu.hugegraph.backend.store.BackendStore; | ||
| import com.baidu.hugegraph.backend.store.raft.rpc.ListPeersProcessor; | ||
| import com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType; | ||
|
|
@@ -259,7 +261,7 @@ public void clearCache() { | |
| this.notifyCache(Cache.ACTION_CLEAR, HugeType.VERTEX, null); | ||
| } | ||
|
|
||
| protected void notifyCache(String action, HugeType type, Object id) { | ||
| protected void notifyCache(String action, HugeType type, List<Id> ids) { | ||
| EventHub eventHub; | ||
| if (type.isGraph()) { | ||
| eventHub = this.params.graphEventHub(); | ||
|
|
@@ -270,7 +272,15 @@ protected void notifyCache(String action, HugeType type, Object id) { | |
| } | ||
| try { | ||
| // How to avoid update cache from server info | ||
| eventHub.notify(Events.CACHE, action, type, id); | ||
| if (ids == null) { | ||
| eventHub.call(Events.CACHE, action, type); | ||
| } else { | ||
| if (ids.size() == 1) { | ||
| eventHub.call(Events.CACHE, action, type, ids.get(0)); | ||
| } else { | ||
| eventHub.call(Events.CACHE, action, type, ids.toArray()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems can delete if-branch
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't delete. In CachedSchemaTransaction the 3rd param must be Id class. In CachedGraphTransaction the 3rd param can be Id or Id[] class |
||
| } | ||
| } | ||
| } catch (RejectedExecutionException e) { | ||
| LOG.warn("Can't update cache due to EventHub is too busy"); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.