Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Fix prepare/request timers #142

Merged
merged 5 commits into from
Dec 18, 2019

Conversation

sergefdrv
Copy link
Contributor

@sergefdrv sergefdrv commented Dec 13, 2019

This pull request fixes some issues with prepare timer that were missed when reviewing #127.

Depending on how we decide to solve the issue noted in "WIP: core: Check request ID before stopping request/prepare timer", we might decide to do the opposite of what "RFC: core: Pass client ID to prepareTimerStarter" suggests.

core/commit.go Outdated

// FIXME: Only stop the request timer if the request
// identifier it was started for matches the one of
// the request accepted for execution.
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this, thank you for spotting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a possibility that a timer is left without stopping forever? I am not sure how a timer is stopped certainly at some point if stopReqTimer() doesn't stop the timer at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since correct clients only send their requests sequentially, a replica need to maintain one prepare and one request timer per client. If a newer request is received, the replica can assume the former request was completed and the client timers should be reused. In other words, replicas only maintain timers for the most recent request of each client.

@sergefdrv sergefdrv mentioned this pull request Dec 16, 2019
Similar to prepareTimerStarter, change definition of
prepareTimerStopper to receive a Request message as parameter.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
@sergefdrv sergefdrv changed the title Fix prepare timer Fix prepare/request timers Dec 17, 2019
Sergey Fedorov added 4 commits December 17, 2019 22:23
The purpose of the prepare timer is to trigger relaying of the Request
message to the primary. So there is no point in starting prepare timer
when the Request is handled by the primary replica itself.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
Similar to prepareTimerStarter/prepareTimerStopper, pass Request
message to requestTimerStarter/requestTimerStopper. This makes the
both timers' abstractions similar to each other. As opposed to passing
just client identifier, this will allow to check request identifier
without further changing those definitions.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
It may happen that a replica receives a newer client request before it
has received Prepare for a former request from that client or accepts
such request for execution. In that case, request and prepare timers
started for the newer request should not be stopped.

Tag request/prepare timers with a request identifier when started and
stop the timer only when the same request identifier supplied.

Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
@sergefdrv
Copy link
Contributor Author

Summary of changes:

  • Dropped commit "RFC: core: Pass client ID to prepareTimerStarter" and passing Request message to all request/perpare timer abstractions
  • Added check for request identifier in timers maintained in client state
  • Added unit tests for prepare timer abstractions

@sergefdrv sergefdrv marked this pull request as ready for review December 17, 2019 21:33
@sergefdrv sergefdrv requested a review from nhoriguchi December 17, 2019 21:33
Copy link
Contributor

@nhoriguchi nhoriguchi left a comment

Choose a reason for hiding this comment

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

Thank you for fixing and improving test coverage.

Copy link
Contributor

@ynamiki ynamiki left a comment

Choose a reason for hiding this comment

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

Thanks for explanation.

@ynamiki ynamiki merged commit 7a581d1 into hyperledger-labs:master Dec 18, 2019
@sergefdrv sergefdrv deleted the fix-prepare-timer branch December 18, 2019 14:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants