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

Write snapshot explicity after truncate backend #1275

Merged
merged 4 commits into from
Nov 23, 2020
Merged

Conversation

Linary
Copy link
Contributor

@Linary Linary commented Nov 20, 2020

Change-Id: Ifa11b36bebcd7e702327e79d51ec68fe1fd2eebb

* 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,
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link

codecov bot commented Nov 20, 2020

Codecov Report

Merging #1275 (67d9a45) into master (b4c767b) will decrease coverage by 6.87%.
The diff coverage is 42.66%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ Complexity Δ
...api/src/main/java/com/baidu/hugegraph/api/API.java 69.04% <ø> (+3.49%) 0.00 <0.00> (ø)
...n/java/com/baidu/hugegraph/api/auth/AccessAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...n/java/com/baidu/hugegraph/api/auth/BelongAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...in/java/com/baidu/hugegraph/api/auth/GroupAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...n/java/com/baidu/hugegraph/api/auth/TargetAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ain/java/com/baidu/hugegraph/api/auth/UserAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...com/baidu/hugegraph/api/gremlin/GremlinClient.java 90.90% <ø> (ø) 0.00 <0.00> (ø)
.../java/com/baidu/hugegraph/api/job/ComputerAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ain/java/com/baidu/hugegraph/api/raft/RaftAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...a/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java 59.72% <ø> (+2.77%) 0.00 <0.00> (ø)
... and 317 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67cfb6f...67d9a45. Read the comment docs.

Change-Id: Ifa11b36bebcd7e702327e79d51ec68fe1fd2eebb
Change-Id: I68a5314859e4a933ce3e7247797decfe712b854f
this.node().snapshot(future);
future.waitFinished();
} catch (Throwable e) {
throw new BackendException("Failed to genearet snapshot", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: genearet

Change-Id: I43fde591d69274dfafe7f7e41792cdf7cd8d2715
javeme
javeme previously approved these changes Nov 20, 2020
StoreCommand command = new StoreCommand(StoreType.ALL,
StoreAction.SNAPSHOT, null);
StoreClosure closure = new StoreClosure(command);
this.context.node().submitAndWait(command, closure);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set submitAndWait protected

Copy link
Contributor Author

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) {
Copy link
Contributor

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")
Copy link
Contributor

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
@Linary Linary merged commit 9279bd7 into master Nov 23, 2020
@Linary Linary deleted the snapshot-after-truncate branch November 23, 2020 06:02
tmljob pushed a commit to tmljob/hugegraph that referenced this pull request Dec 10, 2020
Change-Id: Idf3dad865c9baf181227ad063233bef2b548b2d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants