Skip to content

Conversation

freeznet
Copy link
Contributor

@freeznet freeznet commented Jul 1, 2025

(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

  • Make sure that the change passes the CI checks.

(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:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API: (yes / no)
  • The schema: (yes / no / don't know)
  • The default values of configurations: (yes / no)
  • The wire protocol: (yes / no)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@freeznet freeznet self-assigned this Jul 1, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 and String() methods
  • Update Policies struct and NewDefaultPolicies() 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 the strings package isn't imported, which will cause a compilation error. Please add import "strings" at the top of this file.
	s, err := utils.ParseSchemaCompatibilityStrategy(strings.ReplaceAll(string(b), "\"", ""))

@RobertIndie
Copy link
Member

The CI failure is not related to this PR and would be fixed by #1387. merge this PR first.

@RobertIndie RobertIndie merged commit 58ac256 into apache:master Jul 2, 2025
11 of 17 checks passed
@RobertIndie RobertIndie added this to the v0.16.0 milestone Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants