Demogorgon314 commented on code in PR #20652:
URL: https://github.com/apache/pulsar/pull/20652#discussion_r1245398548
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java:
##########
@@ -717,19 +717,19 @@ public CompletableFuture<Void>
validateBundleOwnershipAsync(NamespaceBundle bund
throw new RestException(Status.PRECONDITION_FAILED,
"Failed to find ownership for ServiceUnit:" +
bundle.toString());
}
- // If the load manager is extensible load manager, we
don't need check the authoritative.
- if
(ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(config())) {
- return CompletableFuture.completedFuture(null);
- }
return nsService.isServiceUnitOwnedAsync(bundle)
.thenAccept(owned -> {
if (!owned) {
boolean newAuthoritative =
this.isLeaderBroker();
// Replace the host and port of the
current request and redirect
- URI redirect =
UriBuilder.fromUri(uri.getRequestUri()).host(webUrl.get().getHost())
-
.port(webUrl.get().getPort()).replaceQueryParam("authoritative",
-
newAuthoritative).replaceQueryParam("destinationBroker",
- null).build();
+ UriBuilder uriBuilder =
UriBuilder.fromUri(uri.getRequestUri())
+ .host(webUrl.get().getHost())
+ .port(webUrl.get().getPort())
+
.replaceQueryParam("authoritative", newAuthoritative);
+ if
(!ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(config())) {
Review Comment:
Before, the `destinationBroker` is set in the leader broker's
`ModularLoadManagerImpl#bundleBrokerAffinityMap`, so it requires redirecting to
the leader and setting the `destinationBroker` before doing in the real unload
operation.
The unload operation requires execution in the owner broker, which will
redirect to the owner broker after setting the `destinationBroker` success. If
we don't clean the `destinationBroker` parameter, it will fall into a loop.
The `ExtensibleLoadManagerImpl` used a different way to transfer the
ownership to `destinationBroker`, so we do not need to clean the
`destinationBroker` parameter when redirecting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]