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

fix clear api create snapshot for all backend(should rocksdb only) #1532

Merged
merged 2 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,17 +362,6 @@ public void truncateBackend() {
this.storeProvider.initSystemInfo(this);
this.serverStarted(this.serverInfoManager().selfServerId(),
this.serverInfoManager().selfServerRole());
/*
* Take the initiative to generate a snapshot, it can avoid this
* situation: when the server restart need to read the database
* (such as checkBackendVersionInfo), it happens that raft replays
* the truncate log, at the same time, the store has been cleared
* (truncate) but init-store has not been completed, which will
* cause reading errors.
* When restarting, load the snapshot first and then read backend,
* will not encounter such an intermediate state.
*/
this.storeProvider.createSnapshot();
} finally {
LockUtil.unlock(this.name, LockUtil.GRAPH_LOCK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ public void initSystemInfo(HugeGraph graph) {

this.notifyAndWaitEvent(Events.STORE_INITED);
LOG.debug("Graph '{}' system info has been initialized", this.graph());
/*
* Take the initiative to generate a snapshot, it can avoid this
* situation: when the server restart need to read the database
* (such as checkBackendVersionInfo), it happens that raft replays
* the truncate log, at the same time, the store has been cleared
* (truncate) but init-store has not been completed, which will
* cause reading errors.
* When restarting, load the snapshot first and then read backend,
* will not encounter such an intermediate state.
*/
this.createSnapshot();
LOG.debug("Graph '{}' snapshot has been created", this.graph());
}

@Override
Expand Down