GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — [fix][ml] Complete a cursor delete that finds the cursor already being deleted by merlimat · Pull Request #27563 · apache/pulsar Conversation
Contributor
Problem
ManagedCursorImpl.State beforeChangingState = cursor.changeStateToDeletingIfNotDeleted(); if (beforeChangingState.isDeletingOrDeleted()) { log.warn().attr("cursorName", consumerName).log("Cursor is already being deleted or has been deleted"); return; } A cursor stays in the managed ledger's list until the removal of its metadata completes, so another delete of the same cursor in the meantime takes this branch:
Since #27551, the functions workers hit this on every delete of a function with instances on two workers. Every worker that ran instances of a deleted function deletes its subscriptions, and two of them do it at the same moment: the leader when it applies the delete of the function's last instance, and the other worker when it reads that delete. The other worker's assignment tailer then waits 60 s in (or ExampleA local run of Locally, each test that follows the delete of a function with parallelism 2 then takes ~62 s instead of ~2 s. In CI, the next test waits only 10 s for its function's instance, so it fails. ChangeA delete that finds the cursor being deleted now completes with the delete in progress, the way an open of a cursor that is being opened completes with that open ( if (beforeChangingState.isDeletingOrDeleted()) { // A cursor stays listed until its delete in progress completes, such as the delete of a subscription that // two clients unsubscribe at the same time: complete with that delete log.debug().attr("cursorName", consumerName).log("Cursor is already being deleted"); deletingCursors.get(consumerName).whenComplete((__, ex) -> { if (ex == null) { callback.deleteCursorComplete(ctx); } else { callback.deleteCursorFailed(ManagedLedgerException .getManagedLedgerException(FutureUtil.unwrapCompletionException(ex)), ctx); } }); return; } CompletableFuture<Void> deleteFuture = new CompletableFuture<>(); deletingCursors.put(consumerName, deleteFuture); // once the metadata removal completes: remove the cursor from the list, then the entry // (deletingCursors.remove(consumerName, deleteFuture)), and complete the callback and deleteFuture Only Testing
With this change, the leader's and the other worker's overlapping deletes of the first function's subscription both returned 204 within 14 ms.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…g deleted ManagedLedgerImpl.asyncDeleteCursor returned without completing its callback when the cursor was already being deleted (since apache#24569). A second delete of a subscription that overlaps the first, such as two admin calls deleting the same subscription, never completed: the REST request hung until the client's request timeout (60 s for the admin client). A managed ledger delete that overlaps a subscription delete hung the same way. Since apache#27551, every functions worker that ran instances of a deleted function deletes its subscriptions, and two workers do it at the same moment: the leader when it applies the delete of the last instance, and another worker when it reads that delete. The second worker's assignment tailer then waited 60 s in the admin call, holding the FunctionRuntimeManager lock, so the next function's instances were not started in time and the functions integration tests retried in every CI run. A delete that finds the cursor being deleted now completes with the delete in progress: it succeeds or fails with it. The deletes in progress are tracked by cursor name, the way asyncOpenCursor tracks the opens in progress.
codelipenghui
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
…g deleted (apache#27563) (cherry picked from commit b0fac7b)
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
…g deleted (apache#27563) (cherry picked from commit b0fac7b)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |