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

Some corner cases fixes #462

Merged
merged 12 commits into from Jun 11, 2020
Merged

Some corner cases fixes #462

merged 12 commits into from Jun 11, 2020

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Jun 8, 2020

Main changes:

  • Replicate logs before appliedIndex(in follower) to followers should be considered successfully.
  • Provide an isolate thread pool to run replciator and rpc closures to prevent problems such as The leader encountered an invalid log problem #426
  • Prevent creating too many block timers when RPC fails( status is not ok).
  • Fixed replicate state field may be wrong in some situations.

@sofastack-bot sofastack-bot bot added size/M and removed size/S labels Jun 9, 2020
@sofastack-bot sofastack-bot bot added size/L and removed size/M labels Jun 9, 2020
@killme2008 killme2008 changed the title [WIP] Feature/minor changes Some corner cases fixes Jun 9, 2020
@killme2008
Copy link
Contributor Author

@fengjiachun @ujjboy @zongtanghu 有空帮忙看下

* Run closure with status in thread pool.
*/
public static Future<?> runClosureInThread(final Closure done, final Status status) {
if (done == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

格式,缩进问题。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

会统一改下

@zongtanghu
Copy link
Contributor

I have already put forward some code review suggestion. @killme2008

break;
case DESTROYED:
Utils.runInThread(() -> listener.onDestroyed(peer));
RpcUtils.runInThread(() -> listener.onDestroyed(peer));
Copy link
Contributor

Choose a reason for hiding this comment

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

格式有问题

break;
case ERROR:
Utils.runInThread(() -> listener.onError(peer, status));
RpcUtils.runInThread(() -> listener.onError(peer, status));
Copy link
Contributor

Choose a reason for hiding this comment

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

格式有问题

@@ -839,7 +840,7 @@ public static void waitForCaughtUp(final ThreadId id, final long maxMargin, fina
final Replicator r = (Replicator) id.lock();

if (r == null) {
Utils.runClosureInThread(done, new Status(RaftError.EINVAL, "No such replicator"));
RpcUtils.runClosureInThread(done, new Status(RaftError.EINVAL, "No such replicator"));
Copy link
Contributor

Choose a reason for hiding this comment

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

格式

@killme2008 killme2008 merged commit 0d8c96f into master Jun 11, 2020
@killme2008 killme2008 deleted the feature/minor-changes branch June 11, 2020 11:38
@fengjiachun fengjiachun mentioned this pull request Jun 19, 2020
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants