geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject geode git commit: GEODE-2277: reworked PDX type/enum logging to help identify source of issue
Date Fri, 06 Jan 2017 17:43:33 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2277 [created] fb36df219


GEODE-2277: reworked PDX type/enum logging to help identify source of issue


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/fb36df21
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/fb36df21
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/fb36df21

Branch: refs/heads/feature/GEODE-2277
Commit: fb36df21972708fe41fea5ffc72f36932e604121
Parents: 638b058
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Fri Jan 6 09:41:49 2017 -0800
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Fri Jan 6 09:41:49 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/geode/pdx/internal/EnumInfo.java   |  6 +++++-
 .../geode/pdx/internal/PeerTypeRegistration.java       | 13 +++++++++++++
 .../org/apache/geode/pdx/internal/TypeRegistry.java    |  5 ++++-
 3 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/fb36df21/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
index 0105f75..380ed73 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
@@ -58,7 +58,7 @@ public class EnumInfo implements DataSerializableFixedID {
   }
 
   public EnumInfo() {}
-
+  
   public int getDSFID() {
     return ENUM_INFO;
   }
@@ -158,6 +158,10 @@ public class EnumInfo implements DataSerializableFixedID {
     return clazz + "." + name;
   }
 
+  public String toFormattedString() {
+    return getClass().getSimpleName() + "[\n" + clazz + "." + name + "]";
+  }
+
   @Override
   public boolean equals(Object obj) {
     if (this == obj)

http://git-wip-us.apache.org/repos/asf/geode/blob/fb36df21/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
index 877bd48..cd09653 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
@@ -58,15 +58,19 @@ import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.TXManagerImpl;
 import org.apache.geode.internal.cache.TXStateProxy;
+import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.concurrent.CopyOnWriteHashMap;
 import org.apache.geode.pdx.JSONFormatter;
 import org.apache.geode.pdx.PdxInitializationException;
 import org.apache.geode.pdx.PdxRegistryMismatchException;
+import org.apache.logging.log4j.Logger;
 
 /**
  *
  */
 public class PeerTypeRegistration implements TypeRegistration {
+  private static final Logger logger = LogService.getLogger();
+
   /**
    * 
    */
@@ -174,6 +178,15 @@ public class PeerTypeRegistration implements TypeRegistration {
                   + event.getKey() + ", existing pdx type " + event.getOldValue() + ", new
type "
                   + event.getNewValue());
           throw new CacheWriterException(ex);
+        } else {
+          Object newValue = event.getNewValue();
+          if (newValue instanceof PdxType) {
+            logger.info("(CacheWriter) Adding type to PdxTypes: {}/{}", event.getKey(),
+                ((PdxType) event.getNewValue()).toFormattedString());
+          } else {
+            logger.info("(CacheWriter) Adding enum to PdxTypes: {}/{}", event.getKey(),
+                ((EnumInfo)newValue).toFormattedString());
+          }
         }
       }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/fb36df21/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
index ab03058..ebca878 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java
@@ -200,7 +200,7 @@ public class TypeRegistry {
       this.idToType.put(id, newType);
       this.typeToId.put(newType, id);
       if (logger.isInfoEnabled()) {
-        logger.info("Defining: {}", newType.toFormattedString());
+        logger.info("Caching {}", newType.toFormattedString());
       }
     } else if (!oldType.equals(newType)) {
       Assert.fail("Old type does not equal new type for the same id. oldType=" + oldType
@@ -392,6 +392,9 @@ public class TypeRegistry {
     if (oldInfo == null) {
       this.idToEnum.put(id, newInfo);
       this.enumInfoToId.put(newInfo, id);
+      if (logger.isInfoEnabled()) {
+        logger.info("Caching PDX Enum: {}, dsid={} typenum={}", newInfo, id >> 24,
id & 0xFFFFFF);
+      }
     } else if (!oldInfo.equals(newInfo)) {
       Assert.fail("Old enum does not equal new enum for the same id. oldEnum=" + oldInfo
           + " newEnum=" + newInfo);


Mime
View raw message