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

Issue 3070: Fix bug where checkAllLedgers gets stuck when read throttling is enabled #3214

Merged
merged 4 commits into from Sep 29, 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
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -425,15 +426,19 @@ public void checkLedger(final LedgerHandle lh,
if (curEntryId == lastEntry) {
final long entryToRead = curEntryId;

final CompletableFuture<Void> future = new CompletableFuture<>();
future.whenCompleteAsync((re, ex) -> {
checkFragments(fragments, cb, percentageOfLedgerFragmentToBeVerified);
});

final EntryExistsCallback eecb = new EntryExistsCallback(lh.getLedgerMetadata().getWriteQuorumSize(),
new GenericCallback<Boolean>() {
@Override
public void operationComplete(int rc, Boolean result) {
if (result) {
fragments.add(lastLedgerFragment);
}
checkFragments(fragments, cb,
percentageOfLedgerFragmentToBeVerified);
future.complete(null);
}
});

Expand Down
Expand Up @@ -517,7 +517,7 @@ public void testVerifyLedgerFragmentSkipsUnavailableBookie() throws Exception {

private Set<LedgerFragment> getUnderReplicatedFragments(LedgerHandle lh)
throws InterruptedException {
LedgerChecker checker = new LedgerChecker(bkc);
LedgerChecker checker = new LedgerChecker(bkc, 1);
CheckerCallback cb = new CheckerCallback();
checker.checkLedger(lh, cb);
Set<LedgerFragment> result = cb.waitAndGetResult();
Expand Down