You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "thetumbled (via GitHub)" <gi...@apache.org> on 2024/06/03 07:11:37 UTC
[PR] [improve] [pip] PIP-357: Correct the conf name in load balance module. [pulsar]
thetumbled opened a new pull request, #22824:
URL: https://github.com/apache/pulsar/pull/22824
PIP: #22823
### Motivation
We use `loadBalancerBandwithInResourceWeight` and `loadBalancerBandwithOutResourceWeight` to calculate the broker's load in the load balance module. However, the correct conf name should be `loadBalancerBandwidthInResourceWeight` and `loadBalancerBandwidthOutResourceWeight`. This PIP is to correct the conf name in the load balance module.
### Modifications
Rename `loadBalancerBandwithInResourceWeight` to `loadBalancerBandwidthInResourceWeight` and `loadBalancerBandwithOutResourceWeight` to `loadBalancerBandwidthOutResourceWeight` in the load balance module.
### 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.
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve] [pip] PIP-357: Correct the conf name in load balance module. [pulsar]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower merged PR #22824:
URL: https://github.com/apache/pulsar/pull/22824
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve] [pip] PIP-357: Correct the conf name in load balance module. [pulsar]
Posted by "Demogorgon314 (via GitHub)" <gi...@apache.org>.
Demogorgon314 commented on code in PR #22824:
URL: https://github.com/apache/pulsar/pull/22824#discussion_r1629000711
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -2444,17 +2444,60 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
- doc = "BandwithIn Resource Usage Weight"
+ doc = "BandwidthIn Resource Usage Weight"
+ )
+ private double loadBalancerBandwidthInResourceWeight = 1.0;
+
+ @FieldContext(
+ dynamic = true,
+ category = CATEGORY_LOAD_BALANCER,
+ doc = "BandwidthOut Resource Usage Weight"
+ )
+ private double loadBalancerBandwidthOutResourceWeight = 1.0;
+
+ @Deprecated
+ @FieldContext(
+ dynamic = true,
+ category = CATEGORY_LOAD_BALANCER,
+ doc = "BandwidthIn Resource Usage Weight, Deprecated: Use loadBalancerBandwidthInResourceWeight"
)
private double loadBalancerBandwithInResourceWeight = 1.0;
+ @Deprecated
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
- doc = "BandwithOut Resource Usage Weight"
+ doc = "BandwidthOut Resource Usage Weight, Deprecated: Use loadBalancerBandwidthOutResourceWeight"
)
private double loadBalancerBandwithOutResourceWeight = 1.0;
+ /**
+ * Get the load balancer bandwidth in resource weight.
+ * To be compatible with the old configuration, we still support the old configuration.
+ * If a configuration is not the default configuration, use that configuration.
+ * If both the new and the old are configured different from the default value, use the new one.
+ * @return
+ */
+ public double getLoadBalancerBandwidthInResourceWeight() {
+ if (loadBalancerBandwidthInResourceWeight != 1.0) {
+ return loadBalancerBandwidthInResourceWeight;
+ } else if (loadBalancerBandwithInResourceWeight != 1.0) {
+ return loadBalancerBandwithInResourceWeight;
+ } else {
+ return 1.0;
+ }
Review Comment:
```suggestion
if (loadBalancerBandwidthInResourceWeight != 1.0) {
return loadBalancerBandwidthInResourceWeight;
}
if (loadBalancerBandwithInResourceWeight != 1.0) {
return loadBalancerBandwithInResourceWeight;
}
return 1.0;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve] [pip] PIP-357: Correct the conf name in load balance module. [pulsar]
Posted by "Demogorgon314 (via GitHub)" <gi...@apache.org>.
Demogorgon314 commented on code in PR #22824:
URL: https://github.com/apache/pulsar/pull/22824#discussion_r1629002321
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -2444,17 +2444,60 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
- doc = "BandwithIn Resource Usage Weight"
+ doc = "BandwidthIn Resource Usage Weight"
+ )
+ private double loadBalancerBandwidthInResourceWeight = 1.0;
+
+ @FieldContext(
+ dynamic = true,
+ category = CATEGORY_LOAD_BALANCER,
+ doc = "BandwidthOut Resource Usage Weight"
+ )
+ private double loadBalancerBandwidthOutResourceWeight = 1.0;
+
+ @Deprecated
+ @FieldContext(
+ dynamic = true,
+ category = CATEGORY_LOAD_BALANCER,
+ doc = "BandwidthIn Resource Usage Weight, Deprecated: Use loadBalancerBandwidthInResourceWeight"
)
private double loadBalancerBandwithInResourceWeight = 1.0;
+ @Deprecated
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
- doc = "BandwithOut Resource Usage Weight"
+ doc = "BandwidthOut Resource Usage Weight, Deprecated: Use loadBalancerBandwidthOutResourceWeight"
)
private double loadBalancerBandwithOutResourceWeight = 1.0;
+ /**
+ * Get the load balancer bandwidth in resource weight.
+ * To be compatible with the old configuration, we still support the old configuration.
+ * If a configuration is not the default configuration, use that configuration.
+ * If both the new and the old are configured different from the default value, use the new one.
+ * @return
+ */
+ public double getLoadBalancerBandwidthInResourceWeight() {
+ if (loadBalancerBandwidthInResourceWeight != 1.0) {
+ return loadBalancerBandwidthInResourceWeight;
+ } else if (loadBalancerBandwithInResourceWeight != 1.0) {
+ return loadBalancerBandwithInResourceWeight;
+ } else {
+ return 1.0;
+ }
+ }
+
+ public double getLoadBalancerBandwidthOutResourceWeight() {
+ if (loadBalancerBandwidthOutResourceWeight != 1.0) {
Review Comment:
Same as the previous comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve] [pip] PIP-357: Correct the conf name in load balance module. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on code in PR #22824:
URL: https://github.com/apache/pulsar/pull/22824#discussion_r1629005418
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -2444,17 +2444,60 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
- doc = "BandwithIn Resource Usage Weight"
+ doc = "BandwidthIn Resource Usage Weight"
+ )
+ private double loadBalancerBandwidthInResourceWeight = 1.0;
+
+ @FieldContext(
+ dynamic = true,
+ category = CATEGORY_LOAD_BALANCER,
+ doc = "BandwidthOut Resource Usage Weight"
+ )
+ private double loadBalancerBandwidthOutResourceWeight = 1.0;
+
+ @Deprecated
+ @FieldContext(
+ dynamic = true,
+ category = CATEGORY_LOAD_BALANCER,
+ doc = "BandwidthIn Resource Usage Weight, Deprecated: Use loadBalancerBandwidthInResourceWeight"
)
private double loadBalancerBandwithInResourceWeight = 1.0;
+ @Deprecated
@FieldContext(
dynamic = true,
category = CATEGORY_LOAD_BALANCER,
- doc = "BandwithOut Resource Usage Weight"
+ doc = "BandwidthOut Resource Usage Weight, Deprecated: Use loadBalancerBandwidthOutResourceWeight"
)
private double loadBalancerBandwithOutResourceWeight = 1.0;
+ /**
+ * Get the load balancer bandwidth in resource weight.
+ * To be compatible with the old configuration, we still support the old configuration.
+ * If a configuration is not the default configuration, use that configuration.
+ * If both the new and the old are configured different from the default value, use the new one.
+ * @return
+ */
+ public double getLoadBalancerBandwidthInResourceWeight() {
+ if (loadBalancerBandwidthInResourceWeight != 1.0) {
+ return loadBalancerBandwidthInResourceWeight;
+ } else if (loadBalancerBandwithInResourceWeight != 1.0) {
+ return loadBalancerBandwithInResourceWeight;
+ } else {
+ return 1.0;
+ }
+ }
+
+ public double getLoadBalancerBandwidthOutResourceWeight() {
+ if (loadBalancerBandwidthOutResourceWeight != 1.0) {
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve] [pip] PIP-357: Correct the conf name in load balance module. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on PR #22824:
URL: https://github.com/apache/pulsar/pull/22824#issuecomment-2152139239
/pulsarbot rerun-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org