This is an automated email from the ASF dual-hosted git repository.

zhouky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d3ae318b [CELEBORN-665][FOLLOWUP] Skip empty app snapshot logs
5d3ae318b is described below

commit 5d3ae318bf292a3b812032e93101e3529d1cd7fc
Author: sychen <[email protected]>
AuthorDate: Fri Oct 27 09:50:43 2023 +0800

    [CELEBORN-665][FOLLOWUP] Skip empty app snapshot logs
    
    ### What changes were proposed in this pull request?
    
    ### Why are the changes needed?
    `topNItems` is never empty, but may be all null.
    
    ### Does this PR introduce _any_ user-facing change?
    
    ### How was this patch tested?
    
    Closes #2046 from cxzl25/CELEBORN-665_FOLLOWUP.
    
    Authored-by: sychen <[email protected]>
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 .../org/apache/celeborn/common/meta/AppDiskUsageMetric.scala   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
 
b/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
index 8dd2d97cd..46b7452d5 100644
--- 
a/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
+++ 
b/common/src/main/scala/org/apache/celeborn/common/meta/AppDiskUsageMetric.scala
@@ -143,7 +143,13 @@ class AppDiskUsageMetric(conf: CelebornConf) extends 
Logging {
           currentSnapShot.get().commit()
         }
         currentSnapShot.set(getNewSnapShot())
-        logInfo(s"App Disk Usage Top$usageCount Report ${summary()}")
+        val summaryStr = Some(summary()).map(str =>
+          if (str != null && str.nonEmpty) {
+            "\n" + str
+          } else {
+            str
+          }).getOrElse("")
+        logInfo(s"App Disk Usage Top$usageCount Report $summaryStr")
       }
     },
     60,
@@ -161,7 +167,7 @@ class AppDiskUsageMetric(conf: CelebornConf) extends 
Logging {
   def summary(): String = {
     val stringBuilder = new StringBuilder()
     for (i <- 0 until snapshotCount) {
-      if (snapShots(i) != null && snapShots(i).topNItems.length != 0) {
+      if (snapShots(i) != null && snapShots(i).topNItems.exists(_ != null)) {
         stringBuilder.append(snapShots(i))
         stringBuilder.append("    \n")
       }

Reply via email to