You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "heesung-sn (via GitHub)" <gi...@apache.org> on 2024/02/24 07:40:53 UTC
[PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
heesung-sn opened a new pull request, #22112:
URL: https://github.com/apache/pulsar/pull/22112
<!--
### Contribution Checklist
- PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
-->
### Motivation
<!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. -->
Upon Assigning and Releasing, if this broker is not the dst broker, return the dst broker as the owner(or empty). Clients need to connect(redirect) to the dst broker anyway and wait for the dst broker to receive `Owned`. This is also required to return getOwnerAsync on the src broker immediately during unloading. Otherwise, topic creation(getOwnerAsync) could block unloading bundles, if the topic creation(getOwnerAsync) happens during unloading on the src broker.
### Modifications
- Return getOwnerAsync without waiting on source broker upon Assigning and Releasing
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change added tests.
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on code in PR #22112:
URL: https://github.com/apache/pulsar/pull/22112#discussion_r1503186397
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:
##########
@@ -521,7 +521,16 @@ public CompletableFuture<Optional<String>> getOwnerAsync(String serviceUnit) {
return getActiveOwnerAsync(serviceUnit, state, Optional.of(data.sourceBroker()));
}
case Assigning, Releasing -> {
- return getActiveOwnerAsync(serviceUnit, state, Optional.empty());
+ if (isTargetBroker(data.dstBroker())) {
+ return getActiveOwnerAsync(serviceUnit, state, Optional.of(data.dstBroker()));
+ }
+ // If this broker is not the dst broker, return the dst broker as the owner(or empty).
+ // Clients need to connect(redirect) to the dst broker anyway
+ // and wait for the dst broker to receive `Owned`.
+ // This is also required to return getOwnerAsync on the src broker immediately during unloading.
+ // Otherwise, topic creation(getOwnerAsync) could block unloading bundles,
Review Comment:
i think testGetOwnerAsync sort of covers this case, but I added unloadTimeoutCheckTest too.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- closed pull request #22112: [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing
URL: https://github.com/apache/pulsar/pull/22112
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on code in PR #22112:
URL: https://github.com/apache/pulsar/pull/22112#discussion_r1503447006
##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/loadbalance/ExtensibleLoadManagerTest.java:
##########
@@ -390,19 +392,24 @@ public void testIsolationPolicy() throws Exception {
}
}
- Awaitility.await().atMost(30, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
+ Awaitility.await().atMost(60, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
() -> {
- List<String> activeBrokers = admin.brokers().getActiveBrokers();
+ List<String> activeBrokers = admin.brokers().getActiveBrokersAsync().get(5, TimeUnit.SECONDS);
assertEquals(activeBrokers.size(), 1);
}
);
- try {
- admin.lookups().lookupTopic(topic);
- fail();
- } catch (Exception ex) {
- log.error("Failed to lookup topic: ", ex);
- assertThat(ex.getMessage()).contains("Failed to select the new owner broker for bundle");
- }
+
+ Awaitility.await().atMost(90, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
+ () -> {
Review Comment:
found another bug in playLeader and playFollower, fixing it
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
Posted by "Demogorgon314 (via GitHub)" <gi...@apache.org>.
Demogorgon314 commented on code in PR #22112:
URL: https://github.com/apache/pulsar/pull/22112#discussion_r1502705327
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:
##########
@@ -521,7 +521,16 @@ public CompletableFuture<Optional<String>> getOwnerAsync(String serviceUnit) {
return getActiveOwnerAsync(serviceUnit, state, Optional.of(data.sourceBroker()));
}
case Assigning, Releasing -> {
- return getActiveOwnerAsync(serviceUnit, state, Optional.empty());
+ if (isTargetBroker(data.dstBroker())) {
+ return getActiveOwnerAsync(serviceUnit, state, Optional.of(data.dstBroker()));
+ }
+ // If this broker is not the dst broker, return the dst broker as the owner(or empty).
+ // Clients need to connect(redirect) to the dst broker anyway
+ // and wait for the dst broker to receive `Owned`.
+ // This is also required to return getOwnerAsync on the src broker immediately during unloading.
+ // Otherwise, topic creation(getOwnerAsync) could block unloading bundles,
Review Comment:
I wonder do we have a unit test to stable reproduce this issue?
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing and handle role change during role init [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn merged PR #22112:
URL: https://github.com/apache/pulsar/pull/22112
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on code in PR #22112:
URL: https://github.com/apache/pulsar/pull/22112#discussion_r1503447006
##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/loadbalance/ExtensibleLoadManagerTest.java:
##########
@@ -390,19 +392,24 @@ public void testIsolationPolicy() throws Exception {
}
}
- Awaitility.await().atMost(30, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
+ Awaitility.await().atMost(60, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
() -> {
- List<String> activeBrokers = admin.brokers().getActiveBrokers();
+ List<String> activeBrokers = admin.brokers().getActiveBrokersAsync().get(5, TimeUnit.SECONDS);
assertEquals(activeBrokers.size(), 1);
}
);
- try {
- admin.lookups().lookupTopic(topic);
- fail();
- } catch (Exception ex) {
- log.error("Failed to lookup topic: ", ex);
- assertThat(ex.getMessage()).contains("Failed to select the new owner broker for bundle");
- }
+
+ Awaitility.await().atMost(90, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
+ () -> {
Review Comment:
found another bug here, fixing it
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Return getOwnerAsync without waiting on source broker upon Assigning and Releasing [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on code in PR #22112:
URL: https://github.com/apache/pulsar/pull/22112#discussion_r1503464316
##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/loadbalance/ExtensibleLoadManagerTest.java:
##########
@@ -390,19 +392,24 @@ public void testIsolationPolicy() throws Exception {
}
}
- Awaitility.await().atMost(30, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
+ Awaitility.await().atMost(60, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
() -> {
- List<String> activeBrokers = admin.brokers().getActiveBrokers();
+ List<String> activeBrokers = admin.brokers().getActiveBrokersAsync().get(5, TimeUnit.SECONDS);
assertEquals(activeBrokers.size(), 1);
}
);
- try {
- admin.lookups().lookupTopic(topic);
- fail();
- } catch (Exception ex) {
- log.error("Failed to lookup topic: ", ex);
- assertThat(ex.getMessage()).contains("Failed to select the new owner broker for bundle");
- }
+
+ Awaitility.await().atMost(90, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
+ () -> {
Review Comment:
done.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org