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

fix(raft): do not handle response if role is already closed #10640

Merged
merged 2 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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