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

Fixed locking of PendingAddOp #3806

Merged
merged 3 commits into from
Feb 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,8 @@ void handleBookieFailure(final Map<Integer, BookieId> failedBookies) {
LOG.debug("Ensemble change is disabled. Retry sending to failed bookies {} for ledger {}.",
failedBookies, ledgerId);
}
unsetSuccessAndSendWriteRequest(getCurrentEnsemble(), failedBookies.keySet());
executeOrdered(() ->
unsetSuccessAndSendWriteRequest(getCurrentEnsemble(), failedBookies.keySet()));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ synchronized void unsetSuccessAndSendWriteRequest(List<BookieId> ensemble, int b
/**
* Initiate the add operation.
*/
public void initiate() {
public synchronized void initiate() {
hasRun = true;
if (callbackTriggered) {
// this should only be true if the request was failed due
Expand Down Expand Up @@ -452,7 +452,7 @@ private PendingAddOp(Handle<PendingAddOp> recyclerHandle) {
}


private void maybeRecycle() {
private synchronized void maybeRecycle() {
/**
* We have opportunity to recycle two objects here.
* PendingAddOp#toSend and LedgerHandle#pendingAddOp
Expand Down Expand Up @@ -482,7 +482,7 @@ private void maybeRecycle() {
}
}

public void recyclePendAddOpObject() {
public synchronized void recyclePendAddOpObject() {
entryId = LedgerHandle.INVALID_ENTRY_ID;
currentLedgerLength = -1;
if (payload != null) {
Expand Down