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][broker] Register the extensible load manager's unload and split waits before publishing the event by merlimat · Pull Request #27550 · apache/pulsar Conversation
Contributor
MotivationAn admin unload or transfer with the extensible load manager can wait out The source broker publishes // ExtensibleLoadManagerImpl.unloadAsync() CompletableFuture<Void> future = serviceUnitStateChannel.publishUnloadEventAsync(unload); return unloadManager.waitAsync(future, unload.serviceUnit(), unloadDecision, timeout, timeoutUnit) ... // UnloadManager.waitAsync() return eventPubFuture.thenCompose(__ -> { CompletableFuture<Void> future = inFlightUnloadRequest.computeIfAbsent(bundle, ...); When this broker's channel handles the unload's last state ( The publish future can complete after the unload is done. With the metadata store table view, // MetadataStoreTableViewImpl.put() return cache.readModifyUpdateOrCreate(path, ...) .thenCompose(__ -> doHandleNotification(path)) // immediately notify local tableview Meanwhile, the source broker's own watch notification for This is why ExampleA Docker reproduction (4 JVMs on 2 CPUs, the transaction coordinator test class repeated on fresh clusters) hung once, with the CI signature. The test thread was waiting in the transfer: The source broker, 46795, handled the transfer's The request was registered later and was still waiting. The test cleanup's next ownership change of the bundle completed it, 30 s later: The thread dump taken at the timeout shows no blocked thread. Modifications
public CompletableFuture<Void> waitAsync(Supplier<CompletableFuture<Void>> eventPublisher, String bundle, UnloadDecision decision, long timeout, TimeUnit timeoutUnit) { InFlightUnload request = inFlightUnloadRequest.computeIfAbsent(bundle, ignore -> new InFlightUnload(decision.getUnload().sourceBroker(), new CompletableFuture<Void>().orTimeout(timeout, timeoutUnit))); ... return eventPublisher.get().whenComplete((__, ex) -> { // No event will complete the request, which the waiters of the bundle share: fail it if (ex != null && inFlightUnloadRequest.remove(bundle, request)) { future.completeExceptionally(ex); } }).thenCompose(__ -> unloaded) ...
Registering first opens a new window: an earlier unload's event that this broker handles after the registration could complete the new request. For example, a transfer to this broker completes the lookup that an unload request is waiting for inside As before, a failed publish fails the caller, and concurrent waiters of a bundle share one request. A failed publish now also removes the request instead of leaving it to time out. Verifying this change
Does this pull request potentially affect one of the following parts:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions… waits before publishing the event UnloadManager.waitAsync() registered the in-flight request only once the Releasing publish future completed, and complete() drops a terminal event (Owned/Free) when no request is registered. The publish future can complete after the unload is done: the metadata store table view completes a put only after it has handled a new read of the key, while the source broker's watch notification already drives Releasing -> Assigning -> Owned. The admin unload then waited namespaceBundleUnloadingTimeoutMs (60 s), which made ExtensibleLoadManagerImpl(WithTransactionCoordinator)Test.testUnloadAdminAPI time out after 30 s. SplitManager had the same ordering. waitAsync() now takes a Supplier that publishes the event and registers the request before calling it; a failed publish removes and fails the request. Because the request now exists before the unload's own events, UnloadManager completes it only on events whose source broker is the unload's (or Init), so the Owned of the transfer that made this broker the owner can't complete it. …-api-flake-97cc98
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
… waits before publishing the event (apache#27550) (cherry picked from commit e04dea5)
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
… waits before publishing the event (apache#27550) (cherry picked from commit e04dea5)
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. |