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/09/26 13:54:07 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #12193: Fixed counter base path getting deleted

merlimat commented on a change in pull request #12193:
URL: https://github.com/apache/pulsar/pull/12193#discussion_r716207869



##########
File path: pulsar-metadata/src/test/java/org/apache/pulsar/metadata/CounterTest.java
##########
@@ -51,4 +51,40 @@ public void basicTest(String provider, Supplier<String> urlSupplier) throws Exce
         long l4 = cs1.getNextCounterValue("/my/path").join();
         assertNotEquals(l3, l4);
     }
+
+    @Test(dataProvider = "impl")
+    public void testCounterDoesNotAutoReset(String provider, Supplier<String> urlSupplier) throws Exception {
+        if (provider.equals("Memory")) {
+            // Test doesn't make sense for local memory since we're testing across different instances
+            return;
+        }
+
+        MetadataStoreExtended store1 = MetadataStoreExtended.create(urlSupplier.get(),
+                MetadataStoreConfig.builder().build());
+
+        CoordinationService cs1 = new CoordinationServiceImpl(store1);
+
+        long l1 = cs1.getNextCounterValue("/my/path").join();
+        long l2 = cs1.getNextCounterValue("/my/path").join();
+        long l3 = cs1.getNextCounterValue("/my/path").join();
+
+        assertNotEquals(l1, l2);
+        assertNotEquals(l2, l3);
+
+        cs1.close();
+        store1.close();;
+
+        // Delete all the empty container nodes
+        zks.checkContainers();
+
+        MetadataStoreExtended store2 = MetadataStoreExtended.create(urlSupplier.get(),

Review comment:
       The point of the change is for the parent z-node to *not* be deleted :)




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