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

(bugfix) fix rheakv state machine bug #137

Merged
merged 18 commits into from
May 10, 2019
Merged

Conversation

fengjiachun
Copy link
Contributor

Motivation:

If rheakv caught a critical error, should halt the state machine to avoid they inconsistencies between different nodes.

Modification:

As above describe.

Result:

Fixes #136

@fengjiachun
Copy link
Contributor Author

Need to add some unit test

@killme2008
Copy link
Contributor

存在冲突

@fengjiachun
Copy link
Contributor Author

#154 冲突了,我先解决下

@@ -84,8 +84,7 @@ public Status rangeSplit(final long regionId, final long newRegionId, final Stri
if (response.isSuccess()) {
return Status.OK();
}
return new Status(-1, "fail to range split on region %d, error: %s", regionId, String.valueOf(response
.getError()));
return new Status(-1, "Fail to range split on region %d, error: %s", regionId, String.valueOf(response));
Copy link
Contributor

Choose a reason for hiding this comment

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

不需要调用 String.valueOf 吧? 格式化会 %s 自动调用 toString

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

assert first != null;
batchApplyAndRecycle(first.getOpByte(), kvStates);
} catch (final Throwable t) {
it.setErrorAndRollback(index - applied, new Status(RaftError.EIO, "StateMachine meet critical error: %s.",
Copy link
Contributor

Choose a reason for hiding this comment

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

RaftError 选择 ESTATEMACHINE 更合适,并且这里建议加下日志,打印出堆栈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@killme2008 killme2008 merged commit ed4c472 into master May 10, 2019
@killme2008 killme2008 deleted the bugfix/halt_on_exception branch May 10, 2019 09:15
@fengjiachun fengjiachun mentioned this pull request Aug 15, 2019
4 tasks
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.

RheaKV状态机apply时多节点不一致漏洞
2 participants