-
Notifications
You must be signed in to change notification settings - Fork 504
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
Write snapshot explicity after truncate backend #1275
Conversation
* 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 this time, the library has been cleared, |
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.
at the same time, the store has been cleared(truncate) but init-store has not been completed
BiConsumer<BackendStore, BytesBuffer> func = this.funcs.get(action); | ||
func.accept(store, buffer); | ||
if (type != StoreType.ALL) { | ||
BackendStore store = this.store(type); |
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.
set store=null if type == StoreType.ALL
Codecov Report
@@ Coverage Diff @@
## master #1275 +/- ##
============================================
- Coverage 69.19% 62.32% -6.88%
- Complexity 5401 5769 +368
============================================
Files 328 374 +46
Lines 26334 31382 +5048
Branches 3750 4401 +651
============================================
+ Hits 18222 19559 +1337
- Misses 6333 9841 +3508
- Partials 1779 1982 +203
Continue to review full report at Codecov.
|
Change-Id: Ifa11b36bebcd7e702327e79d51ec68fe1fd2eebb
Change-Id: I68a5314859e4a933ce3e7247797decfe712b854f
this.node().snapshot(future); | ||
future.waitFinished(); | ||
} catch (Throwable e) { | ||
throw new BackendException("Failed to genearet snapshot", e); |
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.
typo: genearet
a747f46
to
cefc525
Compare
StoreCommand command = new StoreCommand(StoreType.ALL, | ||
StoreAction.SNAPSHOT, null); | ||
StoreClosure closure = new StoreClosure(command); | ||
this.context.node().submitAndWait(command, closure); |
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.
set submitAndWait 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.
StoreCommandProcessor used it
@@ -123,8 +127,8 @@ private void updateCacheIfNeeded(BackendMutation mutation) { | |||
} | |||
|
|||
private void register(StoreAction action, | |||
BiConsumer<BackendStore, BytesBuffer> func) { | |||
this.funcs.put(action, func); | |||
BiConsumer<BackendStore, BytesBuffer> biFunc) { |
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.
keep func
@@ -3,14 +3,13 @@ | |||
|
|||
package com.baidu.hugegraph.backend.store.raft.rpc; | |||
|
|||
@SuppressWarnings("unused") |
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.
keep @SuppressWarnings("unused")
Change-Id: Idf3dad865c9baf181227ad063233bef2b548b2d8
Change-Id: Idf3dad865c9baf181227ad063233bef2b548b2d8
Change-Id: Ifa11b36bebcd7e702327e79d51ec68fe1fd2eebb