You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/07 16:30:13 UTC

[GitHub] [pulsar] kezhuw opened a new pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

kezhuw opened a new pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165


   See #7517.
   See #7773.
   
   ### Motivation
   Add assertions for namespace listener in test cases when zookeeper disconnected.
   
   ### Modifications
   Add assertions in `TopicOwnerTest` to guard `NamespaceBundleOwnershipListener` when zookeeper disconnected.
   * `testAcquireOwnershipWithZookeeperDisconnectedBeforeOwnershipNodeCreated`
   * `testAcquireOwnershipWithZookeeperDisconnectedAfterOwnershipNodeCreated`
   * `testReestablishOwnershipAfterInvalidateCache`
   * `testReleaseOwnershipWithZookeeperDisconnectedBeforeOwnershipNodeDeleted`
   * `testReleaseOwnershipWithZookeeperDisconnectedAfterOwnershipNodeDeleted`
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change is already covered by existing tests:
   * `TopicOwnerTest`
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   
   ### WARNING
   **This will breaks #10126.**


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-815559519


   More failures:
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2293178198#step:8:520
   ```log
   java.lang.AssertionError: expected [false] but found [true]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertFalse(Assert.java:67)
   	at org.testng.Assert.assertFalse(Assert.java:77)
   	at org.apache.pulsar.broker.admin.AdminApiTest.testDeleteTenantForcefully(AdminApiTest.java:1149)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2293178198#step:8:1275 (#9919)
   ```
   java.lang.AssertionError: expected [true] but found [false]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertTrue(Assert.java:45)
   	at org.testng.Assert.assertTrue(Assert.java:55)
   	at org.apache.pulsar.broker.stats.ManagedCursorMetricsTest.testManagedCursorMetrics(ManagedCursorMetricsTest.java:60)
   ```


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] github-actions[bot] commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-1058891865


   @kezhuw:Thanks for your contribution. For this PR, do we need to update docs?
   (The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)


-- 
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



[GitHub] [pulsar] eolivelli commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-817328874


   @lhotari PTAL


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-815105913


   cc @hangc0276 @jiazhai @codelipenghui @sijie
   
   As noted in reviewing #10126, this pr adds assertions for #7517 and #7773. #10126 breaks `testAcquireOwnershipWithZookeeperDisconnectedAfterOwnershipNodeCreated` and `testReleaseOwnershipWithZookeeperDisconnectedBeforeOwnershipNodeDeleted`.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw commented on a change in pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on a change in pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#discussion_r611203636



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicOwnerTest.java
##########
@@ -240,6 +245,28 @@ private void spyZookeeperToDisconnectAfterPersist(ZooKeeper zooKeeper, RequestMa
         }).when(spyZooKeeperServer).submitRequest(any(Request.class));
     }
 
+    private MutableBoolean listenNamespaceBundleLoading(PulsarService broker, NamespaceBundle namespaceBundle) {
+        NamespaceService namespaceService = broker.getNamespaceService();
+        final MutableBoolean loaded = new MutableBoolean();
+        namespaceService.addNamespaceBundleOwnershipListener(new NamespaceBundleOwnershipListener() {

Review comment:
       I am not sure I understand your concern correctly. I try to answer with following. Correct me if mistake happens.
   
   * The returned `MutableBoolean` is one per listening. It is used in assertion after all procedures done. So if assertion fails, it is a bug either production or test scope.
   * Every listening is serving for one bundle(eg. `namespaceBundle` in parameter list). Multiple listening return different `MutableBoolean` for combination of `broker` and `namespaceBundle`. There is no sharing.
   
   > If call listenNamespaceBundleLoading multiple times, it will register multiple listeners to the namespace service, is this an expected behavior for your test?
   
   There is no multiple listening for same combination of `broker` and `namespaceBundle` in test code.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-1058891642


   The pr had no activity for 30 days, mark with Stale label.


-- 
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



[GitHub] [pulsar] kezhuw commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-815559894


   /pulsarbot run-failure-checks


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on a change in pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#discussion_r611199961



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicOwnerTest.java
##########
@@ -240,6 +245,28 @@ private void spyZookeeperToDisconnectAfterPersist(ZooKeeper zooKeeper, RequestMa
         }).when(spyZooKeeperServer).submitRequest(any(Request.class));
     }
 
+    private MutableBoolean listenNamespaceBundleLoading(PulsarService broker, NamespaceBundle namespaceBundle) {
+        NamespaceService namespaceService = broker.getNamespaceService();
+        final MutableBoolean loaded = new MutableBoolean();
+        namespaceService.addNamespaceBundleOwnershipListener(new NamespaceBundleOwnershipListener() {

Review comment:
       If call listenNamespaceBundleLoading multiple times, it will register multiple listeners to the namespace service, is this an expected behavior for your test? In my opinion, we only need to add one listener for the same purpose?
   
   And the MutableBoolean will be changed during the test execution, I noticed the MutableBoolean is used for asserting, this will introduce flaky tests.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw commented on a change in pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on a change in pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#discussion_r611203956



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicOwnerTest.java
##########
@@ -434,13 +477,22 @@ public void testReleaseOwnershipWithZookeeperDisconnectedBeforeOwnershipNodeDele
         leaderAuthorizedBroker.setValue(pulsar2);
 
         // We don't known whether previous unload was successful or not, but now all lookups should return same result.
-        final String currentBrokerServiceUrl = pulsarAdmins[0].lookups().lookupTopic(topic1);
-        Assert.assertEquals(pulsarAdmins[1].lookups().lookupTopic(topic1), currentBrokerServiceUrl);
-        Assert.assertEquals(pulsarAdmins[2].lookups().lookupTopic(topic1), currentBrokerServiceUrl);
-        Assert.assertEquals(pulsarAdmins[3].lookups().lookupTopic(topic1), currentBrokerServiceUrl);
-        Assert.assertEquals(pulsarAdmins[4].lookups().lookupTopic(topic1), currentBrokerServiceUrl);
+        final String ownerBrokerServiceUrl = pulsarAdmins[0].lookups().lookupTopic(topic1);
+        Assert.assertEquals(pulsarAdmins[1].lookups().lookupTopic(topic1), ownerBrokerServiceUrl);
+        Assert.assertEquals(pulsarAdmins[2].lookups().lookupTopic(topic1), ownerBrokerServiceUrl);
+        Assert.assertEquals(pulsarAdmins[3].lookups().lookupTopic(topic1), ownerBrokerServiceUrl);
+        Assert.assertEquals(pulsarAdmins[4].lookups().lookupTopic(topic1), ownerBrokerServiceUrl);
 
         pulsarAdmins[0].topics().createNonPartitionedTopic(topic1);
+
+        for (Map.Entry<String, MutableBoolean> entry : loadedFromListenersByBrokerUrl.entrySet()) {
+            String brokerUrl = entry.getKey();
+            PulsarService service = servicesByBrokerUrl.get(brokerUrl);
+            MutableBoolean loadedFromListener = entry.getValue();
+            boolean owned = brokerUrl.equals(ownerBrokerServiceUrl);
+            Assert.assertEquals(service.getNamespaceService().isServiceUnitOwned(namespaceBundle), owned);
+            Assert.assertEquals(entry.getValue().booleanValue(), owned);

Review comment:
       ```suggestion
               Assert.assertEquals(loadedFromListener.booleanValue(), owned);
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-815407820


   /pulsarbot run-failure-checks


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw edited a comment on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw edited a comment on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-815407721


   Test failures(only assertion failures, more are timeout failures which I omitted):
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381399#step:8:526 
   ```shell
   java.lang.AssertionError: expected [16] but found [0]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
   	at org.testng.Assert.assertEquals(Assert.java:122)
   	at org.testng.Assert.assertEquals(Assert.java:907)
   	at org.testng.Assert.assertEquals(Assert.java:917)
   	at org.apache.pulsar.broker.transaction.coordinator.TransactionMetaStoreAssignmentTest.testTransactionMetaStoreAssignAndFailover(TransactionMetaStoreAssignmentTest.java:46)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381872#step:8:143 (#10151)
   ```shell
   java.lang.AssertionError: expected [true] but found [false]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertTrue(Assert.java:45)
   	at org.testng.Assert.assertTrue(Assert.java:55)
   	at org.apache.pulsar.client.api.KeySharedSubscriptionTest.testOrderingWithConsumerListener(KeySharedSubscriptionTest.java:937)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381872#step:8:1355 (#10150)
   ```shell
   java.lang.AssertionError: expected [0] but found [1]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
   	at org.testng.Assert.assertEquals(Assert.java:122)
   	at org.testng.Assert.assertEquals(Assert.java:797)
   	at org.testng.Assert.assertEquals(Assert.java:807)
   	at org.apache.pulsar.broker.service.PersistentTopicE2ETest.testBrokerConnectionStats(PersistentTopicE2ETest.java:1506)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381872#step:8:1701 (#8512)
   ```shell
   java.lang.AssertionError: expected object to not be null
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.assertNotNull(Assert.java:942)
   	at org.testng.Assert.assertNotNull(Assert.java:926)
   	at org.apache.pulsar.client.api.KeySharedSubscriptionTest.testContinueDispatchMessagesWhenMessageTTL(KeySharedSubscriptionTest.java:884)
   ```


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] kezhuw commented on pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

Posted by GitBox <gi...@apache.org>.
kezhuw commented on pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#issuecomment-815407721


   Test failures:
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381399#step:8:526 
   ```shell
   java.lang.AssertionError: expected [16] but found [0]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
   	at org.testng.Assert.assertEquals(Assert.java:122)
   	at org.testng.Assert.assertEquals(Assert.java:907)
   	at org.testng.Assert.assertEquals(Assert.java:917)
   	at org.apache.pulsar.broker.transaction.coordinator.TransactionMetaStoreAssignmentTest.testTransactionMetaStoreAssignAndFailover(TransactionMetaStoreAssignmentTest.java:46)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381872#step:8:143 (#10151)
   ```shell
   java.lang.AssertionError: expected [true] but found [false]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertTrue(Assert.java:45)
   	at org.testng.Assert.assertTrue(Assert.java:55)
   	at org.apache.pulsar.client.api.KeySharedSubscriptionTest.testOrderingWithConsumerListener(KeySharedSubscriptionTest.java:937)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381872#step:8:1355 (#10150)
   ```shell
   java.lang.AssertionError: expected [0] but found [1]
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.failNotEquals(Assert.java:1037)
   	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
   	at org.testng.Assert.assertEquals(Assert.java:122)
   	at org.testng.Assert.assertEquals(Assert.java:797)
   	at org.testng.Assert.assertEquals(Assert.java:807)
   	at org.apache.pulsar.broker.service.PersistentTopicE2ETest.testBrokerConnectionStats(PersistentTopicE2ETest.java:1506)
   ```
   * https://github.com/apache/pulsar/pull/10165/checks?check_run_id=2289381872#step:8:1701 (#8512)
   ```shell
   java.lang.AssertionError: expected object to not be null
   	at org.testng.Assert.fail(Assert.java:99)
   	at org.testng.Assert.assertNotNull(Assert.java:942)
   	at org.testng.Assert.assertNotNull(Assert.java:926)
   	at org.apache.pulsar.client.api.KeySharedSubscriptionTest.testContinueDispatchMessagesWhenMessageTTL(KeySharedSubscriptionTest.java:884)
   ```


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org