geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [05/50] [abbrv] incubator-geode git commit: GEODE-354 Do not deserialize values for displaying/throwing CommitConflictException.
Date Fri, 16 Oct 2015 20:41:46 GMT
GEODE-354 Do not deserialize values for displaying/throwing CommitConflictException.

By default do not log/throw CommitConflictException with string representation of values.
Adding a System property gemfire.verboseConflictString, which along with DEBUG level logs,
will convert values to string on CommitConflictException.


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

Branch: refs/heads/feature/GEODE-291
Commit: eb896614ee1a754ecf46500d471c517dbd0282b2
Parents: 8a5920d
Author: Swapnil Bawaskar <sbawaskar@pivotal.io>
Authored: Tue Sep 22 07:30:30 2015 -0700
Committer: Swapnil Bawaskar <sbawaskar@pivotal.io>
Committed: Wed Sep 23 09:37:52 2015 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/TXEntryState.java     | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eb896614/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXEntryState.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXEntryState.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXEntryState.java
index 0d44686..51e4755 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXEntryState.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/TXEntryState.java
@@ -236,6 +236,11 @@ public class TXEntryState implements Releasable
   private transient DistTxThinEntryState distTxThinEntryState;
   
   /**
+   * Use this system property if you need to display/log string values in conflict messages
+   */
+  private static final boolean VERBOSE_CONFLICT_STRING = Boolean.getBoolean("gemfire.verboseConflictString");
+
+  /**
    * This constructor is used to create a singleton used by LocalRegion to
    * signal that noop invalidate op has been performed. The instance returned by
    * this constructor is just a marker; it is not good for anything else.
@@ -1511,14 +1516,14 @@ public class TXEntryState implements Releasable
         //           curCmtVersionId =
         // ((CachedDeserializable)curCmtVersionId).getDeserializedValue();
         //         }
-        String fromString = calcConflictString(getOriginalVersionId());
-        String toString = calcConflictString(curCmtVersionId);
-        if (fromString.equals(toString)) {
-          throw new CommitConflictException(LocalizedStrings.TXEntryState_ENTRY_FOR_KEY_0_ON_REGION_1_HAD_A_STATE_CHANGE.toLocalizedString(new
Object[] {key, r.getDisplayName()}));
-        }
-        else {
-          throw new CommitConflictException(LocalizedStrings.TXEntryState_ENTRY_FOR_KEY_0_ON_REGION_1_HAD_ALREADY_BEEN_CHANGED_FROM_2_TO_3.toLocalizedString(new
Object[] {key, r.getDisplayName(), fromString, toString}));
+        if (VERBOSE_CONFLICT_STRING || logger.isDebugEnabled()) {
+          String fromString = calcConflictString(getOriginalVersionId());
+          String toString = calcConflictString(curCmtVersionId);
+          if (!fromString.equals(toString)) {
+            throw new CommitConflictException(LocalizedStrings.TXEntryState_ENTRY_FOR_KEY_0_ON_REGION_1_HAD_ALREADY_BEEN_CHANGED_FROM_2_TO_3.toLocalizedString(new
Object[] {key, r.getDisplayName(), fromString, toString}));
+          }
         }
+        throw new CommitConflictException(LocalizedStrings.TXEntryState_ENTRY_FOR_KEY_0_ON_REGION_1_HAD_A_STATE_CHANGE.toLocalizedString(new
Object[]{key, r.getDisplayName()}));
       }
       } finally {
         OffHeapHelper.release(curCmtVersionId);


Mime
View raw message