-
Notifications
You must be signed in to change notification settings - Fork 363
Fix: namespace schema compatibility strategy #1386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: namespace schema compatibility strategy #1386
Conversation
…rategy methods to manage schema compatibility settings
…CompatibilityStrategy methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR separates schema compatibility into two distinct strategies—auto-update and standard compatibility—by introducing a new SchemaAutoUpdateCompatibilityStrategy
type, updating parsing logic, extending the namespace API, and adjusting tests.
- Add
SchemaAutoUpdateCompatibilityStrategy
type with parse andString()
methods - Update
Policies
struct andNewDefaultPolicies()
to include the auto-update strategy field - Extend the
Namespaces
interface and implementation to set/get both compatibility and auto-update strategies, plus update related tests
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/utils/schema_strategy.go | Introduce new strategy type and parsing utilities |
pkg/utils/schema_strategy_test.go | Add table-driven tests for both parsing and String() |
pkg/utils/policies.go | Update Policies struct and defaults for auto-update field |
pkg/admin/schema_test.go | Update assertions to use constant instead of string |
pkg/admin/namespace_test.go | Add tests for setting/getting the new compatibility methods |
pkg/admin/namespace.go | Extend interface and implementation with new methods |
Comments suppressed due to low confidence (2)
pulsaradmin/pkg/utils/schema_strategy.go:26
- [nitpick] This exported type lacks a GoDoc comment. Please add a doc comment above
SchemaAutoUpdateCompatibilityStrategy
to explain its purpose.
type SchemaAutoUpdateCompatibilityStrategy string
pulsaradmin/pkg/admin/namespace.go:541
- The code uses
strings.ReplaceAll
but thestrings
package isn't imported, which will cause a compilation error. Please addimport "strings"
at the top of this file.
s, err := utils.ParseSchemaCompatibilityStrategy(strings.ReplaceAll(string(b), "\"", ""))
…n expected values and error handling
The CI failure is not related to this PR and would be fixed by #1387. merge this PR first. |
(If this PR fixes a github issue, please add
Fixes #<xyz>
.)Fixes #
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>
to link to the master issue.)Master Issue: #
Motivation
Making pulsar-client-go support both https://github.com/apache/pulsar/blob/master/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/SchemaAutoUpdateCompatibilityStrategy.java and https://github.com/apache/pulsar/blob/master/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/SchemaCompatibilityStrategy.java
Modifications
Describe the modifications you've done.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation