-
Notifications
You must be signed in to change notification settings - Fork 38
Make namespace/topic policies unset by default #167
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
base: master
Are you sure you want to change the base?
Make namespace/topic policies unset by default #167
Conversation
|
@klevy-toast:Thanks for your contribution. For this PR, do we need to update docs? |
19e3e01 to
b02f5b1
Compare
|
@klevy-toast:Thanks for providing doc info! |
e84b619 to
056edbc
Compare
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 changes the default values for various topic and namespace configuration parameters from 0 to -1 to better distinguish between "explicitly set to 0" (unlimited/disabled) and "use namespace/broker defaults" (unset). It introduces removal operations for when values are set to -1, adds comprehensive test coverage for default behavior, and updates the Pulsar client dependency.
Key changes:
- Default values changed from
0to-1formax_consumers,max_producers,message_ttl_seconds,max_unacked_messages_per_consumer,max_unacked_messages_per_subscription,msg_publish_rate, andbyte_publish_ratein topic resources, and similar parameters in namespace resources - Update logic enhanced to call
Remove*API methods when values are-1 - New test files verify default, removal, and explicit zero-value behaviors
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| pulsar/resource_pulsar_topic.go | Updated default values to -1, added descriptions, enhanced read/update logic for removal operations |
| pulsar/resource_pulsar_namespace.go | Updated default values to -1 and added descriptions for namespace config parameters |
| pulsar/resource_pulsar_topic_test.go | Updated test assertions from "0" to "-1" and added new test step for partial configuration |
| pulsar/resource_pulsar_topic_defaults_test.go | New test file covering default behavior, parameter removal, and explicit zero values for topics |
| pulsar/resource_pulsar_namespace_defaults_test.go | New test file covering default behavior, parameter removal, and explicit zero values for namespaces |
| go.mod | Updated pulsar-client-go dependency version |
| go.sum | Updated checksums for new dependency versions |
Comments suppressed due to low confidence (1)
pulsar/resource_pulsar_namespace.go:226
- The
validateGtEq0function only allows values >= 0, but with the new default of -1, this validation will reject the default value. The validation function needs to be updated to allow -1 (e.g.,validateGtEqNeg1that accepts values >= -1), or the Default should be removed and handled differently.
Optional: true,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if !isIgnorableTopicPolicyError(err) { | ||
| errs = errors.Wrap(errs, fmt.Sprintf("RemovePublishRate error: %v", err)) | ||
| } else { | ||
| return backoff.Permanent(fmt.Errorf("ERROR_UPDATE_PUBLISH_RATE: RemovePublishRate: %w", err)) | ||
| } |
Copilot
AI
Nov 7, 2025
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.
The error handling logic is inverted. When isIgnorableTopicPolicyError returns false (non-ignorable error), the code wraps the error but continues. When it returns true (ignorable error), it returns a permanent error. This should be: if the error is NOT ignorable, return permanent error; if it IS ignorable, wrap and continue.
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.
I did not change this error handling logic so I'm unsure on the original intention.
freeznet
left a comment
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.
lgtm, but could you please help address the changes to docs as well, thanks.
Just ran the doc generation again! |
Fixes #164
Motivation
Update namespace / topic policy defaults to -1 indicating unset. Add logic to remove configs when unset.
Modifications
Verifying this change
(Please pick either of the following options)
This change added tests and can be verified as follows:
Documentation
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)