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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]