pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] merlimat closed pull request #895: Add debug logs for LoadManager and cleanup unncessary logs
Date Thu, 01 Jan 1970 00:00:00 GMT
merlimat closed pull request #895: Add debug logs for LoadManager and cleanup unncessary logs
URL: https://github.com/apache/incubator-pulsar/pull/895
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
index afe274572..1c8ad8099 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
@@ -56,7 +56,7 @@
     private ZooKeeperDataCache<NamespaceIsolationPolicies> namespaceIsolationPoliciesCache;
 
     public static final String POLICIES = "policies";
-    protected static final String POLICIES_ROOT = "/admin/policies";
+    public static final String POLICIES_ROOT = "/admin/policies";
     private static final String CLUSTERS_ROOT = "/admin/clusters";
 
     public ConfigurationCacheService(ZooKeeperCache cache) throws PulsarServerException {
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
index 4ccd7922b..0e9539f70 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java
@@ -24,6 +24,7 @@
 import org.apache.bookkeeper.conf.ClientConfiguration;
 import org.apache.bookkeeper.meta.HierarchicalLedgerManagerFactory;
 import org.apache.bookkeeper.util.ZkUtils;
+import static org.apache.pulsar.broker.cache.ConfigurationCacheService.POLICIES_ROOT;
 import org.apache.pulsar.common.policies.data.ClusterData;
 import org.apache.pulsar.common.util.ObjectMapperFactory;
 import org.apache.pulsar.zookeeper.ZooKeeperClientFactory;
@@ -110,7 +111,7 @@ public static void main(String[] args) throws Exception {
         localZk.create("/namespace", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 
         try {
-            ZkUtils.createFullPathOptimistic(globalZk, "/admin/policies", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE,
+            ZkUtils.createFullPathOptimistic(globalZk, POLICIES_ROOT, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE,
                     CreateMode.PERSISTENT);
         } catch (NodeExistsException e) {
             // Ignore
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
index 22dab007d..00033bcda 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
@@ -35,6 +35,7 @@
 
 import org.apache.bookkeeper.mledger.ManagedLedgerFactory;
 import org.apache.bookkeeper.util.OrderedSafeExecutor;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 import org.apache.pulsar.broker.admin.AdminResource;
 import org.apache.pulsar.broker.cache.ConfigurationCacheService;
 import org.apache.pulsar.broker.cache.LocalZooKeeperCacheService;
@@ -338,7 +339,8 @@ public synchronized void brokerIsAFollowerNow() {
             acquireSLANamespace();
 
             LOG.info("messaging service is ready, bootstrap service on port={}, broker url={},
cluster={}, configs={}",
-                    config.getWebServicePort(), brokerServiceUrl, config.getClusterName(),
config);
+                    config.getWebServicePort(), brokerServiceUrl, config.getClusterName(),
+                    ReflectionToStringBuilder.toString(config));
         } catch (Exception e) {
             LOG.error(e.getMessage(), e);
             throw new PulsarServerException(e);
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/TimeAverageBrokerData.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/TimeAverageBrokerData.java
index 05f93a890..ec298beec 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/TimeAverageBrokerData.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/TimeAverageBrokerData.java
@@ -24,6 +24,8 @@
 import org.apache.pulsar.policies.data.loadbalancer.JSONWritable;
 import org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats;
 
+import com.google.common.base.Objects;
+
 /**
  * Data class aggregating the short term and long term data across all bundles belonging
to a broker.
  */
@@ -169,4 +171,14 @@ public double getLongTermMsgRateOut() {
     public void setLongTermMsgRateOut(double longTermMsgRateOut) {
         this.longTermMsgRateOut = longTermMsgRateOut;
     }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(this).add("shortTermMsgThroughputIn", shortTermMsgThroughputIn)
+                .add("shortTermMsgThroughputOut", shortTermMsgThroughputOut)
+                .add("shortTermMsgRateIn", shortTermMsgRateIn).add("shortTermMsgRateOut",
shortTermMsgRateOut)
+                .add("longTermMsgThroughputIn", longTermMsgThroughputIn)
+                .add("longTermMsgThroughputOut", longTermMsgThroughputOut).add("longTermMsgRateIn",
longTermMsgRateIn)
+                .add("longTermMsgRateOut", longTermMsgRateOut).toString();
+    }
 }
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
index 7332eadb0..84859a116 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
@@ -187,9 +187,6 @@ public void validatePoliciesReadOnlyAccess() {
      */
     protected List<String> getListOfNamespaces(String property) throws Exception {
         List<String> namespaces = Lists.newArrayList();
-        // First get the list of cluster nodes
-        log.info("Children of {} : {}", path(POLICIES, property),
-                globalZk().getChildren(path(POLICIES, property), null));
 
         for (String cluster : globalZk().getChildren(path(POLICIES, property), false)) {
             // Then get the list of namespaces
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
index 021bb18cf..4790de497 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
@@ -421,6 +421,9 @@ private boolean needBrokerDataUpdate() {
 
     // Update both the broker data and the bundle data.
     private void updateAll() {
+        if (log.isDebugEnabled()) {
+            log.debug("Updating broker and bundle data for loadreport");
+        }
         updateAllBrokerData();
         updateBundleData();
         // broker has latest load-report: check if any bundle requires split
@@ -678,6 +681,9 @@ public String selectBrokerForAssignment(final ServiceUnitId serviceUnit)
{
 
             // Choose a broker among the potentially smaller filtered list, when possible
             String broker = placementStrategy.selectBroker(brokerCandidateCache, data, loadData,
conf);
+            if (log.isDebugEnabled()) {
+                log.debug("Selected broker {} from candidate brokers {}", broker, brokerCandidateCache);
+            }
 
             final double overloadThreshold = conf.getLoadBalancerBrokerOverloadedThresholdPercentage()
/ 100.0;
             final double maxUsage = loadData.getBrokerData().get(broker).getLocalData().getMaxResourceUsage();
@@ -825,6 +831,9 @@ public void writeBundleDataOnZooKeeper() {
                 final String zooKeeperPath = TIME_AVERAGE_BROKER_ZPATH + "/" + broker;
                 createZPathIfNotExists(zkClient, zooKeeperPath);
                 zkClient.setData(zooKeeperPath, data.getJsonBytes(), -1);
+                if (log.isDebugEnabled()) {
+                    log.debug("Writing zookeeper report {}", data);
+                }
             } catch (Exception e) {
                 log.warn("Error when writing time average broker data for {} to ZooKeeper:
{}", broker, e);
             }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message