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 2022/11/08 02:54:22 UTC

[GitHub] [pulsar] AnonHxy commented on a diff in pull request #18293: [fix][broker][schema]fix creating lots of ledgers for the same schema

AnonHxy commented on code in PR #18293:
URL: https://github.com/apache/pulsar/pull/18293#discussion_r1016094348


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/SchemaServiceTest.java:
##########
@@ -154,6 +168,18 @@ public void writeReadBackDeleteSchemaEntry() throws Exception {
         assertNull(schemaRegistryService.getSchema(schemaId1).get());
     }
 
+    @Test
+    public void testConcurrentPutSchema() throws Exception {
+        String schemaId = "tenant/ns/topic_test_concurrent_put_schema" + UUID.randomUUID();
+        CompletableFuture.allOf(
+                putSchema(schemaId, schemaData1),
+                putSchema(schemaId, schemaData1),
+                putSchema(schemaId, schemaData1),
+                putSchema(schemaId, schemaData1))
+                .get();
+        assertEquals(getAllSchemas(schemaId).size(), 1);

Review Comment:
   IIUC,  the first put schema request will success ,and the second request will fail with `BadVersionException`. Then the second request will retry call `putSchemaIfAbsent`, result with `schema is already exists`.  That's OK.
   
   But I have a minor question, the second request will also create some ledgers, which will never be used again, will this PR try to delete the unused ledgers?



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