Skip to content

Commit

Permalink
IGNITE-22080 Fix ConflictResolver fails on debug logging (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
timoninmaxim authored Apr 19, 2024
2 parents af7fdb0 + 88236ca commit d369228
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class CacheVersionConflictResolverImpl implements CacheVersionConflictRes
* @see CacheVersionConflictResolverImpl
*/
@GridToStringInclude
private final String conflictResolveField;
protected final String conflictResolveField;

/** Logger. */
protected final IgniteLogger log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public DebugCacheVersionConflictResolverImpl(byte clusterId, String conflictReso
Object newVal = conflictResolveFieldEnabled ? newEntry.value(ctx) : null;

if (oldVal != null)
oldVal = value(oldVal);
oldVal = debugValue(oldVal);

if (newVal != null)
newVal = value(newVal);
newVal = debugValue(newVal);

log.debug("isUseNew[" +
"start=" + oldEntry.isStartVersion() +
Expand All @@ -63,6 +63,18 @@ public DebugCacheVersionConflictResolverImpl(byte clusterId, String conflictReso
return res;
}

/** @return Conflict resolve field value, or specified {@code val} if the field not found. */
private Object debugValue(Object val) {
try {
return super.value(val);
}
catch (Exception e) {
log.debug("Can't resolve field value [field=" + conflictResolveField + ", val=" + val + ']');

return val;
}
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheVersionConflictResolverImpl.class, this);
Expand Down

0 comments on commit d369228

Please sign in to comment.