You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sb...@apache.org on 2015/09/23 18:38:34 UTC
incubator-geode git commit: GEODE-354 Do not deserialize values for
displaying/throwing CommitConflictException.
Repository: incubator-geode
Updated Branches:
refs/heads/develop 8a5920d51 -> eb896614e
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/develop
Commit: eb896614ee1a754ecf46500d471c517dbd0282b2
Parents: 8a5920d
Author: Swapnil Bawaskar <sb...@pivotal.io>
Authored: Tue Sep 22 07:30:30 2015 -0700
Committer: Swapnil Bawaskar <sb...@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);