sijie closed pull request #1704: [table service][logging] improve logging at zk 
storage container manager
URL: https://github.com/apache/bookkeeper/pull/1704
 
 
   

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/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/sc/ZkStorageContainerManager.java
 
b/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/sc/ZkStorageContainerManager.java
index b6350fec17..f4fdc4d0d9 100644
--- 
a/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/sc/ZkStorageContainerManager.java
+++ 
b/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/sc/ZkStorageContainerManager.java
@@ -184,7 +184,9 @@ private boolean refreshMyAssignment() {
 
     private void processServersJoined(Set<Endpoint> serversJoined,
                                       Map<Endpoint, ServerAssignmentData> 
newAssignmentMap) {
-        log.info("Servers joined : {}", serversJoined);
+        if (!serversJoined.isEmpty()) {
+            log.info("Servers joined : {}", serversJoined);
+        }
         serversJoined.forEach(ep -> {
             ServerAssignmentData sad = newAssignmentMap.get(ep);
             if (null != sad) {
@@ -195,7 +197,9 @@ private void processServersJoined(Set<Endpoint> 
serversJoined,
 
     private void processServersLeft(Set<Endpoint> serversLeft,
                                     Map<Endpoint, ServerAssignmentData> 
oldAssignmentMap) {
-        log.info("Servers left : {}", serversLeft);
+        if (!serversLeft.isEmpty()) {
+            log.info("Servers left : {}", serversLeft);
+        }
         serversLeft.forEach(ep -> {
             ServerAssignmentData sad = oldAssignmentMap.get(ep);
             if (null != sad) {
@@ -246,9 +250,15 @@ private void processMyAssignment(ServerAssignmentData 
myAssignment) {
         containersToStop =
             Sets.filter(containersToStop, container -> 
!pendingStartStopContainers.contains(container));
 
-        log.info("Process container changes:\n\tIdeal = {}\n\tLive = {}\n\t"
-            + "Pending = {}\n\tToStart = {}\n\tToStop = {}",
-            assignedContainerSet, liveContainerSet, 
pendingStartStopContainers, containersToStart, containersToStop);
+        if (!containersToStart.isEmpty() || !containersToStop.isEmpty()) {
+            log.info("Process container changes:\n\tIdeal = {}\n\tLive = 
{}\n\t"
+                    + "Pending = {}\n\tToStart = {}\n\tToStop = {}",
+                assignedContainerSet,
+                liveContainerSet,
+                pendingStartStopContainers,
+                containersToStart,
+                containersToStop);
+        }
 
         containersToStart.forEach(this::startStorageContainer);
         containersToStop.forEach(this::stopStorageContainer);


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to