You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Denovo1998 (via GitHub)" <gi...@apache.org> on 2026/10/19 13:39:15 UTC

[PR] [fix][schema] Exclude deleted schema versions from recovery results [pulsar]

Denovo1998 opened a new pull request, #27002:
URL: https://github.com/apache/pulsar/pull/27002

   Related to #22758.
   
   ### Motivation
   
   When a schema ledger read fails with a non-recoverable BookKeeper error, the recovery path collects readable schema versions and clears the broken schema storage. It calls the history-trimming helper but discards its return value, leaving versions at or before the latest deletion marker in the result.
   
   As a result, `getVersionBySchema` can return a deleted version instead of a matching version registered after deletion, or `-1` when no matching version remains.
   
   ### Modifications
   
   - Return the trimmed schema history from the non-recoverable error path.
   - Add Admin API regression tests that remove a BookKeeper schema ledger and verify that recovery excludes deleted versions while retaining matches after the deletion marker.
   - Verify that recovery cleanup completes and subsequent schema registration and retrieval succeed.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   This change adds `SchemaServiceTest.testSchemaRecoveryDoesNotReuseDeletedVersions` with two cases. Without the production fix, both return version `0` instead of the expected `-1` and `3`. With the fix, both pass unchanged.
   
   Local validation passed all 17 focused tests, including schema version lookup, deletion/recreation, missing-ledger recovery, and existing BookKeeper read-handle tests. `quickCheck` also passed. Test retries were disabled, with one worker and one test fork. Full CI has not run.
   
   The new regression cases can be run with:
   
   ./gradlew :pulsar-broker:test \
     --tests 'org.apache.pulsar.broker.service.schema.SchemaServiceTest.testSchemaRecoveryDoesNotReuseDeletedVersions' \
     -PtestRetryCount=0 -PtestFailFast=false \
     -PtestMaxParallelForks=1 --max-workers=1
   
   ### Does this pull request potentially affect one of the following parts:
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   


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


Re: [PR] [fix][schema] Exclude deleted schema versions from recovery results [pulsar]

Posted by "Denovo1998 (via GitHub)" <gi...@apache.org>.
Denovo1998 commented on PR #27002:
URL: https://github.com/apache/pulsar/pull/27002#issuecomment-6268649485

   @hanmz The previous PR was closed, was there any reason for it?


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