BewareMyPower opened a new pull request #8258:
URL: https://github.com/apache/pulsar/pull/8258


   ### Motivation
   
   When creating schema for a partitioned topic, e.g. `my-topic`, only one 
z-node `/schemas/public/default/my-topic` would be created to record the 
schema's metadata. However, multiple ledgers would be created because each 
single partition would try to create the schema: first append a ledger, then 
write the same z-node.
   
   #2959 and #6683 solved the race condition of accessing the same z-node by 
calling `putSchema()` again. However, the unused ledgers of other partitions 
were created and were not recorded in the z-node. So, there's no way to locate 
these ledgers from ZK, which means there's no way to delete a topic's all 
associated schema ledgers.
   
   ### Modifications
   
   - Record these unused ledgers' id under the topic's z-node, e.g. 
`/schemas/public/default/my-topic/unusedLedgers/0` for topic `my-topic` and 
ledger 0.
   - Add a unit test to check if `unusedLedgers` z-node has these ledgers' id 
and these ledgers exist, after a partitioned topic's schema was created.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   
   Run test `PartitionedTopicsSchemaTest.testUnusedLedgers`.


----------------------------------------------------------------
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:
[email protected]


Reply via email to