From 2d4268174753db8e89d020f906d04cbfc85a8930 Mon Sep 17 00:00:00 2001 From: zstan Date: Tue, 17 Mar 2026 16:41:17 +0300 Subject: [PATCH] IGNITE-28277 Append additional tests for CacheInterceptor#onBeforePut --- .../query/calcite/exec/rel/HashJoinNode.java | 2 +- .../query/calcite/exec/rel/ModifyNode.java | 15 +- .../processors/query/calcite/CancelTest.java | 2 +- .../CacheWithInterceptorIntegrationTest.java | 212 ++++++++++++++++++ .../tx/TxWithExceptionalInterceptorTest.java | 7 + .../testsuites/IntegrationTestSuite.java | 4 +- .../discovery/GridDiscoveryManager.java | 2 +- .../cache/CacheOperationContext.java | 19 ++ .../processors/cache/GridCacheAdapter.java | 22 ++ .../processors/cache/GridCacheProxyImpl.java | 4 +- .../processors/cache/IgniteInternalCache.java | 3 + .../dht/atomic/GridDhtAtomicCache.java | 2 +- ...CacheContinuousQueryPartitionRecovery.java | 2 +- .../processors/job/GridJobWorker.java | 2 +- .../internal/util/BasicRateLimiter.java | 2 +- .../org.apache.ignite.plugin.PluginProvider | 2 +- .../CacheKeepBinaryWithInterceptorTest.java | 49 ++-- .../IgniteStandByClusterTest.java | 8 +- .../cache/SqlFieldsQuerySelfTest.java | 3 - .../query/SqlSystemViewsSelfTest.java | 2 +- .../query/stat/PSUStatisticsTypesTest.java | 2 +- 21 files changed, 318 insertions(+), 48 deletions(-) create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinNode.java index c3731b260377d..0158abb25b0b6 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinNode.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinNode.java @@ -394,7 +394,7 @@ private AbstractMatchingHashJoin( private void downstreamPush(Row left, Row right) throws Exception { requested--; - downstream().push(outRowFactory.apply(left, right));; + downstream().push(outRowFactory.apply(left, right)); } /** {@inheritDoc} */ diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java index 650a775514d2e..76220c84251fe 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java @@ -31,9 +31,10 @@ import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.cache.context.SessionContextImpl; import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCacheProxyImpl; +import org.apache.ignite.internal.processors.cache.IgniteInternalCache; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; import org.apache.ignite.internal.processors.query.IgniteSQLException; +import org.apache.ignite.internal.processors.query.QueryProperties; import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext; import org.apache.ignite.internal.processors.query.calcite.schema.CacheTableDescriptor; import org.apache.ignite.internal.processors.query.calcite.schema.ModifyTuple; @@ -200,9 +201,15 @@ private void flushTuples(boolean force) throws IgniteCheckedException { this.tuples = new ArrayList<>(MODIFY_BATCH_SIZE); GridCacheContext cctx = desc.cacheContext(); - GridCacheProxyImpl cache = cctx.cache().keepBinary(); + IgniteInternalCache cache = cctx.cache(); GridNearTxLocal tx = Commons.queryTransaction(context(), cctx.shared()); + QueryProperties props = context().unwrap(QueryProperties.class); + boolean keepBinaryMode = props == null || props.keepBinary(); + + if (keepBinaryMode) + cache = cache.keepBinary(); + if (tx == null) invokeOutsideTransaction(tuples, cache); else @@ -217,7 +224,7 @@ private void flushTuples(boolean force) throws IgniteCheckedException { */ private void invokeOutsideTransaction( List tuples, - GridCacheProxyImpl cache + IgniteInternalCache cache ) throws IgniteCheckedException { SessionContextImpl sesCtx = context().unwrap(SessionContextImpl.class); Map sesAttrs = sesCtx == null ? null : sesCtx.attributes(); @@ -251,7 +258,7 @@ private void invokeOutsideTransaction( */ private void invokeInsideTransaction( List tuples, - GridCacheProxyImpl cache, + IgniteInternalCache cache, GridNearTxLocal userTx ) throws IgniteCheckedException { userTx.resume(); diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java index 77e8dc5f0fd1e..4e78cbe40fd64 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java @@ -72,7 +72,7 @@ public class CancelTest extends GridCommonAbstractTest { .setKeyFieldName("id") .setValueFieldName("val") .addQueryField("id", Integer.class.getName(), null) - .addQueryField("val", String.class.getName(), null);; + .addQueryField("val", String.class.getName(), null); return super.getConfiguration(igniteInstanceName) .setCacheConfiguration( diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java new file mode 100644 index 0000000000000..9940dcadadec7 --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java @@ -0,0 +1,212 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.query.calcite.integration; + +import java.util.Collection; +import java.util.List; +import javax.cache.Cache; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.binary.BinaryObject; +import org.apache.ignite.cache.CacheInterceptorAdapter; +import org.apache.ignite.cache.QueryEntity; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.SqlConfiguration; +import org.apache.ignite.configuration.TransactionConfiguration; +import org.apache.ignite.internal.util.tostring.GridToStringInclude; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.apache.ignite.transactions.Transaction; +import org.jetbrains.annotations.Nullable; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; +import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; +import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; + +/** Cache interceptor related tests. */ +@RunWith(Parameterized.class) +public class CacheWithInterceptorIntegrationTest extends GridCommonAbstractTest { + /** Node role. */ + @Parameterized.Parameter(0) + public boolean keepBinary; + + /** */ + @Parameterized.Parameters(name = "keepBinary={0}") + public static Collection parameters() { + return List.of(true, false); + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(true); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + var entity0 = new QueryEntity() + .setTableName("Pure") + .setKeyType(Integer.class.getName()) + .setValueType(String.class.getName()) + .addQueryField("id", Integer.class.getName(), null) + .addQueryField("name", String.class.getName(), null) + .setKeyFieldName("id") + .setValueFieldName("name"); + + var entity1 = new QueryEntity() + .setTableName("CITY") + .setKeyType(Integer.class.getName()) + .setValueType(City.class.getName()) + .addQueryField("id", Integer.class.getName(), null) + .addQueryField("name", String.class.getName(), null) + .setKeyFieldName("id"); + + var entity2 = new QueryEntity() + .setTableName("PERSON") + .setKeyType(Integer.class.getName()) + .setValueType(Person.class.getName()) + .addQueryField("id", Integer.class.getName(), null) + .addQueryField("name", String.class.getName(), null) + .addQueryField("city_id", Integer.class.getName(), null) + .setKeyFieldName("id"); + + var cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME) + .setAtomicityMode(TRANSACTIONAL) + .setSqlSchema("PUBLIC") + .setInterceptor(new TestCacheInterceptor(keepBinary)) + .setQueryEntities(List.of(entity1, entity2)); + + var pureCacheCfg = new CacheConfiguration("Pure") + .setAtomicityMode(TRANSACTIONAL) + .setSqlSchema("PUBLIC") + .setInterceptor(new TestAlwaysUnwrappedValCacheInterceptor()) + .setQueryEntities(List.of(entity0)); + + var calciteQryEngineCfg = new CalciteQueryEngineConfiguration().setDefault(true); + + return super.getConfiguration(igniteInstanceName) + .setSqlConfiguration(new SqlConfiguration().setQueryEnginesConfiguration(calciteQryEngineCfg)) + .setTransactionConfiguration(new TransactionConfiguration().setTxAwareQueriesEnabled(true)) + .setCacheConfiguration(cacheCfg, pureCacheCfg); + } + + /** Test object unwrapped on interceptor side if applicable. */ + @Test + public void testInterceptorUnwrapValIfNeeded() throws Exception { + startGrid(0); + Ignite client = startClientGrid("client"); + + IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); + + if (keepBinary) + cache = cache.withKeepBinary(); + + int incParam = 0; + + try (Transaction tx = client.transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { + cache.query(new SqlFieldsQuery("insert into PUBLIC.PURE(id, name) values (?, 'val')").setArgs(incParam++)).getAll(); + cache.query(new SqlFieldsQuery("insert into PUBLIC.CITY(id, name) values (?, 'val')").setArgs(incParam++)).getAll(); + cache.query(new SqlFieldsQuery("insert into PUBLIC.PERSON(id, name, city_id) values (?, 'val', 1)").setArgs(incParam++)) + .getAll(); + + tx.commit(); + } + + cache.query(new SqlFieldsQuery("insert into PUBLIC.PURE(id, name) values (?, 'val')").setArgs(incParam++)).getAll(); + cache.query(new SqlFieldsQuery("insert into PUBLIC.CITY(id, name) values (?, 'val')").setArgs(incParam++)).getAll(); + cache.query(new SqlFieldsQuery("insert into PUBLIC.PERSON(id, name, city_id) values (?, 'val', 1)").setArgs(incParam)).getAll(); + } + + /** */ + private static class City { + /** */ + @GridToStringInclude + int id; + + /** */ + @GridToStringInclude + String name; + + /** */ + City(int id, String name) { + this.id = id; + this.name = name; + } + } + + /** */ + private static class Person { + /** */ + @GridToStringInclude + int id; + + /** */ + @GridToStringInclude + String name; + + /** */ + @GridToStringInclude + int city_id; + + /** */ + Person(int id, String name, int city_id) { + this.id = id; + this.name = name; + this.city_id = city_id; + } + } + + /** */ + private static class TestAlwaysUnwrappedValCacheInterceptor extends CacheInterceptorAdapter { + /** {@inheritDoc} */ + @Override public @Nullable Object onBeforePut(Cache.Entry entry, Object newVal) { + assertFalse(newVal instanceof BinaryObject); + + return newVal; + } + } + + /** */ + private static class TestCacheInterceptor extends CacheInterceptorAdapter { + /** */ + private final boolean keepBinary; + + /** + * @param keepBinary Keep binary defines flag. + */ + TestCacheInterceptor(boolean keepBinary) { + this.keepBinary = keepBinary; + } + + /** {@inheritDoc} */ + @Override public @Nullable Object onBeforePut(Cache.Entry entry, Object newVal) { + if (keepBinary) + assertTrue(newVal instanceof BinaryObject); + else + assertFalse(newVal instanceof BinaryObject); + + return newVal; + } + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java index b3aa281a82ba6..1c6731832f4cd 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java @@ -117,6 +117,13 @@ public static Collection parameters() { exceptionRaised.set(0); } + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(true); + } + /** */ private static class FilterDefinedNode implements IgnitePredicate { /** */ diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java index 9326c647854b8..07d7114d98e21 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java +++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java @@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.query.calcite.integration.AggregatesIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.AuthorizationIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.CacheStoreTest; +import org.apache.ignite.internal.processors.query.calcite.integration.CacheWithInterceptorIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.CalciteBasicSecondaryIndexIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.CalciteErrorHandlilngIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.CalcitePlanningDumpTest; @@ -174,7 +175,8 @@ QueryEntityValueColumnAliasTest.class, CacheStoreTest.class, MultiDcQueryMappingTest.class, - TxWithExceptionalInterceptorTest.class + TxWithExceptionalInterceptorTest.class, + CacheWithInterceptorIntegrationTest.class }) public class IntegrationTestSuite { } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 8c5564616d487..1794fbf1580a1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -3062,7 +3062,7 @@ else if (type == EVT_CLIENT_NODE_RECONNECTED) evt.message("Client node reconnected"); else - assert false : "Unexpected discovery message type: " + type;; + assert false : "Unexpected discovery message type: " + type; ctx.event().record(evt, discoCache); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java index e701ae5a93f8b..b6470c60edc15 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache; import java.io.Serializable; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.cache.expiry.ExpiryPolicy; @@ -181,6 +182,24 @@ public boolean skipReadThrough() { return skipReadThrough; } + /** + * See {@link IgniteInternalCache#withApplicationAttributes(Map)}. + * + * @return New instance of CacheOperationContext with new application attributes. + */ + public CacheOperationContext withApplicationAttributes(Map attrs) { + return new CacheOperationContext( + skipStore, + skipReadThrough, + keepBinary, + expiryPlc, + noRetries, + dataCenterId, + recovery, + readRepairStrategy, + Collections.unmodifiableMap(attrs)); + } + /** * See {@link IgniteInternalCache#withSkipReadThrough()}. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index b13161079eb1d..5c91859b1dc9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -504,6 +504,28 @@ public void active(boolean active) { return new GridCacheProxyImpl<>(this.ctx, this, opCtx); } + /** @return New internal cache instance based on this one, but with application attributes. */ + @Override public GridCacheProxyImpl withApplicationAttributes(Map attrs) { + CacheOperationContext opCtx = ctx.operationContextPerCall(); + + if (opCtx == null) { + opCtx = new CacheOperationContext( + false, + false, + false, + null, + false, + null, + false, + null, + new HashMap<>(attrs)); + } + else + opCtx = opCtx.withApplicationAttributes(attrs); + + return new GridCacheProxyImpl<>(ctx, this, opCtx); + } + /** {@inheritDoc} */ @Override public final GridCacheProxyImpl keepBinary() { CacheOperationContext opCtx = new CacheOperationContext( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java index 4c51863f3936c..d06f64e039a77 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java @@ -303,7 +303,7 @@ public IgniteInternalCache delegate() { } /** @return New internal cache instance based on this one, but with application attributes. */ - public GridCacheProxyImpl withApplicationAttributes(Map attrs) { + @Override public GridCacheProxyImpl withApplicationAttributes(Map attrs) { CacheOperationContext prev = gate.enter(opCtx); try { @@ -311,7 +311,7 @@ public GridCacheProxyImpl withApplicationAttributes(Map at opCtx != null ? opCtx.setApplicationAttributes(attrs) : new CacheOperationContext( false, - true, + false, false, null, false, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java index f5b50d8f03566..50bdf4efe97eb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java @@ -230,6 +230,9 @@ public interface IgniteInternalCache extends Iterable> { /** @return New internal cache instance based on this one, but with skip read-through cache store flag enabled. */ public IgniteInternalCache withSkipReadThrough(); + /** @return New internal cache instance based on this one, but with application attributes. */ + public IgniteInternalCache withApplicationAttributes(Map attrs); + /** * Creates projection that will operate with binary objects. *

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index 919199ec48ce5..0a4ace0489250 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -1805,7 +1805,7 @@ private void updateAllAsyncInternal0( // If batch store update is enabled, we need to lock all entries. // First, need to acquire locks on cache entries, then check filter. - List locked = lockEntries(req, req.topologyVersion());; + List locked = lockEntries(req, req.topologyVersion()); Collection> deleted = null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryPartitionRecovery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryPartitionRecovery.java index 0b43c82188d98..a2b682109806c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryPartitionRecovery.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryPartitionRecovery.java @@ -227,7 +227,7 @@ void resetTopologyCache() { long filtered = pending.filteredCount(); - boolean fire = e.getKey() == lastFiredEvt + 1;; + boolean fire = e.getKey() == lastFiredEvt + 1; if (!fire && filtered > 0) fire = e.getKey() - filtered <= lastFiredEvt + 1; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java index b59fd5b15da55..1ab5b7f1e4f31 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java @@ -543,7 +543,7 @@ private void execute0(boolean skipNtf) { IgniteException ex = new IgniteException("Failed to lock partitions " + "[jobId=" + ses.getJobId() + ", ses=" + ses + ']', e); - U.error(log, "Failed to lock partitions [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);; + U.error(log, "Failed to lock partitions [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e); finishJob(null, ex, true); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/BasicRateLimiter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/BasicRateLimiter.java index 861c72a27e07c..d70c2846bf2e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/BasicRateLimiter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/BasicRateLimiter.java @@ -171,7 +171,7 @@ private long resync() { long idleTime = passed - nextFreeTicketNanos; // This is the number of permits we can give for free because we've been inactive longer than expected. - storedPermits = idleTime > MAX_IDLE_TIMEOUT ? 0 : min(getRate(), storedPermits + (idleTime / stableIntervalNanos));; + storedPermits = idleTime > MAX_IDLE_TIMEOUT ? 0 : min(getRate(), storedPermits + (idleTime / stableIntervalNanos)); nextFreeTicketNanos = passed; } diff --git a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider index 7704c0b7490f2..b243818255b14 100644 --- a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider +++ b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider @@ -1,4 +1,4 @@ -org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StanByClusterTestProvider +org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StandByClusterTestProvider org.apache.ignite.internal.processors.cache.persistence.wal.memtracker.PageMemoryTrackerPluginProvider org.apache.ignite.internal.processors.configuration.distributed.TestDistibutedConfigurationPlugin org.apache.ignite.plugin.NodeValidationPluginProvider diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java index 4a7b4ac9bd232..d238543276813 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java @@ -73,11 +73,11 @@ private void keepBinaryWithInterceptor(CacheConfiguration ccfg) { ignite(0).createCache(ccfg); try { - TestInterceptor1.onAfterRmv = 0; - TestInterceptor1.onBeforeRmv = 0; - TestInterceptor1.onAfterPut = 0; - TestInterceptor1.onBeforePut = 0; - TestInterceptor1.onGet = 0; + TestBOInterceptor.onAfterRmv = 0; + TestBOInterceptor.onBeforeRmv = 0; + TestBOInterceptor.onAfterPut = 0; + TestBOInterceptor.onBeforePut = 0; + TestBOInterceptor.onGet = 0; IgniteCache cache = ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary(); @@ -106,11 +106,11 @@ private void keepBinaryWithInterceptor(CacheConfiguration ccfg) { assertTrue(cache.remove(new TestKey(1))); - assertTrue(TestInterceptor1.onAfterRmv > 0); - assertTrue(TestInterceptor1.onBeforeRmv > 0); - assertTrue(TestInterceptor1.onAfterPut > 0); - assertTrue(TestInterceptor1.onBeforePut > 0); - assertTrue(TestInterceptor1.onGet > 0); + assertTrue(TestBOInterceptor.onAfterRmv > 0); + assertTrue(TestBOInterceptor.onBeforeRmv > 0); + assertTrue(TestBOInterceptor.onAfterPut > 0); + assertTrue(TestBOInterceptor.onBeforePut > 0); + assertTrue(TestBOInterceptor.onGet > 0); } finally { ignite(0).destroyCache(ccfg.getName()); @@ -124,11 +124,11 @@ private void keepBinaryWithInterceptorPrimitives(CacheConfiguration ccfg) { ignite(0).createCache(ccfg); try { - TestInterceptor2.onAfterRmv = 0; - TestInterceptor2.onBeforeRmv = 0; - TestInterceptor2.onAfterPut = 0; - TestInterceptor2.onBeforePut = 0; - TestInterceptor2.onGet = 0; + TestTypeSpecifiedInterceptor.onAfterRmv = 0; + TestTypeSpecifiedInterceptor.onBeforeRmv = 0; + TestTypeSpecifiedInterceptor.onAfterPut = 0; + TestTypeSpecifiedInterceptor.onBeforePut = 0; + TestTypeSpecifiedInterceptor.onGet = 0; IgniteCache cache = ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary(); @@ -157,11 +157,11 @@ private void keepBinaryWithInterceptorPrimitives(CacheConfiguration ccfg) { assertTrue(cache.remove(1)); - assertTrue(TestInterceptor2.onAfterRmv > 0); - assertTrue(TestInterceptor2.onBeforeRmv > 0); - assertTrue(TestInterceptor2.onAfterPut > 0); - assertTrue(TestInterceptor2.onBeforePut > 0); - assertTrue(TestInterceptor2.onGet > 0); + assertTrue(TestTypeSpecifiedInterceptor.onAfterRmv > 0); + assertTrue(TestTypeSpecifiedInterceptor.onBeforeRmv > 0); + assertTrue(TestTypeSpecifiedInterceptor.onAfterPut > 0); + assertTrue(TestTypeSpecifiedInterceptor.onBeforePut > 0); + assertTrue(TestTypeSpecifiedInterceptor.onGet > 0); } finally { ignite(0).destroyCache(ccfg.getName()); @@ -177,7 +177,7 @@ private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode, CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setAtomicityMode(atomicityMode); - ccfg.setInterceptor(testPrimitives ? new TestInterceptor2() : new TestInterceptor1()); + ccfg.setInterceptor(testPrimitives ? new TestTypeSpecifiedInterceptor() : new TestBOInterceptor()); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setBackups(1); @@ -187,7 +187,7 @@ private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode, /** * */ - static class TestInterceptor1 implements CacheInterceptor { + static class TestBOInterceptor implements CacheInterceptor { /** */ static int onGet; @@ -266,7 +266,7 @@ static class TestInterceptor1 implements CacheInterceptor { + static class TestTypeSpecifiedInterceptor implements CacheInterceptor { /** */ static int onGet; @@ -379,7 +379,8 @@ public TestKey(int key) { */ static class TestValue { /** */ - private int val; + @SuppressWarnings("unused") + private final int val; /** * @param val Value. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java index 22daaa9041232..acc93e7dd4e4c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java @@ -300,11 +300,11 @@ public void testActivateDeActivateCallbackForPluginProviders() throws Exception * @param deAct Expected deActivation counter. */ private void checkPlugin(Ignite ig, int act, int deAct) { - IgnitePlugin pl = ig.plugin(StanByClusterTestProvider.NAME); + IgnitePlugin pl = ig.plugin(StandByClusterTestProvider.NAME); assertNotNull(pl); - StanByClusterTestProvider plugin = (StanByClusterTestProvider)pl; + StandByClusterTestProvider plugin = (StandByClusterTestProvider)pl; assertEquals(act, plugin.actCnt.get()); assertEquals(deAct, plugin.deActCnt.get()); @@ -333,10 +333,10 @@ private NodeFilterIgnoreByName(String name) { /** * */ - public static class StanByClusterTestProvider extends AbstractTestPluginProvider implements IgnitePlugin, + public static class StandByClusterTestProvider extends AbstractTestPluginProvider implements IgnitePlugin, IgniteChangeGlobalStateSupport { /** */ - static final String NAME = "StanByClusterTestProvider"; + static final String NAME = "StandByClusterTestProvider"; /** */ final AtomicInteger actCnt = new AtomicInteger(); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java index 28b482eff117d..5a58be6e2b840 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java @@ -32,9 +32,6 @@ * */ public class SqlFieldsQuerySelfTest extends GridCommonAbstractTest { - /** INSERT statement. */ - private static final String INSERT = "insert into Person(_key, name) values (5, 'x')"; - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { stopAllGrids(); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java index 593e6b4a2ee85..8defdf0b3d69f 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java @@ -1725,7 +1725,7 @@ public void testDurationMetricsCanBeLonger24Hours() throws Exception { ClusterMetricsImpl original = getField(node, "metrics"); - setField(node, "metrics", new MockedClusterMetrics(original));; + setField(node, "metrics", new MockedClusterMetrics(original)); List durationMetrics = execSql(ign, "SELECT " + diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/PSUStatisticsTypesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/PSUStatisticsTypesTest.java index e3408a2a66d00..c9705544ecb7e 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/PSUStatisticsTypesTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/PSUStatisticsTypesTest.java @@ -40,7 +40,7 @@ private void doColumnTests(String name, String comp, String val) { String[][] wrongHints = new String[1][]; wrongHints[0] = new String[]{"DTYPES_COL_INDEX"}; - String isNullSql = String.format("select * from dtypes i1 where col_%s is null", name);; + String isNullSql = String.format("select * from dtypes i1 where col_%s is null", name); checkOptimalPlanChosenForDifferentIndexes(grid(0), new String[]{"DTYPES_" + name}, isNullSql, noHints);