diff --git a/docs/_docs/cdc/change-data-capture-extensions.adoc b/docs/_docs/cdc/change-data-capture-extensions.adoc index 50e5ae60..91cf8095 100644 --- a/docs/_docs/cdc/change-data-capture-extensions.adoc +++ b/docs/_docs/cdc/change-data-capture-extensions.adoc @@ -193,19 +193,6 @@ Conflict resolution field should contain user provided monotonically increasing . If `conflictResolveField` if provided then field values comparison used to determine order. . Conflict resolution failed. Update will be ignored. -=== Conflict Resolver Metrics - -The Ignite's built-in `CacheVersionConflictResolverPluginProvider` provides the following metrics: - -[cols="35%,65%",opts="header"] -|=== -|Name |Description -| `AcceptedCount` | Count of accepted entries. -| `RejectedCount` | Count of rejected entries. -|=== - -These metrics are registered under `conflict-resolver` registry for each node configured with this plugin. - === Configuration example Configuration is done via Ignite node plugin: diff --git a/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheConflictResolutionManagerImpl.java b/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheConflictResolutionManagerImpl.java index 19d6c75c..0d4c8181 100644 --- a/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheConflictResolutionManagerImpl.java +++ b/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheConflictResolutionManagerImpl.java @@ -21,7 +21,6 @@ import org.apache.ignite.internal.processors.cache.CacheConflictResolutionManager; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.version.CacheVersionConflictResolver; -import org.apache.ignite.internal.processors.metric.MetricRegistryImpl; import org.apache.ignite.lang.IgniteFuture; /** @@ -31,9 +30,6 @@ * @see CacheVersionConflictResolver */ public class CacheConflictResolutionManagerImpl implements CacheConflictResolutionManager { - /** Conflict resolver metrics registry name. */ - public static final String CONFLICT_RESOLVER_METRICS_REGISTRY_NAME = "conflict-resolver"; - /** Logger. */ private IgniteLogger log; @@ -76,16 +72,13 @@ public CacheConflictResolutionManagerImpl( @Override public CacheVersionConflictResolver conflictResolver() { CacheVersionConflictResolver rslvr; - MetricRegistryImpl mreg = cctx.grid().context().metric().registry(CONFLICT_RESOLVER_METRICS_REGISTRY_NAME); - if (resolver != null) rslvr = resolver; else { rslvr = new CacheVersionConflictResolverImpl( clusterId, conflictResolveField, - conflictResolverLog, - mreg + conflictResolverLog ); } diff --git a/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheVersionConflictResolverImpl.java b/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheVersionConflictResolverImpl.java index fb60007f..1e275a7b 100644 --- a/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheVersionConflictResolverImpl.java +++ b/modules/cdc-ext/src/main/java/org/apache/ignite/cdc/conflictresolve/CacheVersionConflictResolverImpl.java @@ -23,8 +23,6 @@ import org.apache.ignite.internal.processors.cache.version.CacheVersionConflictResolver; import org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext; import org.apache.ignite.internal.processors.cache.version.GridCacheVersionedEntryEx; -import org.apache.ignite.internal.processors.metric.MetricRegistryImpl; -import org.apache.ignite.internal.processors.metric.impl.LongAdderMetric; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; @@ -44,18 +42,6 @@ * */ public class CacheVersionConflictResolverImpl implements CacheVersionConflictResolver { - /** Accepted entries count name. */ - public static final String ACCEPTED_EVENTS_CNT = "AcceptedCount"; - - /** Accepted entries count description. */ - public static final String ACCEPTED_EVENTS_CNT_DESC = "Count of accepted entries"; - - /** Rejected entries count name. */ - public static final String REJECTED_EVENTS_CNT = "RejectedCount"; - - /** Rejected entries count description. */ - public static final String REJECTED_EVENTS_CNT_DESC = "Count of rejected entries"; - /** * Cluster id. */ @@ -80,32 +66,21 @@ public class CacheVersionConflictResolverImpl implements CacheVersionConflictRes @GridToStringInclude protected final boolean conflictResolveFieldEnabled; - /** Accepted entries count. */ - private final LongAdderMetric acceptedCnt; - - /** Rejected entries count. */ - private final LongAdderMetric rejectedCnt; - /** * @param clusterId Data center id. * @param conflictResolveField Field to resolve conflicts. * @param log Logger. - * @param mreg Metric registry. */ public CacheVersionConflictResolverImpl( byte clusterId, String conflictResolveField, - IgniteLogger log, - MetricRegistryImpl mreg + IgniteLogger log ) { this.clusterId = clusterId; this.conflictResolveField = conflictResolveField; this.log = log; conflictResolveFieldEnabled = conflictResolveField != null; - - acceptedCnt = mreg.longAdderMetric(ACCEPTED_EVENTS_CNT, ACCEPTED_EVENTS_CNT_DESC); - rejectedCnt = mreg.longAdderMetric(REJECTED_EVENTS_CNT, REJECTED_EVENTS_CNT_DESC); } /** {@inheritDoc} */ @@ -122,14 +97,10 @@ public CacheVersionConflictResolverImpl( if (log.isDebugEnabled()) debugResolve(ctx, useNew, oldEntry, newEntry); - if (useNew) { + if (useNew) res.useNew(); - acceptedCnt.increment(); - } - else { + else res.useOld(); - rejectedCnt.increment(); - } return res; } diff --git a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsTest.java b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsTest.java index 6213abac..86ef675f 100644 --- a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsTest.java +++ b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsTest.java @@ -42,8 +42,6 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl; import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.processors.metric.MetricRegistryImpl; -import org.apache.ignite.internal.processors.metric.impl.LongAdderMetric; import org.apache.ignite.testframework.ListeningTestLogger; import org.apache.ignite.testframework.LogListener; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; @@ -56,9 +54,6 @@ import static java.util.Collections.singletonMap; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cdc.conflictresolve.CacheConflictResolutionManagerImpl.CONFLICT_RESOLVER_METRICS_REGISTRY_NAME; -import static org.apache.ignite.cdc.conflictresolve.CacheVersionConflictResolverImpl.ACCEPTED_EVENTS_CNT; -import static org.apache.ignite.cdc.conflictresolve.CacheVersionConflictResolverImpl.REJECTED_EVENTS_CNT; /** * Cache conflict operations test. @@ -264,22 +259,6 @@ public void testUpdatesConflict() throws Exception { putConflict(key, 5, conflictResolveField() != null); } - /** */ - @Test - public void testMetrics() throws Exception { - String key = key("UpdateClusterUpdateReorder", otherClusterId); - - checkMetrics(0, 0); - - putConflict(key, 1, true); - - checkMetrics(1, 0); - - putConflict(key, 1, false); - - checkMetrics(1, 1); - } - /** Test switching debug log level for ConflictResolver during runtime */ @Test public void testResolveDebug() throws Exception { @@ -392,15 +371,4 @@ private String key(String key, byte otherClusterId) { protected String conflictResolveField() { return null; } - - /** Checks metrics for conflict resolver. */ - protected void checkMetrics(int acceptedCnt, int rejectedCnt) { - MetricRegistryImpl mreg = ign.context().metric().registry(CONFLICT_RESOLVER_METRICS_REGISTRY_NAME); - - assertNotNull(mreg.findMetric(ACCEPTED_EVENTS_CNT)); - assertNotNull(mreg.findMetric(REJECTED_EVENTS_CNT)); - - assertEquals(acceptedCnt, ((LongAdderMetric)mreg.findMetric(ACCEPTED_EVENTS_CNT)).value()); - assertEquals(rejectedCnt, ((LongAdderMetric)mreg.findMetric(REJECTED_EVENTS_CNT)).value()); - } } diff --git a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsWithCustomResolverTest.java b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsWithCustomResolverTest.java index 3a42692b..24bd8489 100644 --- a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsWithCustomResolverTest.java +++ b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/CacheConflictOperationsWithCustomResolverTest.java @@ -51,13 +51,6 @@ public class CacheConflictOperationsWithCustomResolverTest extends CacheConflict GridTestUtils.assertThrows(log, super::testUpdatesConflict, AssertionError.class, ""); } - /** {@inheritDoc} */ - @Test - @Override public void testMetrics() throws Exception { - // LWW strategy resolves conflicts in unexpected way at versioned resolve test. - GridTestUtils.assertThrows(log, super::testMetrics, AssertionError.class, ""); - } - /** {@inheritDoc} */ @Test @Override public void testResolveDebug() throws Exception { @@ -82,9 +75,4 @@ private static final class LwwConflictResolver implements CacheVersionConflictRe return res; } } - - /** {@inheritDoc} */ - @Override protected void checkMetrics(int acceptedCnt, int rejectedCnt) { - // No op. - } }