You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/13 06:14:12 UTC

[GitHub] [pulsar] gaozhangmin opened a new pull request, #15147: [cleanup] Remove unused fields in method

gaozhangmin opened a new pull request, #15147:
URL: https://github.com/apache/pulsar/pull/15147

   
   ### Motivation
   There are so many unused parameters of method .
   
   ### Modifications
   
   Remove unused parameters of method 
   
   
   
   ### Documentation
   
   Check the box below or label this PR directly.
   
   Need to update docs? 
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
     
   - [ ] `no-need-doc` 
   (Please explain why)
     
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-added`
   (Docs have been already added)


-- 
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


[GitHub] [pulsar] Jason918 commented on a diff in pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
Jason918 commented on code in PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#discussion_r851735752


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/BrokerFilter.java:
##########
@@ -36,15 +35,13 @@ public interface BrokerFilter {
      * @param brokers
      *            The currently available brokers that have not already been filtered. This set may be modified by
      *            filter.
-     * @param bundleToAssign
-     *            The data for the bundle to assign.
      * @param loadData
      *            The load data from the leader broker.
      * @param conf
      *            The service configuration.
      * @throws BrokerFilterException
      *            There was an error in the pipeline and the brokers should be reset to their original value
      */
-    void filter(Set<String> brokers, BundleData bundleToAssign, LoadData loadData, ServiceConfiguration conf)
+    void filter(Set<String> brokers, LoadData loadData, ServiceConfiguration conf)

Review Comment:
   It's better not to change this. Some developer may use custom filter class. Let's keep the expansibility。



-- 
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


[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on code in PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#discussion_r854772834


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/BrokerVersionFilter.java:
##########
@@ -106,17 +106,15 @@ public Version getLatestVersionNumber(Set<String> brokers, LoadData loadData)
 
     /**
      * From the given set of available broker candidates, filter those using the version numbers.
-     *
-     * @param brokers
+     *  @param brokers
      *            The currently available brokers that have not already been filtered.
      * @param bundleToAssign
-     *            The data for the bundle to assign.
      * @param loadData
      *            The load data from the leader broker.
      * @param conf
-     *            The service configuration.
      */
-    public void filter(Set<String> brokers, BundleData bundleToAssign, LoadData loadData, ServiceConfiguration conf)
+    public void filter(Set<String> brokers, BundleData bundleToAssign, LoadData loadData,
+                       ServiceConfiguration conf)

Review Comment:
   Can you clarify the purpose of these changes in this section? I don't think we should remove the javadoc lines.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LeastLongTermMessageRate.java:
##########
@@ -37,12 +37,12 @@
  * Placement strategy which selects a broker based on which one has the least long term message rate.
  */
 public class LeastLongTermMessageRate implements ModularLoadManagerStrategy {
-    private static Logger log = LoggerFactory.getLogger(LeastLongTermMessageRate.class);
+    private static final Logger log = LoggerFactory.getLogger(LeastLongTermMessageRate.class);
 
     // Maintain this list to reduce object creation.
     private ArrayList<String> bestBrokers;
 
-    public LeastLongTermMessageRate(final ServiceConfiguration conf) {
+    public LeastLongTermMessageRate() {

Review Comment:
   Are you confident that this constructor is not used? I'd prefer to annotate it as deprecated and create a new one just in case there are any custom load balancer implementations relying on this constructor.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java:
##########
@@ -486,7 +485,7 @@ public static CompletableFuture<Map<String, Integer>> getAntiAffinityNamespaceOw
      * @throws Exception
      */
     public static boolean shouldAntiAffinityNamespaceUnload(
-            String namespace, String bundle, String currentBroker,

Review Comment:
   Similarly, I'd rather annotate the method as deprecated and then remove later, since the load balancing logic is pluggable--unless we're confident no one is using this method.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -2792,7 +2790,8 @@ private TopicName validateTopicName(String topic, long requestId, Object request
     }
 
     public ByteBufPair newMessageAndIntercept(long consumerId, long ledgerId, long entryId, int partition,
-            int redeliveryCount, ByteBuf metadataAndPayload, long[] ackSet, String topic, long epoch) {

Review Comment:
   I don't believe we should remove this method for the same reasons as above.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/PulsarServiceUnit.java:
##########
@@ -29,16 +29,16 @@ public class PulsarServiceUnit extends ServiceUnit {
     private final PulsarServiceRequest srvRequest;
     private ResourceDescription resrcRequired;
 
-    public static PulsarServiceUnit parse(String suReqJson) {

Review Comment:
   I was going to make the same comment as above, but it appears that this class is not used. I'm not sure if we should delete it, though.



-- 
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


[GitHub] [pulsar] Jason918 commented on a diff in pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
Jason918 commented on code in PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#discussion_r852001487


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleResourceAllocationPolicies.java:
##########
@@ -38,7 +34,7 @@ public SimpleResourceAllocationPolicies(PulsarService pulsar) {
         this.pulsar = pulsar;
     }
 
-    public boolean canAssign(ServiceUnit srvUnit, ResourceUnit rescrUnit, Map<ResourceUnit, LoadReport> loadReports) {
+    public boolean canAssign() {

Review Comment:
   This method seems to be a partial work. Better not change it.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2314,7 +2314,8 @@ private void updateConfigurationAndRegisterListeners() {
         }
 
         // add listener to notify topic subscriptionTypesEnabled changed.
-        registerConfigurationListener("subscriptionTypesEnabled", this::updateBrokerSubscriptionTypesEnabled);
+        registerConfigurationListener("subscriptionTypesEnabled",

Review Comment:
   Personally, I am in favor of the previous version which save one anonymous lambda.



##########
pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java:
##########
@@ -77,7 +76,7 @@ public NamespaceBundleFactory(PulsarService pulsar, HashFunction hashFunc) {
 
         this.bundlesCache = Caffeine.newBuilder()
                 .recordStats()
-                .buildAsync(this::loadBundles);
+                .buildAsync((namespace, executor) -> loadBundles(namespace));

Review Comment:
   Same here.



-- 
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


[GitHub] [pulsar] Technoboy- commented on pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#issuecomment-1109292707

   > @Technoboy- what is the justification for cherry-picking this to release branches?
   
   This patch has changed the signature of the methods. If not cherry-pick to other branch, later to these related fixes will fail.
   @michaeljmarshall @gaozhangmin 


-- 
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


[GitHub] [pulsar] github-actions[bot] commented on pull request #15147: [cleanup] Remove unused fields in method

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#issuecomment-1097599981

   @gaozhangmin:Thanks for your contribution. For this PR, do we need to update docs?
   (The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)


-- 
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


[GitHub] [pulsar] Technoboy- commented on pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#issuecomment-1109366578

   > > @Technoboy- what is the justification for cherry-picking this to release branches?
   > 
   > This patch has changed the signature of the methods. If not cherry-pick to other branch, later to these related fixes will fail. @michaeljmarshall @gaozhangmin
   
   You are right @michaeljmarshall .


-- 
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


[GitHub] [pulsar] gaozhangmin closed pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
gaozhangmin closed pull request #15147: [cleanup] Remove unused parameters in method
URL: https://github.com/apache/pulsar/pull/15147


-- 
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


[GitHub] [pulsar] michaeljmarshall commented on pull request #15147: [cleanup] Remove unused parameters in method

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#issuecomment-1104715048

   @Technoboy- what is the justification for cherry-picking this to release branches?


-- 
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


[GitHub] [pulsar] github-actions[bot] commented on pull request #15147: [cleanup] Remove unused fields in method

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15147:
URL: https://github.com/apache/pulsar/pull/15147#issuecomment-1097602039

   @gaozhangmin:Thanks for providing doc info!


-- 
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