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 single node with error response when batch append #75

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix single node with error response when batch append
  • Loading branch information
TerrellChen committed Nov 8, 2020
commit 2d6d5d99291aa8ff56f6ffbf8d9c218643d3a703
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
public class BatchAppendFuture<T> extends AppendFuture<T> {
private long[] positions;

public BatchAppendFuture() {

}

public BatchAppendFuture(long timeOutMs) {
super(timeOutMs);
}
Expand All @@ -30,4 +34,11 @@ public long[] getPositions() {
public void setPositions(long[] positions) {
this.positions = positions;
}

public static <T> BatchAppendFuture<T> newCompletedFuture(long pos, T value) {
BatchAppendFuture<T> future = new BatchAppendFuture<T>();
future.setPos(pos);
future.complete(value);
return future;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ public CompletableFuture<AppendEntryResponse> waitAck(DLedgerEntry entry, boolea
response.setIndex(entry.getIndex());
response.setTerm(entry.getTerm());
response.setPos(entry.getPos());
if (isBatchWait) {
return BatchAppendFuture.newCompletedFuture(entry.getPos(), response);
}
return AppendFuture.newCompletedFuture(entry.getPos(), response);
} else {
checkTermForPendingMap(entry.getTerm(), "waitAck");
Expand Down