Skip to content

Commit

Permalink
merge: #10656
Browse files Browse the repository at this point in the history
10656: [Backport stable/8.1] fix(raft): do not handle response if role is already closed r=deepthidevaki a=backport-action

# Description
Backport of #10640 to `stable/8.1`.

closes #10545

Co-authored-by: Deepthi Devaki Akkoorath <deepthidevaki@gmail.com>
  • Loading branch information
zeebe-bors-camunda[bot] and deepthidevaki authored Oct 10, 2022
2 parents bdfd16b + 3199645 commit 59bfdab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,16 @@ private void sendAppendRequest(final RaftMemberContext member, final AppendReque
.append(member.getMember().memberId(), request)
.whenCompleteAsync(
(response, error) -> {
// Complete the append to the member.
final long appendLatency = System.currentTimeMillis() - timestamp;
metrics.appendComplete(appendLatency, member.getMember().memberId().id());
if (!request.entries().isEmpty()) {
member.completeAppend(appendLatency);
} else {
member.completeAppend();
}

if (open) {
// Complete the append to the member.
final long appendLatency = System.currentTimeMillis() - timestamp;
metrics.appendComplete(appendLatency, member.getMember().memberId().id());
if (!request.entries().isEmpty()) {
member.completeAppend(appendLatency);
} else {
member.completeAppend();
}

if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleAppendResponse(member, request, response, timestamp);
Expand Down Expand Up @@ -300,10 +300,10 @@ private void sendConfigureRequest(
.configure(member.getMember().memberId(), request)
.whenCompleteAsync(
(response, error) -> {
// Complete the configure to the member.
member.completeConfigure();

if (open) {
// Complete the configure to the member.
member.completeConfigure();

if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleConfigureResponse(member, request, response, timestamp);
Expand Down Expand Up @@ -413,10 +413,10 @@ private void sendInstallRequest(final RaftMemberContext member, final InstallReq
.install(member.getMember().memberId(), request)
.whenCompleteAsync(
(response, error) -> {
// Complete the install to the member.
member.completeInstall();

if (open) {
// Complete the install to the member.
member.completeInstall();

if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleInstallResponse(member, request, response, timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,13 @@ private void assertNoGapsInLog(final MemberId memberId) {
}

public void assertAllMembersAreReady() {
raftServers.values().forEach(raft -> assertThat(raft.getState()).isEqualTo(State.READY));
raftServers
.values()
.forEach(
raft ->
assertThat(raft.getState())
.describedAs("Raft %s must be ready".formatted(raft.getName()))
.isEqualTo(State.READY));
}

public void assertNoJournalAppendErrors() {
Expand Down

0 comments on commit 59bfdab

Please sign in to comment.