You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mc...@apache.org on 2018/10/16 22:41:23 UTC

[geode] branch develop updated: GEODE-5844: Make log format match args

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

mcmellawatt pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 567569b  GEODE-5844: Make log format match args
567569b is described below

commit 567569bb129d1d8acc0a709edf8b0f4e73be7c92
Author: Bill Burcham <bi...@gmail.com>
AuthorDate: Tue Oct 16 15:41:14 2018 -0700

    GEODE-5844: Make log format match args
---
 .../internal/cache/PartitionedRegionDataStore.java | 52 +++++++++-------------
 1 file changed, 22 insertions(+), 30 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
index a9c9104..8810d0c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
@@ -1230,40 +1230,32 @@ public class PartitionedRegionDataStore implements HasCachePerfStats {
     return UPDATE_ACCESS_TIME_ON_INTEREST && this.keysOfInterest.containsKey(event.getKey());
   }
 
-
-
   protected void updateMemoryStats(final long memoryDelta) {
-    // Update stats
     this.partitionedRegion.getPrStats().incBytesInUse(memoryDelta);
-
     final long locBytes = this.bytesInUse.addAndGet(memoryDelta);
 
-    if (!this.partitionedRegion.isEntryEvictionPossible()) {
-      String logStr = null;
-      // only check for exceeding local max memory if we're not evicting entries.
-      // TODO, investigate precision issues with cast to long
-      if (!this.exceededLocalMaxMemoryLimit) { // previously OK
-        if (locBytes > this.maximumLocalBytes) { // not OK now
-          this.exceededLocalMaxMemoryLimit = true;
-          logStr =
-              "Partitioned Region %s has exceeded local maximum memory configuration %s Mb, current size is %s Mb";
-        }
-      } else {
-        if (locBytes <= this.maximumLocalBytes) {
-          this.exceededLocalMaxMemoryLimit = false;
-          logStr =
-              "Partitioned Region %s is at or below local maximum memory configuration %s Mb, current size is %s Mb";
-        }
-      }
-      if (logStr != null) {
-        Object[] logArgs = new Object[] {this.partitionedRegion.getFullPath(), logStr,
-            Long.valueOf(this.partitionedRegion.getLocalMaxMemory()),
-            Long.valueOf(locBytes / PartitionedRegionHelper.BYTES_PER_MB)};
-        if (this.exceededLocalMaxMemoryLimit) {
-          logger.warn(String.format(logStr, logArgs));
-        } else {
-          logger.info(String.format(logStr, logArgs));
-        }
+    // only check for exceeding local max memory if we're not evicting entries.
+    if (this.partitionedRegion.isEntryEvictionPossible()) {
+      return;
+    }
+
+    if (this.exceededLocalMaxMemoryLimit) { // previously over limit
+      if (locBytes <= this.maximumLocalBytes) { // not over limit now
+        this.exceededLocalMaxMemoryLimit = false;
+        logger.info(
+            "Partitioned Region {} is at or below local maximum memory configuration {} Mb, current size is {} Mb",
+            this.partitionedRegion.getFullPath(),
+            this.partitionedRegion.getLocalMaxMemory(),
+            locBytes / PartitionedRegionHelper.BYTES_PER_MB);
+      }
+    } else { // previously not over limit
+      if (locBytes > this.maximumLocalBytes) { // over limit now
+        this.exceededLocalMaxMemoryLimit = true;
+        logger.warn(
+            "Partitioned Region {} has exceeded local maximum memory configuration {} Mb, current size is {} Mb",
+            this.partitionedRegion.getFullPath(),
+            this.partitionedRegion.getLocalMaxMemory(),
+            locBytes / PartitionedRegionHelper.BYTES_PER_MB);
       }
     }
   }