Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

API usability: defaultNumPartitions validation is too strict for non-partitioned topic type #24998

Open
@Shawyeok

Description

@Shawyeok

Problem Description

When settingautoTopicCreation on namespace policy, the API validation prevents settingdefaultNumPartitions when the topic type isnon-partitioned. This limitation makes the API harder to use and less flexible.

Current behavior:

  • SettingdefaultNumPartitions withtopicType="non-partitioned" results in a validation error:"[defaultNumPartitions] is not allowed to be set when the type is non-partition."

Code location:

}elseif (TopicType.NON_PARTITIONED.toString().equals(override.getTopicType())) {
if (override.getDefaultNumPartitions() !=null) {
returnValidateResult.fail("[defaultNumPartitions] is not allowed to be"
+" set when the type is non-partition.");
}
}

Use Cases Affected

  1. Configuration management: Users managing configurations programmatically or via infrastructure-as-code tools may want to set a default value even for non-partitioned topics, especially if they plan to switch to partitioned topics later.

  2. API consistency: The validation requires users to conditionally include/exclude thedefaultNumPartitions field based on topic type, making the API less consistent and more error-prone.

  3. Configuration templates: Shared configuration templates or defaults become harder to maintain when they need to conditionally exclude fields.

Proposed Solution

Consider relaxing this validation to allowdefaultNumPartitions to be set (but ignored) whentopicType="non-partitioned". This would:

  • Make the API more user-friendly
  • Allow for more flexible configuration management
  • Maintain backward compatibility (non-partitioned topics would still be created correctly)
  • Simplify client code that doesn't need to conditionally set fields

Alternatively, if there's a technical reason this field must not be set, it would be helpful to document this clearly and potentially provide a clearer error message explaining why.

Question

Is this limitation necessary from a technical standpoint, or could it be relaxed to improve API usability?

Environment

  • Pulsar version:3.x,4.x
  • Component: Admin API / Namespace Policy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp