Skip to content

Conversation

@Radiancebobo
Copy link

Motivation

Currently, pulsarctl lacks the ability to force delete a schema. If a schema's underlying ledger cannot be opened or is in a corrupted state, the standard delete command fails.

In such scenarios, users are currently forced to switch to the Java-based pulsar-admin tool (which supports pulsar-admin schemas delete xxx -f) to clean up these schemas.

This PR adds the --force flag to pulsarctl schemas delete to support forced deletion, resolving these edge cases and bringing feature parity with the Java pulsar-admin CLI.

Modifications

  • Added support for the --force flag in the schemas delete command.
  • Updated the API call to pass the force option, allowing the deletion of schemas even when they are in an inconsistent state (e.g., ledger unopenable).

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change added tests and can be verified as follows:

  • Verified manually that using --force allows deleting schemas that otherwise fail to delete due to ledger issues.
hcb-admin@Ub0015:/media/hcb/vdb/code/go_code/pulsarctl$ go test -v ./pkg/ctl/schemas -run TestSchemaForceDelete 
=== RUN   TestSchemaForceDelete
--- PASS: TestSchemaForceDelete (0.12s)
=== RUN   TestSchemaForceDeleteLongFlag
--- PASS: TestSchemaForceDeleteLongFlag (0.12s)
PASS
ok      github.com/streamnative/pulsarctl/pkg/ctl/schemas       0.243s
hcb-admin@Ub0015:/media/hcb/vdb/code/go_code/pulsarctl$ go test -v ./pkg/ctl/schemas -run TestSchemaForceDeleteLongFlag 
=== RUN   TestSchemaForceDeleteLongFlag
--- PASS: TestSchemaForceDeleteLongFlag (0.10s)
PASS
ok      github.com/streamnative/pulsarctl/pkg/ctl/schemas       0.109s

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (This aligns the CLI behavior with the existing Admin API capabilities and standard flags)

  • doc

    (If this PR contains doc changes)

@github-actions github-actions bot added the no-need-doc This pr does not need any document label Jan 21, 2026
@Radiancebobo
Copy link
Author

@mattisonchao @nlu90 @zymap Please review the code for me, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-need-doc This pr does not need any document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant