Repository navigation
[fix][admin] Allow defaultNumPartitions for non-partitioned autoTopicCreation override - #25163
Conversation
…cCreation override
…tioned autoTopicCreation override
6a10c6a to
7a13f42
Compare
|
Updated |
Please add this information to the PR description. |
lhotari
left a comment
There was a problem hiding this comment.
LGTM, thanks for the contribution @ChimdumebiNebolisa
…efaultNumPartitions
Co-authored-by: Cursor <[email protected]>
lhotari
left a comment
There was a problem hiding this comment.
The updated tests now match the intended narrow validation: non-partitioned overrides accept null, 0, or 1, while the REST-level test verifies that 5 is rejected with HTTP 412. The accepted value is also verified as persisted but ignored at topic creation, producing a non-partitioned topic. I found no remaining issue in the current 125-line PR diff. The tracker delta contains unrelated upstream merges since the previous approval, so those were excluded in favor of the canonical three-file PR diff.
|
Fixed the Broker Group 3 CI failure in 1bdd1b6 by updating the stale validation-message assertion. The exact failing test now passes locally, and git diff --check is clean. The new CI runs are awaiting maintainer approval. |
…Creation override (apache#25163)
…ior changes (#1545) * [fix][test] Make TestSetTopicAutoCreation tolerant of broker error message changes The test asserted exact broker error strings, which broke when Pulsar changed the messages: - apache/pulsar#25163 (shipped in 4.2.5) relaxed the non-partitioned autoTopicCreation override validation and changed the rejection text from "[defaultNumPartitions] is not allowed to be set when the type is non-partition." to "[defaultNumPartitions] must be null, 0 or 1 when the type is non-partitioned." - 5.0.0 changed the missing-tenant error from "Tenant does not exist" to "Namespace does not exist". Replace the single exact-match `errReason` with an `errReasons` slice and assert containment, so the test passes against both old and new broker versions instead of being brittle to broker wording changes. Verified against Pulsar 4.2.4, 4.2.5 and 5.0.0. Co-Authored-By: CodeBuddy Code <[email protected]> * [fix][test] Authenticate transaction metadata request as super-user TestTxn_TCClient read transaction metadata through the raw admin HTTP helper (httpGet -> httpDo), which calls the plain-text web service without any credentials, so the broker authenticates it as the "anonymous" role. apache/pulsar#26773 ("Improve transaction admin checks", shipped in 4.2.5 and 5.0.0) added validateSuperUserAccess() to the transaction metadata admin endpoint (GET /admin/v3/transactions/transactionMetadata/{mostSigBits}/{leastSigBits}). The unauthenticated request is now rejected with HTTP 401, so transactionStats fails and the test panics on the nil stats map. Add an httpGetWithTLS helper that calls the TLS web service using the test client certificate, whose CN ("admin") is a super-user role in standalone.conf, and use it for the transaction metadata request. Verified against Pulsar 4.2.4, 4.2.5 and 5.0.0. Co-Authored-By: CodeBuddy Code <[email protected]> * [fix][test] Make TestPartitionState tolerant of removed stats field apache/pulsar#26687 (PIP-379: Remove the classic Shared and Key_Shared dispatcher implementations, shipped in 5.0.0) removed consumersAfterMarkDeletePosition from the subscription stats. The broker no longer serializes the field, so it unmarshals to a nil map instead of the empty map the test asserted. Assert the map is empty, which holds both for the old behavior (empty map) and the new one (absent/nil). Verified against Pulsar 4.2.4, 4.2.5 and 5.0.0. Co-Authored-By: CodeBuddy Code <[email protected]> * [fix][test] Address review feedback on admin test helpers - httpGetWithTLS: give the HTTPS test client a 30s timeout so a stalled broker/network path cannot hang the test run. - TestSetTopicAutoCreation: replace the unchecked `err.(rest.Error)` type assertion (which panics on transport/TLS errors) with `require.ErrorAs`. Co-Authored-By: CodeBuddy Code <[email protected]> * [fix][test] Cache the TLS admin HTTP client in test helper Build the HTTPS client (key pair, CA pool) once via sync.Once and reuse it across calls instead of rebuilding it on every request. Co-Authored-By: CodeBuddy Code <[email protected]> --------- Co-authored-by: CodeBuddy Code <[email protected]>
…Creation override (apache#25163) (cherry picked from commit 93aa6b8)
…Creation override (apache#25163) (cherry picked from commit 93aa6b8)
Fixes #24998
Motivation
The namespace
autoTopicCreationoverride validation rejectsdefaultNumPartitionswhenevertopicType=non-partitioned. This forces clients and infrastructure-as-code tools to conditionally omit the field, making shared configuration templates harder to maintain.The relaxation is intentionally narrow. For non-partitioned overrides,
defaultNumPartitionsmay benull,0, or1. Values greater than1remain invalid.Accepted values are persisted as submitted but ignored during runtime topic creation. Auto-created topics therefore remain non-partitioned.
Modifications
AutoTopicCreationOverrideImpl.validateOverrideto allowdefaultNumPartitionsforNON_PARTITIONEDonly when the value isnull,0, or1.0and1are accepted and2is rejected.1is persisted but ignored when the topic is auto-created5is rejected by the admin REST API with HTTP 412Verifying this change
Does this pull request potentially affect one of the following parts:
Documentation
doc-not-needed