From 5efa88fb697669c0849a84e6bc4d60646fe8ce09 Mon Sep 17 00:00:00 2001 From: zstan Date: Mon, 1 Jun 2026 17:42:03 +0300 Subject: [PATCH 1/5] IGNITE-28737 Calcite. CacheOperationContext with keepBinary = true need to be used during dml operations --- .../jmh/sql/JmhSqlAggBenchmark.java | 15 + .../jmh/sql/JmhSqlCorrelateBenchmark.java | 15 + .../jmh/sql/JmhSqlDmlBenchmark.java | 15 + .../jmh/sql/JmhSqlInsertBenchmark.java | 142 ++++++ .../jmh/sql/JmhSqlScanBenchmark.java | 15 + .../jmh/sql/JmhSqlSetOpBenchmark.java | 15 + .../jmh/sql/JmhSqlSortBenchmark.java | 15 + .../jmh/sql/JmhSqlUdfBenchmark.java | 15 + modules/calcite/pom.xml | 7 - .../query/calcite/exec/rel/ModifyNode.java | 2 + .../integration/PublicApiIntegrationTest.java | 104 ++++ .../testsuites/IntegrationTestSuite.java | 2 + .../cache/CacheOperationContext.java | 480 ++++++++++-------- .../cache/GatewayProtectedCacheProxy.java | 14 +- .../processors/cache/GridCacheAdapter.java | 113 ++--- .../processors/cache/GridCacheProxyImpl.java | 162 +++--- .../cache/IgniteCacheProxyImpl.java | 4 +- .../processors/cache/IgniteInternalCache.java | 8 +- .../GridDistributedLockRequest.java | 62 ++- .../GridDistributedTxPrepareRequest.java | 2 +- .../distributed/dht/GridDhtLockFuture.java | 9 + .../distributed/dht/GridDhtLockRequest.java | 4 + .../dht/GridDhtTransactionalCacheAdapter.java | 6 + .../dht/GridDhtTxLocalAdapter.java | 8 + .../dht/GridDhtTxPrepareFuture.java | 3 +- .../dht/atomic/GridDhtAtomicCache.java | 26 +- .../GridNearAtomicAbstractUpdateFuture.java | 12 +- .../GridNearAtomicAbstractUpdateRequest.java | 15 +- .../GridNearAtomicSingleUpdateFuture.java | 10 +- .../atomic/GridNearAtomicUpdateFuture.java | 13 +- .../dht/colocated/GridDhtColocatedCache.java | 12 + .../colocated/GridDhtColocatedLockFuture.java | 16 +- .../distributed/near/GridNearLockFuture.java | 8 + .../distributed/near/GridNearLockRequest.java | 2 + .../GridNearOptimisticTxPrepareFuture.java | 2 +- .../near/GridNearTransactionalCache.java | 3 + .../distributed/near/GridNearTxLocal.java | 29 +- .../cache/transactions/IgniteTxEntry.java | 20 +- .../transactions/IgniteTxLocalAdapter.java | 7 +- .../datastructures/GridCacheQueueAdapter.java | 15 +- .../cache/GridCacheCommandHandler.java | 12 +- .../GridCacheCommandHandlerSelfTest.java | 4 - .../processors/query/h2/dml/DmlUtils.java | 4 +- 43 files changed, 1004 insertions(+), 443 deletions(-) create mode 100644 modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlInsertBenchmark.java create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAggBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAggBenchmark.java index e767c1936deb4..c4ef1bee72b18 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAggBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAggBenchmark.java @@ -18,7 +18,16 @@ package org.apache.ignite.internal.benchmarks.jmh.sql; import java.util.List; +import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; @@ -26,6 +35,12 @@ /** * Benchmark aggregate SQL queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlAggBenchmark extends JmhSqlAbstractBenchmark { /** * Query with group by and aggregate. diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlCorrelateBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlCorrelateBenchmark.java index 07004ae63ee41..64d8a3eab7ec9 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlCorrelateBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlCorrelateBenchmark.java @@ -19,7 +19,16 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; @@ -27,6 +36,12 @@ /** * Benchmark correlated SQL queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlCorrelateBenchmark extends JmhSqlAbstractBenchmark { /** * Query with correlated subquery. diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlDmlBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlDmlBenchmark.java index 6cdb00ff48ed1..ee809a7bf480e 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlDmlBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlDmlBenchmark.java @@ -19,8 +19,17 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import org.apache.ignite.IgniteDataStreamer; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; @@ -28,6 +37,12 @@ /** * Benchmark DML queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlDmlBenchmark extends JmhSqlAbstractBenchmark { /** * Initiate new cache. diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlInsertBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlInsertBenchmark.java new file mode 100644 index 0000000000000..fa291430c59b9 --- /dev/null +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlInsertBenchmark.java @@ -0,0 +1,142 @@ +/* + * 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.benchmarks.jmh.sql; + +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Threads; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import static java.lang.String.format; +import static java.util.stream.Collectors.joining; + +/** + * Benchmark for insertion operation, comparing SQL APIs. + */ +@State(Scope.Benchmark) +@Fork(1) +@Threads(1) +@Warmup(iterations = 10, time = 2) +@Measurement(iterations = 10, time = 2) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.MICROSECONDS) +public class JmhSqlInsertBenchmark extends JmhSqlAbstractBenchmark { + /** */ + private int id; + + /** */ + private static final String FIELD_VAL = "a".repeat(100); + + /** */ + private static final String TABLE_NAME = "dept"; + + /** */ + private String insertStr; + + /** */ + private String multiInsertStr; + + /** + * Initiate new tables. + */ + @Override public void setup() { + super.setup(); + + insertStr = createInsertStatement(); + multiInsertStr = createMultiInsertStatement(); + + executeSql("CREATE TABLE " + TABLE_NAME + + "(ycsb_key int PRIMARY KEY," + + "field1 varchar(100)," + + "field2 varchar(100)," + + "field3 varchar(100)," + + "field4 varchar(100)," + + "field5 varchar(100)," + + "field6 varchar(100)," + + "field7 varchar(100)," + + "field8 varchar(100)," + + "field9 varchar(100)," + + "field10 varchar(100))" + ); + } + + /** + * Benchmark for SQL insert via embedded client. + */ + @Benchmark + public void sqlSimpleInsert() { + executeSql(insertStr, id++); + } + + /** + * Benchmark for batch SQL insert via embedded client. + */ + @Benchmark + public void sqlBatchInsert() { + executeSql(multiInsertStr, id, id + 1); + + id += 2; + } + + /** + * Run benchmarks. + * + * @param args Args. + * @throws Exception Exception. + */ + public static void main(String[] args) throws Exception { + final Options options = new OptionsBuilder() + .include(JmhSqlInsertBenchmark.class.getSimpleName()) + .build(); + + new Runner(options).run(); + } + + /** */ + private static String createInsertStatement() { + /** */ + String insertQryTemplate = "insert into %s(%s, %s) values(?, %s)"; + + String fieldsQ = IntStream.range(1, 11).mapToObj(i -> "field" + i).collect(joining(",")); + String valQ = IntStream.range(1, 11).mapToObj(i -> "'" + FIELD_VAL + "'").collect(joining(",")); + + return format(insertQryTemplate, TABLE_NAME, "ycsb_key", fieldsQ, valQ); + } + + /** */ + private static String createMultiInsertStatement() { + /** */ + String insertQryTemplate = "insert into %s(%s, %s) values(?, %s), (?, %s)"; + + String fieldsQ = IntStream.range(1, 11).mapToObj(i -> "field" + i).collect(joining(",")); + String valQ = IntStream.range(1, 11).mapToObj(i -> "'" + FIELD_VAL + "'").collect(joining(",")); + + return format(insertQryTemplate, TABLE_NAME, "ycsb_key", fieldsQ, valQ, valQ); + } +} diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlScanBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlScanBenchmark.java index 42080465b805c..6c888815e8308 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlScanBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlScanBenchmark.java @@ -19,7 +19,16 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; @@ -27,6 +36,12 @@ /** * Benchmark scan SQL queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlScanBenchmark extends JmhSqlAbstractBenchmark { /** * Query unique value (full scan). diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSetOpBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSetOpBenchmark.java index 09f8891218b78..b4b7a50221a8c 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSetOpBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSetOpBenchmark.java @@ -19,7 +19,16 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.profile.GCProfiler; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; @@ -28,6 +37,12 @@ /** * Benchmark set op SQL queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlSetOpBenchmark extends JmhSqlAbstractBenchmark { /** * Query with EXCEPT set op. diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSortBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSortBenchmark.java index 8493a2a91389e..48ba21053b4d4 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSortBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlSortBenchmark.java @@ -19,7 +19,16 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; @@ -27,6 +36,12 @@ /** * Benchmark sort SQL queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlSortBenchmark extends JmhSqlAbstractBenchmark { /** * Query with sorting (full set). diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlUdfBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlUdfBenchmark.java index c3d24ca055b27..5a606b447dd18 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlUdfBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlUdfBenchmark.java @@ -18,9 +18,18 @@ package org.apache.ignite.internal.benchmarks.jmh.sql; import java.util.List; +import java.util.concurrent.TimeUnit; import org.apache.ignite.cache.query.annotations.QuerySqlFunction; import org.apache.ignite.configuration.CacheConfiguration; import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; @@ -28,6 +37,12 @@ /** * Benchmark user defined functions in SQL queries. */ +@Fork(1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@Warmup(iterations = 3, time = 5) +@Measurement(iterations = 3, time = 5) +@State(Scope.Benchmark) public class JmhSqlUdfBenchmark extends JmhSqlAbstractBenchmark { /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration() { diff --git a/modules/calcite/pom.xml b/modules/calcite/pom.xml index 412b39d340321..945451239f846 100644 --- a/modules/calcite/pom.xml +++ b/modules/calcite/pom.xml @@ -37,7 +37,6 @@ 1.26.0 1.40.0 - 3.10.0 1.0.1 2.8.2 3.1.12 @@ -94,12 +93,6 @@ failureaccess - - org.checkerframework - checker-qual - ${checker.version} - - org.codehaus.janino commons-compiler 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 fcf2b8ebd3315..f055981440e86 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 @@ -241,6 +241,8 @@ private void flushTuples(boolean force) throws Exception { if (keepBinaryMode) cache = cache.keepBinary(); + cache = cache.withCalciteEngine(); + if (tx == null) invokeOutsideTransaction(tuples, cache); else diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java new file mode 100644 index 0000000000000..8c81cde7f0fc2 --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java @@ -0,0 +1,104 @@ +/* + * 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.List; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheAtomicityMode; +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.transactions.Transaction; +import org.junit.Test; + +import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; +import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; + +/** Public api integration tests. */ +public class PublicApiIntegrationTest extends AbstractBasicIntegrationTest { + /** */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + + cfg.setSqlConfiguration(new SqlConfiguration() + .setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration().setDefault(true))); + + return cfg; + } + + /** */ + @Test + public void testSimpleInsert() { + IgniteCache cache = client.createCache(DEFAULT_CACHE_NAME); + + runQuery(0, nodeCount() * 10, false, cache); + + cache = cache.withKeepBinary(); + + runQuery(nodeCount() * 10, 2 * nodeCount() * 10, false, cache); + + List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); + + assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); + } + + /** */ + @Test + public void testTxInsert() { + CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); + + IgniteCache cache = client.createCache(ccfg); + + runQuery(0, nodeCount() * 10, true, cache); + + cache = cache.withKeepBinary(); + + runQuery(nodeCount() * 10, 2 * nodeCount() * 10, true, cache); + + List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); + + assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); + } + + /** */ + private void runQuery(int begin, int end, boolean transactional, IgniteCache cache) { + cache.query(new SqlFieldsQuery("CREATE TABLE IF NOT EXISTS emp(empid INTEGER, deptid INTEGER, name VARCHAR, salary INTEGER, " + + "PRIMARY KEY(empid, deptid)) WITH \"AFFINITY_KEY=deptid" + (transactional ? ", ATOMICITY=transactional" : "") + "\"")) + .getAll(); + + try (Transaction tx = transactional ? client.transactions().txStart(PESSIMISTIC, READ_COMMITTED) : null) { + for (int i = begin; i < end; i++) { + cache.query(new SqlFieldsQuery("INSERT INTO emp (empid, deptid, name, salary) VALUES (?, ?, ?, ?)").setArgs( + i, i % 2, "Employee " + i, i)).getAll(); + + cache.query(new SqlFieldsQuery("UPDATE emp SET name = '' WHERE empid = ? AND deptid = ?").setArgs(i, i % 2)).getAll(); + cache.query(new SqlFieldsQuery("DELETE FROM emp WHERE empid = ?").setArgs(i - 1)).getAll(); + + cache.query(new SqlFieldsQuery( + "MERGE INTO emp dst USING table(system_range(1, 1000)) src ON dst.salary = src.x " + + "WHEN MATCHED THEN UPDATE SET dst.salary = src.x")).getAll(); + } + + if (tx != null) + tx.commit(); + } + } +} 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 f4e123c6a7c40..39726224cf074 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 @@ -61,6 +61,7 @@ import org.apache.ignite.internal.processors.query.calcite.integration.OperatorsExtensionIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.PartitionPruneTest; import org.apache.ignite.internal.processors.query.calcite.integration.PartitionsReservationIntegrationTest; +import org.apache.ignite.internal.processors.query.calcite.integration.PublicApiIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.QueryBlockingTaskExecutorIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.QueryEngineConfigurationIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.QueryMetadataIntegrationTest; @@ -183,6 +184,7 @@ CacheWithInterceptorIntegrationTest.class, TxThreadLockingTest.class, SelectByKeyFieldTest.class, + PublicApiIntegrationTest.class, }) public class IntegrationTestSuite { } 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 b6470c60edc15..2bce39e2773ad 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 @@ -34,11 +34,14 @@ public class CacheOperationContext implements Serializable { /** */ private static final long serialVersionUID = 0L; - /** Skip store. */ + /** */ + private static final CacheOperationContext INSTANCE = new Builder().build(); + + /** Skip store flag. */ @GridToStringInclude private final boolean skipStore; - /** Skip store. */ + /** Skip read through flag. */ @GridToStringInclude private final boolean skipReadThrough; @@ -46,49 +49,38 @@ public class CacheOperationContext implements Serializable { @GridToStringInclude private final boolean noRetries; - /** */ + /** Recovery flag. */ private final boolean recovery; - /** Read-repair strategy. */ - private final ReadRepairStrategy readRepairStrategy; + /** Read-repair strategy.*/ + private final @Nullable ReadRepairStrategy readRepairStrategy; /** Keep binary flag. */ private final boolean keepBinary; /** Expiry policy. */ - private final ExpiryPolicy expiryPlc; + private final @Nullable ExpiryPolicy expiryPlc; /** Data center Id. */ - private final Byte dataCenterId; + private final @Nullable Byte dataCenterId; /** Application attributes. */ - private final Map appAttrs; + private final @Nullable Map appAttrs; - /** - * Constructor with default values. - */ - public CacheOperationContext() { - skipStore = false; - skipReadThrough = false; - keepBinary = false; - expiryPlc = null; - noRetries = false; - recovery = false; - readRepairStrategy = null; - dataCenterId = null; - appAttrs = null; - } + /** Calcite engine call flag. */ + private final boolean calciteEngineCall; /** - * @param skipStore Skip store flag. - * @param skipReadThrough Skip read-through cache store flag. - * @param keepBinary Keep binary flag. - * @param expiryPlc Expiry policy. - * @param dataCenterId Data center id. + * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param keepBinary Keep binary flag. + * @param expiryPlc Expiry policy. + * @param dataCenterId Data center id. * @param readRepairStrategy Read-repair strategy. - * @param appAttrs Application attributes. + * @param appAttrs Application attributes. + * @param calciteEngineCall Calcite engine call flag. */ - public CacheOperationContext( + private CacheOperationContext( boolean skipStore, boolean skipReadThrough, boolean keepBinary, @@ -97,7 +89,8 @@ public CacheOperationContext( @Nullable Byte dataCenterId, boolean recovery, @Nullable ReadRepairStrategy readRepairStrategy, - @Nullable Map appAttrs + @Nullable Map appAttrs, + boolean calciteEngineCall ) { this.skipStore = skipStore; this.skipReadThrough = skipReadThrough; @@ -108,38 +101,26 @@ public CacheOperationContext( this.recovery = recovery; this.readRepairStrategy = readRepairStrategy; this.appAttrs = appAttrs; + this.calciteEngineCall = calciteEngineCall; } /** - * @return Keep binary flag. + * Helper. */ - public boolean isKeepBinary() { - return keepBinary; + public static CacheOperationContext instance() { + return INSTANCE; } /** - * @return {@code True} if data center id is set otherwise {@code false}. + * @return keepBinary flag. */ - public boolean hasDataCenterId() { - return dataCenterId != null; + public boolean isKeepBinary() { + return keepBinary; } - /** - * See {@link IgniteInternalCache#keepBinary()}. - * - * @return New instance of CacheOperationContext with keep binary flag. - */ - public CacheOperationContext keepBinary() { - return new CacheOperationContext( - skipStore, - skipReadThrough, - true, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + /** Context with keepBinary flag. */ + public CacheOperationContext withKeepBinary() { + return builder(this).keepBinary(true).build(); } /** @@ -151,214 +132,291 @@ public CacheOperationContext keepBinary() { return dataCenterId; } - /** - * @return Skip store. - */ - public boolean skipStore() { - return skipStore; + /** Context with dataCenterId. */ + public CacheOperationContext withDataCenterId(Byte dataCenterId) { + return builder(this).dataCenterId(dataCenterId).build(); } /** - * See {@link IgniteInternalCache#setSkipStore(boolean)}. - * - * @param skipStore Skip store flag. - * @return New instance of CacheOperationContext with skip store flag. + * @return Partition recover flag. */ - public CacheOperationContext setSkipStore(boolean skipStore) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + public boolean recovery() { + return recovery; } - /** @return Skip read-through cache store. */ - public boolean skipReadThrough() { - return skipReadThrough; + /** Context with recovery flag. */ + public CacheOperationContext withRecovery() { + return builder(this).recovery(true).build(); } /** - * See {@link IgniteInternalCache#withApplicationAttributes(Map)}. - * - * @return New instance of CacheOperationContext with new application attributes. + * @return Read Repair strategy. */ - public CacheOperationContext withApplicationAttributes(Map attrs) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - Collections.unmodifiableMap(attrs)); + @Nullable public ReadRepairStrategy readRepairStrategy() { + return readRepairStrategy; } - /** - * See {@link IgniteInternalCache#withSkipReadThrough()}. - * - * @return New instance of CacheOperationContext with skip store flag. - */ - public CacheOperationContext withSkipReadThrough() { - return new CacheOperationContext( - skipStore, - true, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + /** Context with read repair strategy. */ + public CacheOperationContext withReadRepairStrategy(ReadRepairStrategy strategy) { + return builder(this).readRepairStrategy(strategy).build(); } /** - * @return {@link ExpiryPolicy} associated with this projection. + * @return No retries flag. */ - @Nullable public ExpiryPolicy expiry() { - return expiryPlc; + public boolean noRetries() { + return noRetries; } - /** - * See {@link IgniteInternalCache#withExpiryPolicy(ExpiryPolicy)}. - * - * @param plc {@link ExpiryPolicy} to associate with this projection. - * @return New instance of CacheOperationContext with skip store flag. - */ - public CacheOperationContext withExpiryPolicy(ExpiryPolicy plc) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - plc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + /** Context with noRetries flag. */ + public CacheOperationContext withNoRetries() { + return builder(this).noRetries(true).build(); } /** - * @param noRetries No retries flag. - * @return Operation context. + * @return Application attributes. */ - public CacheOperationContext setNoRetries(boolean noRetries) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + @Nullable public Map applicationAttributes() { + return appAttrs; } - /** - * @param dataCenterId Data center id. - * @return Operation context. - */ - public CacheOperationContext setDataCenterId(byte dataCenterId) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + /** Context with application attributes. */ + public CacheOperationContext withApplicationAttributes(Map attrs) { + return builder(this).applicationAttributes(attrs).build(); } /** - * @param recovery Recovery flag. - * @return New instance of CacheOperationContext with recovery flag. + * @return Skip store. */ - public CacheOperationContext setRecovery(boolean recovery) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + public boolean skipStore() { + return skipStore; } - /** - * @param readRepairStrategy Read Repair strategy. - * @return New instance of CacheOperationContext with Read Repair flag. - */ - public CacheOperationContext setReadRepairStrategy(ReadRepairStrategy readRepairStrategy) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - appAttrs); + /** Context with skipStore flag. */ + public CacheOperationContext withSkipStore() { + return builder(this).skipStore(true).build(); } /** - * @param appAttrs Application attributes. - * @return New instance of CacheOperationContext with application attributes. + * @return Skip read-through cache store. */ - public CacheOperationContext setApplicationAttributes(Map appAttrs) { - return new CacheOperationContext( - skipStore, - skipReadThrough, - keepBinary, - expiryPlc, - noRetries, - dataCenterId, - recovery, - readRepairStrategy, - new HashMap<>(appAttrs)); + public boolean skipReadThrough() { + return skipReadThrough; } - /** - * @return Partition recover flag. - */ - public boolean recovery() { - return recovery; + /** Context with {@link CacheOperationContext#skipReadThrough} flag. */ + public CacheOperationContext withSkipReadThrough() { + return builder(this).skipReadThrough(true).build(); + } + + /** @return Calcite engine execution flag. */ + public boolean calciteEngine() { + return calciteEngineCall; + } + + /** Context with {@link CacheOperationContext#calciteEngine} flag. */ + public CacheOperationContext withCalciteEngine() { + return builder(this).calciteEngine(true).build(); } /** - * @return Read Repair strategy. + * @return {@link ExpiryPolicy} associated with this projection. */ - public ReadRepairStrategy readRepairStrategy() { - return readRepairStrategy; + @Nullable public ExpiryPolicy expiry() { + return expiryPlc; + } + + /** Context with {@link CacheOperationContext#expiryPlc}. */ + public CacheOperationContext withExpiryPolicy(ExpiryPolicy plc) { + return builder(this).expiryPolicy(plc).build(); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheOperationContext.class, this); } /** - * @return No retries flag. + * Creates the builder from existing context. + * + * @return Builder for cache operations context. */ - public boolean noRetries() { - return noRetries; + public static Builder builder(CacheOperationContext ctx) { + return new Builder(ctx); } /** - * @return Application attributes. + * Creates the builder for cache operations context. + * + * @return Builder for cache operations context. */ - public Map applicationAttributes() { - return appAttrs; + public static Builder builder() { + return new Builder(); } - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(CacheOperationContext.class, this); + /** Cache operations context builder. */ + public static class Builder { + /** Skip store. */ + @GridToStringInclude + private boolean skipStore; + + /** Skip read through. */ + @GridToStringInclude + private boolean skipReadThrough; + + /** No retries flag. */ + @GridToStringInclude + private boolean noRetries; + + /** Recovery flag. */ + private boolean recovery; + + /** Read-repair strategy. */ + private ReadRepairStrategy readRepairStrategy; + + /** Keep binary flag. */ + private boolean keepBinary; + + /** Expiry policy. */ + private ExpiryPolicy expiryPlc; + + /** Data center Id. */ + private Byte dataCenterId; + + /** Application attributes. */ + private Map appAttrs; + + /** Calcite engine execution flag. */ + private boolean calciteEngine; + + /** */ + Builder() { + // No context. + } + + /** */ + Builder(CacheOperationContext ctx) { + skipStore = ctx.skipStore; + skipReadThrough = ctx.skipReadThrough; + noRetries = ctx.noRetries; + recovery = ctx.recovery; + readRepairStrategy = ctx.readRepairStrategy; + keepBinary = ctx.keepBinary; + expiryPlc = ctx.expiryPlc; + dataCenterId = ctx.dataCenterId; + appAttrs = ctx.appAttrs; + calciteEngine = ctx.calciteEngineCall; + } + + /** + * CacheOperationContext with keepBinary flag. + * + * @see IgniteInternalCache#keepBinary() + */ + public Builder keepBinary(boolean keepBinary) { + this.keepBinary = keepBinary; + return this; + } + + /** + * CacheOperationContext with skipStore flag. + * + * @see IgniteInternalCache#withSkipStore() + */ + public Builder skipStore(boolean skipStore) { + this.skipStore = skipStore; + return this; + } + + /** + * CacheOperationContext with attributes. + * + * @see IgniteInternalCache#withApplicationAttributes(Map) + */ + public Builder applicationAttributes(Map attrs) { + appAttrs = Collections.unmodifiableMap(new HashMap<>(attrs)); + return this; + } + + /** + * CacheOperationContext with skip read through flag. + * + * @see IgniteInternalCache#withSkipReadThrough() + */ + public Builder skipReadThrough(boolean skipReadThrough) { + this.skipReadThrough = skipReadThrough; + return this; + } + + /** + * CacheOperationContext with calcite execution flag. + * + * @see IgniteInternalCache#withCalciteEngine() + */ + public Builder calciteEngine(boolean calciteEngine) { + this.calciteEngine = calciteEngine; + return this; + } + + /** + * CacheOperationContext with expiry policy. + * + * @see IgniteInternalCache#withExpiryPolicy(ExpiryPolicy) + */ + public Builder expiryPolicy(ExpiryPolicy expiryPlc) { + this.expiryPlc = expiryPlc; + return this; + } + + /** + * CacheOperationContext with no retries flag. + */ + public Builder noRetries(boolean noRetries) { + this.noRetries = noRetries; + return this; + } + + /** + * CacheOperationContext with Data center id. + */ + public Builder dataCenterId(Byte dataCenterId) { + this.dataCenterId = dataCenterId; + return this; + } + + /** + * CacheOperationContext with recovery flag. + */ + public Builder recovery(boolean recovery) { + this.recovery = recovery; + return this; + } + + /** + * CacheOperationContext with read repair strategy. + */ + public Builder readRepairStrategy(ReadRepairStrategy readRepairStrategy) { + this.readRepairStrategy = readRepairStrategy; + return this; + } + + /** + * Builds cache operations context options. + * + * @return Cache operations context options. + */ + public CacheOperationContext build() { + return new CacheOperationContext( + skipStore, + skipReadThrough, + keepBinary, + expiryPlc, + noRetries, + dataCenterId, + recovery, + readRepairStrategy, + appAttrs, + calciteEngine); + } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java index fba0e990c5e97..205af51e47f46 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java @@ -166,7 +166,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { if (skip) return this; - return new GatewayProtectedCacheProxy<>(delegate, opCtx.setSkipStore(true), lock); + return new GatewayProtectedCacheProxy<>(delegate, opCtx.withSkipStore(), lock); } finally { onLeave(opGate); @@ -180,7 +180,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { CacheOperationGate opGate = onEnter(); try { - return new GatewayProtectedCacheProxy<>(delegate, opCtx.setApplicationAttributes(appAttrs), lock); + return new GatewayProtectedCacheProxy<>(delegate, opCtx.withApplicationAttributes(appAttrs), lock); } finally { onLeave(opGate); @@ -197,7 +197,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { if (noRetries) return this; - return new GatewayProtectedCacheProxy<>(delegate, opCtx.setNoRetries(true), lock); + return new GatewayProtectedCacheProxy<>(delegate, opCtx.withNoRetries(), lock); } finally { onLeave(opGate); @@ -214,7 +214,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { if (recovery) return this; - return new GatewayProtectedCacheProxy<>(delegate, opCtx.setRecovery(true), lock); + return new GatewayProtectedCacheProxy<>(delegate, opCtx.withRecovery(), lock); } finally { onLeave(opGate); @@ -244,7 +244,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { if (opCtx.readRepairStrategy() == strategy) return this; - return new GatewayProtectedCacheProxy<>(delegate, opCtx.setReadRepairStrategy(strategy), lock); + return new GatewayProtectedCacheProxy<>(delegate, opCtx.withReadRepairStrategy(strategy), lock); } finally { onLeave(opGate); @@ -261,7 +261,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { CacheOperationGate opGate = onEnter(); try { - return new GatewayProtectedCacheProxy<>((IgniteCacheProxy)delegate, opCtx.keepBinary(), lock); + return new GatewayProtectedCacheProxy<>((IgniteCacheProxy)delegate, opCtx.withKeepBinary(), lock); } finally { onLeave(opGate); @@ -278,7 +278,7 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { if (prevDataCenterId != null && dataCenterId == prevDataCenterId) return this; - return new GatewayProtectedCacheProxy<>(delegate, opCtx.setDataCenterId(dataCenterId), lock); + return new GatewayProtectedCacheProxy<>(delegate, opCtx.withDataCenterId(dataCenterId), lock); } finally { onLeave(opGate); 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 410bac3545fc2..369537432f116 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 @@ -466,59 +466,54 @@ public void active(boolean active) { } /** {@inheritDoc} */ - @Override public final GridCacheProxyImpl setSkipStore(boolean skipStore) { - CacheOperationContext opCtx = new CacheOperationContext( - true, - false, - false, - null, - false, - null, - false, - null, - null); + @Override public IgniteInternalCache withSkipStore() { + CacheOperationContext opCtx = ctx.operationContextPerCall(); + + if (opCtx == null) + opCtx = CacheOperationContext.builder().skipStore(true).build(); + else { + if (!opCtx.skipStore()) + opCtx = opCtx.withSkipStore(); + } return new GridCacheProxyImpl<>(ctx, this, opCtx); } /** {@inheritDoc} */ @Override public IgniteInternalCache withSkipReadThrough() { - CacheOperationContext opCtx = this.ctx.operationContextPerCall(); + CacheOperationContext opCtx = ctx.operationContextPerCall(); - if (opCtx == null) { - opCtx = new CacheOperationContext( - false, - true, - false, - null, - false, - null, - false, - null, - null); + if (opCtx == null) + opCtx = CacheOperationContext.builder().skipReadThrough(true).build(); + else { + if (!opCtx.skipReadThrough()) + opCtx = opCtx.withSkipReadThrough(); } - else - opCtx = opCtx.withSkipReadThrough(); - return new GridCacheProxyImpl<>(this.ctx, this, opCtx); + return new GridCacheProxyImpl<>(ctx, this, opCtx); } + /** {@inheritDoc} */ + @Override public IgniteInternalCache withCalciteEngine() { + CacheOperationContext opCtx = ctx.operationContextPerCall(); + + if (opCtx == null) + opCtx = CacheOperationContext.builder().calciteEngine(true).build(); + else { + if (!opCtx.calciteEngine()) + opCtx = opCtx.withCalciteEngine(); + } + + return new GridCacheProxyImpl<>(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)); - } + if (opCtx == null) + opCtx = CacheOperationContext.builder().applicationAttributes(attrs).build(); else opCtx = opCtx.withApplicationAttributes(attrs); @@ -527,16 +522,7 @@ public void active(boolean active) { /** {@inheritDoc} */ @Override public final GridCacheProxyImpl keepBinary() { - CacheOperationContext opCtx = new CacheOperationContext( - false, - false, - true, - null, - false, - null, - false, - null, - null); + CacheOperationContext opCtx = CacheOperationContext.builder().keepBinary(true).build(); return new GridCacheProxyImpl<>((GridCacheContext)ctx, (GridCacheAdapter)this, opCtx); } @@ -550,32 +536,21 @@ public void active(boolean active) { @Override public final GridCacheProxyImpl withExpiryPolicy(ExpiryPolicy plc) { assert !CU.isUtilityCache(ctx.name()); - CacheOperationContext opCtx = new CacheOperationContext( - false, - false, - false, - plc, - false, - null, - false, - null, - null); + CacheOperationContext opCtx = CacheOperationContext.builder().expiryPolicy(plc).build(); return new GridCacheProxyImpl<>(ctx, this, opCtx); } /** {@inheritDoc} */ @Override public final IgniteInternalCache withNoRetries() { - CacheOperationContext opCtx = new CacheOperationContext( - false, - false, - false, - null, - true, - null, - false, - null, - null); + CacheOperationContext opCtx = ctx.operationContextPerCall(); + + if (opCtx == null) + opCtx = CacheOperationContext.builder().noRetries(true).build(); + else { + if (!opCtx.noRetries()) + opCtx = opCtx.withNoRetries(); + } return new GridCacheProxyImpl<>(ctx, this, opCtx); } @@ -4478,7 +4453,7 @@ private IgniteInternalFuture repairAtomicAsync( @Override public Boolean call() throws IgniteCheckedException { CacheOperationContext prevOpCtx = ctx.operationContextPerCall(); - ctx.operationContextPerCall(opCtx.keepBinary()); + ctx.operationContextPerCall(opCtx.withKeepBinary()); try { return invoke((K)key, new AtomicReadRepairEntryProcessor<>(correctedVal, primVer)).get(); 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 d06f64e039a77..fe99ce386a828 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 @@ -251,25 +251,22 @@ public IgniteInternalCache delegate() { } /** {@inheritDoc} */ - @Override public GridCacheProxyImpl setSkipStore(boolean skipStore) { + @Override public GridCacheProxyImpl withSkipStore() { CacheOperationContext prev = gate.enter(opCtx); + CacheOperationContext newOpCtx; + try { - if (opCtx != null && opCtx.skipStore() == skipStore) - return this; + if (opCtx != null) { + if (opCtx.skipStore()) + return this; + else + newOpCtx = opCtx.withSkipStore(); + } + else + newOpCtx = CacheOperationContext.builder().skipStore(true).build(); - return new GridCacheProxyImpl<>(ctx, delegate, - opCtx != null ? opCtx.setSkipStore(skipStore) : - new CacheOperationContext( - skipStore, - false, - false, - null, - false, - null, - false, - null, - null)); + return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); } finally { gate.leave(prev); @@ -280,22 +277,19 @@ public IgniteInternalCache delegate() { @Override public IgniteInternalCache withSkipReadThrough() { CacheOperationContext prev = gate.enter(opCtx); + CacheOperationContext newOpCtx; + try { - if (opCtx != null && opCtx.skipReadThrough()) - return this; + if (opCtx != null) { + if (opCtx.skipReadThrough()) + return this; + else + newOpCtx = opCtx.withSkipReadThrough(); + } + else + newOpCtx = CacheOperationContext.builder().skipReadThrough(true).build(); - return new GridCacheProxyImpl<>(ctx, delegate, - opCtx != null ? opCtx.withSkipReadThrough() : - new CacheOperationContext( - false, - true, - false, - null, - false, - null, - false, - null, - null)); + return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); } finally { gate.leave(prev); @@ -306,19 +300,15 @@ public IgniteInternalCache delegate() { @Override public GridCacheProxyImpl withApplicationAttributes(Map attrs) { CacheOperationContext prev = gate.enter(opCtx); + CacheOperationContext newOpCtx; + try { - return new GridCacheProxyImpl<>(ctx, delegate, - opCtx != null ? opCtx.setApplicationAttributes(attrs) : - new CacheOperationContext( - false, - false, - false, - null, - false, - null, - false, - null, - attrs)); + if (opCtx != null) + newOpCtx = opCtx.withApplicationAttributes(attrs); + else + newOpCtx = CacheOperationContext.builder().applicationAttributes(attrs).build(); + + return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); } finally { gate.leave(prev); @@ -327,21 +317,19 @@ public IgniteInternalCache delegate() { /** {@inheritDoc} */ @Override public GridCacheProxyImpl keepBinary() { - if (opCtx != null && opCtx.isKeepBinary()) - return (GridCacheProxyImpl)this; + CacheOperationContext newOpCtx; + + if (opCtx != null) { + if (opCtx.isKeepBinary()) + return (GridCacheProxyImpl)this; + else + newOpCtx = opCtx.withKeepBinary(); + } + else + newOpCtx = CacheOperationContext.builder().keepBinary(true).build(); return new GridCacheProxyImpl<>((GridCacheContext)ctx, - (GridCacheAdapter)delegate, - opCtx != null ? opCtx.keepBinary() : - new CacheOperationContext(false, - false, - true, - null, - false, - null, - false, - null, - null)); + (GridCacheAdapter)delegate, newOpCtx); } /** {@inheritDoc} */ @@ -1580,19 +1568,15 @@ public IgniteInternalCache delegate() { @Override public GridCacheProxyImpl withExpiryPolicy(ExpiryPolicy plc) { CacheOperationContext prev = gate.enter(opCtx); + CacheOperationContext newOpCtx; + try { - return new GridCacheProxyImpl<>(ctx, delegate, - opCtx != null ? opCtx.withExpiryPolicy(plc) : - new CacheOperationContext( - false, - false, - false, - plc, - false, - null, - false, - null, - null)); + if (opCtx != null) + newOpCtx = opCtx.withExpiryPolicy(plc); + else + newOpCtx = CacheOperationContext.builder().expiryPolicy(plc).build(); + + return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); } finally { gate.leave(prev); @@ -1603,18 +1587,42 @@ public IgniteInternalCache delegate() { @Override public IgniteInternalCache withNoRetries() { CacheOperationContext prev = gate.enter(opCtx); + CacheOperationContext newOpCtx; + + try { + if (opCtx != null) { + if (opCtx.noRetries()) + return this; + else + newOpCtx = opCtx.withNoRetries(); + } + else + newOpCtx = CacheOperationContext.builder().noRetries(true).build(); + + return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); + } + finally { + gate.leave(prev); + } + } + + /** {@inheritDoc} */ + @Override public IgniteInternalCache withCalciteEngine() { + CacheOperationContext prev = gate.enter(opCtx); + + CacheOperationContext newOpCtx; + try { - return new GridCacheProxyImpl<>(ctx, delegate, - new CacheOperationContext( - false, - false, - false, - null, - true, - null, - false, - null, - null)); + if (opCtx != null) { + if (opCtx.calciteEngine()) + return this; + else + newOpCtx = opCtx.withCalciteEngine(); + } + else + newOpCtx = CacheOperationContext.builder().calciteEngine(true).build(); + + return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); } finally { gate.leave(prev); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java index 629bb9433cbd8..2ab4e3d990a7c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java @@ -272,7 +272,7 @@ public GridCacheContext context0() { /** {@inheritDoc} */ @Override public IgniteCacheProxy cacheNoGate() { - return new GatewayProtectedCacheProxy<>(this, new CacheOperationContext(), false); + return new GatewayProtectedCacheProxy<>(this, CacheOperationContext.instance(), false); } /** @@ -282,7 +282,7 @@ public IgniteCacheProxy gatewayWrapper() { if (cachedProxy != null) return cachedProxy; - cachedProxy = new GatewayProtectedCacheProxy<>(this, new CacheOperationContext(), true); + cachedProxy = new GatewayProtectedCacheProxy<>(this, CacheOperationContext.instance(), true); return cachedProxy; } 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 50bdf4efe97eb..4b4f8263c7149 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 @@ -222,10 +222,9 @@ public interface IgniteInternalCache extends Iterable> { public boolean skipStore(); /** - * @param skipStore Skip store flag. * @return New internal cache instance based on this one, but with skip store flag enabled. */ - public IgniteInternalCache setSkipStore(boolean skipStore); + public IgniteInternalCache withSkipStore(); /** @return New internal cache instance based on this one, but with skip read-through cache store flag enabled. */ public IgniteInternalCache withSkipReadThrough(); @@ -1642,6 +1641,11 @@ public Iterator> scanIterator(boolean keepBinary, @Nullable Ig */ public IgniteInternalCache withExpiryPolicy(ExpiryPolicy plc); + /** + * @return Cache with calcite engine execution flag. + */ + public IgniteInternalCache withCalciteEngine(); + /** * @return Cache with no-retries behavior enabled. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java index b02d75024fec5..4ea96fe851356 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java @@ -49,6 +49,9 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage { /** */ private static final int SKIP_READ_THROUGH_FLAG_MASK = 0x08; + /** Calcite engine operation call flag bit mask. */ + private static final int CALCITE_OP_CALL_FLAG_MASK = 0x10; + /** Sender node ID. */ @Order(0) public UUID nodeId; @@ -127,6 +130,8 @@ public GridDistributedLockRequest() { * @param keyCnt Number of keys. * @param txSize Expected transaction size. * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. */ public GridDistributedLockRequest( int cacheId, @@ -144,6 +149,7 @@ public GridDistributedLockRequest( int txSize, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary ) { super(lockVer, keyCnt, false); @@ -169,6 +175,7 @@ public GridDistributedLockRequest( skipStore(skipStore); skipReadThrough(skipReadThrough); keepBinary(keepBinary); + calciteOpCall(calciteOpCall); } /** @@ -234,61 +241,90 @@ public boolean returnValue(int idx) { * @param skipStore Skip store flag. */ private void skipStore(boolean skipStore) { - flags = skipStore ? (byte)(flags | SKIP_STORE_FLAG_MASK) : (byte)(flags & ~SKIP_STORE_FLAG_MASK); + setFlag(skipStore, SKIP_STORE_FLAG_MASK); } /** * @return Skip store flag. */ public boolean skipStore() { - return (flags & SKIP_STORE_FLAG_MASK) == 1; + return isFlag(SKIP_STORE_FLAG_MASK); } /** - * Sets skip store flag value. + * Sets skip read-through flag value. * * @param skipReadThrough Skip read-through cache store flag. */ private void skipReadThrough(boolean skipReadThrough) { - flags = skipReadThrough ? (byte)(flags | SKIP_READ_THROUGH_FLAG_MASK) : (byte)(flags & ~SKIP_READ_THROUGH_FLAG_MASK); + setFlag(skipReadThrough, SKIP_READ_THROUGH_FLAG_MASK); } /** - * @return Skip store flag. + * @return Skip read-through flag. */ public boolean skipReadThrough() { - return (flags & SKIP_READ_THROUGH_FLAG_MASK) != 0; + return isFlag(SKIP_READ_THROUGH_FLAG_MASK); + } + + /** Sets calcite operation flag. */ + public void calciteOpCall(boolean calciteOpCall) { + setFlag(calciteOpCall, CALCITE_OP_CALL_FLAG_MASK); + } + + /** + * @return Calcite engine operation flag. + */ + public boolean calciteOpCall() { + return isFlag(CALCITE_OP_CALL_FLAG_MASK); } /** * @param keepBinary Keep binary flag. */ private void keepBinary(boolean keepBinary) { - flags = keepBinary ? (byte)(flags | KEEP_BINARY_FLAG_MASK) : (byte)(flags & ~KEEP_BINARY_FLAG_MASK); + setFlag(keepBinary, KEEP_BINARY_FLAG_MASK); } /** * @return Keep binary. */ public boolean keepBinary() { - return (flags & KEEP_BINARY_FLAG_MASK) != 0; + return isFlag(KEEP_BINARY_FLAG_MASK); } /** * @return Flag indicating whether transaction use cache store. */ public boolean storeUsed() { - return (flags & STORE_USED_FLAG_MASK) != 0; + return isFlag(STORE_USED_FLAG_MASK); } /** * @param storeUsed Store used value. */ public void storeUsed(boolean storeUsed) { - if (storeUsed) - flags |= STORE_USED_FLAG_MASK; - else - flags &= ~STORE_USED_FLAG_MASK; + setFlag(storeUsed, STORE_USED_FLAG_MASK); + } + + /** + * Sets flag mask. + * + * @param flag Set or clear. + * @param mask Mask. + */ + private void setFlag(boolean flag, int mask) { + flags = flag ? (byte)(flags | mask) : (byte)(flags & ~mask); + } + + /** + * Reads flag mask. + * + * @param mask Mask to read. + * @return Flag value. + */ + private boolean isFlag(int mask) { + return (flags & mask) != 0; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java index bd427bd47b56f..68a53ca1936bc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java @@ -216,7 +216,7 @@ public final boolean system() { * @return Flag indicating whether transaction use cache store. */ public boolean storeWriteThrough() { - return (flags & STORE_WRITE_THROUGH_FLAG_MASK) != 0; + return isFlag(STORE_WRITE_THROUGH_FLAG_MASK); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java index 7cba44d7ef5a4..eef499986084d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java @@ -187,6 +187,9 @@ public final class GridDhtLockFuture extends GridCacheCompoundIdentityFuture cctx, @@ -219,6 +225,7 @@ public GridDhtLockFuture( long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary) { super(CU.boolReducer()); @@ -239,6 +246,7 @@ public GridDhtLockFuture( this.accessTtl = accessTtl; this.skipStore = skipStore; this.skipReadThrough = skipReadThrough; + this.calciteOpCall = calciteOpCall; this.keepBinary = keepBinary; if (tx != null) @@ -922,6 +930,7 @@ private void map(Iterable entries) { read ? accessTtl : -1L, skipStore, skipReadThrough, + calciteOpCall, cctx.store().configured(), keepBinary, inTx() ? tx.label() : null); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java index 315997cecd8a6..09db43379175a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java @@ -111,6 +111,8 @@ public GridDhtLockRequest() { * @param storeUsed Cache store used flag. * @param keepBinary Keep binary flag. * @param txLbl Transaction label. + * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. */ public GridDhtLockRequest( int cacheId, @@ -132,6 +134,7 @@ public GridDhtLockRequest( long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean storeUsed, boolean keepBinary, String txLbl @@ -151,6 +154,7 @@ public GridDhtLockRequest( txSize, skipStore, skipReadThrough, + calciteOpCall, keepBinary); this.topVer = topVer; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java index 8acb9ccb5623d..9bc69ddb02bb9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java @@ -742,6 +742,7 @@ else if (txLockMsgLog.isDebugEnabled()) { accessTtl, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), opCtx != null && opCtx.isKeepBinary()); } @@ -759,6 +760,7 @@ else if (txLockMsgLog.isDebugEnabled()) { * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @return Lock future. */ public GridDhtFuture lockAllAsyncInternal(@Nullable Collection keys, @@ -772,6 +774,7 @@ public GridDhtFuture lockAllAsyncInternal(@Nullable Collection(true); @@ -795,6 +798,7 @@ public GridDhtFuture lockAllAsyncInternal(@Nullable Collection lockAllAsync( req.accessTtl(), req.skipStore(), req.skipReadThrough(), + req.calciteOpCall(), req.keepBinary()); // Add before mapping. @@ -1051,6 +1056,7 @@ public IgniteInternalFuture lockAllAsync( req.accessTtl(), req.skipStore(), req.skipReadThrough(), + req.calciteOpCall(), req.keepBinary(), req.nearCache()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java index af3655f3b2ffb..391a12b824ce4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java @@ -561,6 +561,8 @@ private void addMapping( * @param accessTtl TTL for read operation. * @param needRetVal Return value flag. * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param keepBinary Keep binary flag. * @param nearCache {@code True} if near cache enabled on originating node. * @return Lock future. @@ -576,6 +578,7 @@ IgniteInternalFuture lockAllAsync( long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary, boolean nearCache ) { @@ -649,6 +652,7 @@ IgniteInternalFuture lockAllAsync( null, skipStore, skipReadThrough, + calciteOpCall, keepBinary, nearCache); @@ -693,6 +697,7 @@ IgniteInternalFuture lockAllAsync( accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); } catch (IgniteCheckedException e) { @@ -712,6 +717,7 @@ IgniteInternalFuture lockAllAsync( * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @return Future for lock acquisition. */ private IgniteInternalFuture obtainLockAsync( @@ -724,6 +730,7 @@ private IgniteInternalFuture obtainLockAsync( final long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary) { if (log.isDebugEnabled()) log.debug("Before acquiring transaction lock on keys [keys=" + passedKeys + ']'); @@ -755,6 +762,7 @@ private IgniteInternalFuture obtainLockAsync( accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); return new GridEmbeddedFuture<>( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index 7af5629a66818..f92f548fc3c4f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -498,7 +498,8 @@ private void onEntriesLocked() { if (retVal) { if (err != null || procRes != null) - ret.addEntryProcessResult(txEntry.context(), key, null, procRes, err, keepBinary); + ret.addEntryProcessResult(txEntry.context(), key, null, procRes, err, + txEntry.calciteOpCall() || keepBinary); else ret.invokeResult(true); } 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 0a4ace0489250..b7d8d732b4932 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 @@ -288,7 +288,8 @@ else if (res.error() != null) { AtomicApplicationAttributesAwareRequest req ) { if (req.applicationAttributes() != null) - ctx.operationContextPerCall(new CacheOperationContext().setApplicationAttributes(req.applicationAttributes())); + ctx.operationContextPerCall(CacheOperationContext.builder().applicationAttributes(req.applicationAttributes()) + .build()); try { processNearAtomicUpdateRequest(nodeId, req.payload()); @@ -1062,7 +1063,7 @@ private IgniteInternalFuture updateAll0( final CacheOperationContext opCtx = ctx.operationContextPerCall(); - if (opCtx != null && opCtx.hasDataCenterId()) { + if (opCtx != null && opCtx.dataCenterId() != null) { assert conflictPutVals == null : conflictPutVals; assert conflictRmvVals == null : conflictRmvVals; @@ -1111,7 +1112,8 @@ else if (op == GridCacheOperation.DELETE) { opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, - opCtx != null ? opCtx.applicationAttributes() : null); + opCtx != null ? opCtx.applicationAttributes() : null, + opCtx != null && opCtx.calciteEngine()); if (async) { return asyncOp(new CO>() { @@ -1254,7 +1256,7 @@ else if (proc != null) { GridCacheDrInfo conflictPutVal = null; GridCacheVersion conflictRmvVer = null; - if (opCtx != null && opCtx.hasDataCenterId()) { + if (opCtx != null && opCtx.dataCenterId() != null) { Byte dcId = opCtx.dataCenterId(); assert dcId != null; @@ -1299,7 +1301,8 @@ else if (op == GridCacheOperation.TRANSFORM) { opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, - opCtx != null ? opCtx.applicationAttributes() : null + opCtx != null ? opCtx.applicationAttributes() : null, + opCtx != null && opCtx.calciteEngine() ); } else { @@ -1322,7 +1325,8 @@ else if (op == GridCacheOperation.TRANSFORM) { opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, - opCtx != null ? opCtx.applicationAttributes() : null); + opCtx != null ? opCtx.applicationAttributes() : null, + opCtx != null && opCtx.calciteEngine()); } } @@ -1352,7 +1356,7 @@ private IgniteInternalFuture removeAllAsync0( Collection drVers = null; - if (opCtx != null && keys != null && opCtx.hasDataCenterId()) { + if (opCtx != null && keys != null && opCtx.dataCenterId() != null) { assert conflictMap == null : conflictMap; drVers = F.transform(keys, new C1() { @@ -1381,7 +1385,8 @@ private IgniteInternalFuture removeAllAsync0( opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, - opCtx != null ? opCtx.applicationAttributes() : null); + opCtx != null ? opCtx.applicationAttributes() : null, + opCtx != null && opCtx.calciteEngine()); if (async) { return asyncOp(new CO>() { @@ -2695,7 +2700,7 @@ else if (GridDhtCacheEntry.ReaderId.contains(readers, nearNode.id())) { null, compRes.get1(), compRes.get2(), - req.keepBinary()); + req.calciteOpCall() || req.keepBinary()); } } else { @@ -3174,7 +3179,8 @@ else if (req.operation() == UPDATE) { req.keepBinary(), req.recovery(), MAX_RETRIES, - opCtx == null ? null : opCtx.applicationAttributes()); + opCtx == null ? null : opCtx.applicationAttributes(), + req.calciteOpCall()); updateFut.map(); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java index a9b194b10e0ac..317b4ab7f1c34 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java @@ -150,6 +150,9 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture /** Operation result. */ protected GridCacheReturn opRes; + /** Calcite operation call. */ + protected boolean calciteOpCall; + /** * Constructor. * @@ -167,6 +170,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture * @param recovery {@code True} if cache operation is called in recovery mode. * @param remapCnt Remap count. * @param appAttrs Application attributes. + * @param calciteOpCall Calcite engine call flag. */ protected GridNearAtomicAbstractUpdateFuture( GridCacheContext cctx, @@ -183,7 +187,8 @@ protected GridNearAtomicAbstractUpdateFuture( boolean keepBinary, boolean recovery, int remapCnt, - @Nullable Map appAttrs + @Nullable Map appAttrs, + boolean calciteOpCall ) { if (log == null) { msgLog = cctx.shared().atomicMessageLogger(); @@ -209,6 +214,7 @@ protected GridNearAtomicAbstractUpdateFuture( this.remapCnt = remapCnt; this.appAttrs = appAttrs; + this.calciteOpCall = calciteOpCall; } /** @@ -360,7 +366,7 @@ final void completeFuture(@Nullable GridCacheReturn ret, Throwable err, @Nullabl : (this.retval || op == TRANSFORM) ? cctx.unwrapBinaryIfNeeded( ret.value(), - keepBinary, + calciteOpCall || keepBinary, U.deploymentClassLoader(cctx.kernalContext(), deploymentLdrId)) : ret.success(); @@ -911,7 +917,7 @@ protected abstract class UpdateReplyClosureContextAware implements GridDhtAtomic CacheOperationContext prevOpCtx = cctx.operationContextPerCall(); if (appAttrs != null) - cctx.operationContextPerCall(new CacheOperationContext().setApplicationAttributes(appAttrs)); + cctx.operationContextPerCall(CacheOperationContext.builder().applicationAttributes(appAttrs).build()); try { apply0(req, res); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java index 73a75435a5959..eb5f516b44c5a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java @@ -72,6 +72,9 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes /** */ private static final int SKIP_READ_THROUGH_FLAG_MASK = 0x100; + /** */ + private static final int CALCITE_OP_FLAG_MASK = 0x200; + /** Target node ID. */ protected UUID nodeId; @@ -152,6 +155,7 @@ protected GridNearAtomicAbstractUpdateRequest( * @param skipStore Skip write-through to a CacheStore flag. * @param keepBinary Keep binary flag. * @param recovery Recovery mode flag. + * @param calciteOpCall Calcite engine operation call. * @return Flags. */ static short flags( @@ -163,7 +167,8 @@ static short flags( boolean skipStore, boolean keepBinary, boolean recovery, - boolean skipReadThrough + boolean skipReadThrough, + boolean calciteOpCall ) { short flags = 0; @@ -194,6 +199,9 @@ static short flags( if (skipReadThrough) flags |= SKIP_READ_THROUGH_FLAG_MASK; + if (calciteOpCall) + flags |= CALCITE_OP_FLAG_MASK; + return flags; } @@ -356,6 +364,11 @@ public final boolean skipReadThrough() { return isFlag(SKIP_READ_THROUGH_FLAG_MASK); } + /** */ + public final boolean calciteOpCall() { + return isFlag(CALCITE_OP_FLAG_MASK); + } + /** * @return Keep binary flag. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java index e4ea94e5c80eb..b8acb21a8e733 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java @@ -82,6 +82,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda * @param keepBinary Keep binary flag. * @param recovery {@code True} if cache operation is called in recovery mode. * @param remapCnt Maximum number of retries. + * @param calciteOpCall Calcite engine operation call. */ public GridNearAtomicSingleUpdateFuture( GridCacheContext cctx, @@ -100,7 +101,8 @@ public GridNearAtomicSingleUpdateFuture( boolean keepBinary, boolean recovery, int remapCnt, - @Nullable Map appAttrs + @Nullable Map appAttrs, + boolean calciteOpCall ) { super(cctx, cache, @@ -116,7 +118,8 @@ public GridNearAtomicSingleUpdateFuture( keepBinary, recovery, remapCnt, - appAttrs); + appAttrs, + calciteOpCall); this.key = key; this.val = val; } @@ -553,7 +556,8 @@ private PrimaryRequestState mapSingleUpdate(AffinityTopologyVersion topVer, long skipStore, keepBinary, recovery, - skipReadThrough); + skipReadThrough, + calciteOpCall); if (canUseSingleRequest()) { if (op == TRANSFORM) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java index 9a062e60fc748..06c10eeed8755 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java @@ -111,6 +111,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu * @param keepBinary Keep binary flag. * @param remapCnt Maximum number of retries. * @param appAttrs Application attributes. + * @param calciteOpCall Calcite engine call flag. */ public GridNearAtomicUpdateFuture( GridCacheContext cctx, @@ -131,7 +132,8 @@ public GridNearAtomicUpdateFuture( boolean keepBinary, boolean recovery, int remapCnt, - @Nullable Map appAttrs + @Nullable Map appAttrs, + boolean calciteOpCall ) { super( cctx, @@ -148,7 +150,8 @@ public GridNearAtomicUpdateFuture( keepBinary, recovery, remapCnt, - appAttrs); + appAttrs, + calciteOpCall); assert vals == null || vals.size() == keys.size(); assert conflictPutVals == null || conflictPutVals.size() == keys.size(); @@ -1001,7 +1004,8 @@ else if (conflictRmvVals != null) { skipStore, keepBinary, recovery, - skipReadThrough); + skipReadThrough, + calciteOpCall); GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest( cctx.cacheId(), @@ -1114,7 +1118,8 @@ else if (conflictRmvVals != null) { skipStore, keepBinary, recovery, - skipReadThrough); + skipReadThrough, + calciteOpCall); GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest( cctx.cacheId(), diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index 9109e5b49a579..03f93d95ef979 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -205,6 +205,7 @@ public GridDistributedCacheEntry entryExx( false, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), recovery, readRepairStrategy, needVer); @@ -308,6 +309,7 @@ public GridDistributedCacheEntry entryExx( false, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), recovery, readRepairStrategy, needVer); @@ -661,6 +663,7 @@ else if (!skipVals && ctx.statisticsEnabled()) accessTtl, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery()); @@ -903,6 +906,7 @@ public void removeLocks(long threadId, GridCacheVersion ver, Collection lockAllAsync( @@ -919,6 +923,7 @@ IgniteInternalFuture lockAllAsync( final long accessTtl, final boolean skipStore, final boolean skipReadThrough, + boolean calciteOpCall, final boolean keepBinary ) { assert keys != null; @@ -944,6 +949,7 @@ IgniteInternalFuture lockAllAsync( accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); } else { @@ -966,6 +972,7 @@ IgniteInternalFuture lockAllAsync( accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); } } @@ -986,6 +993,8 @@ IgniteInternalFuture lockAllAsync( * @param createTtl TTL for create operation. * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @return Lock future. */ private IgniteInternalFuture lockAllAsync0( @@ -1002,6 +1011,7 @@ private IgniteInternalFuture lockAllAsync0( final long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary) { int cnt = keys.size(); @@ -1020,6 +1030,7 @@ private IgniteInternalFuture lockAllAsync0( accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); // Add before mapping. @@ -1089,6 +1100,7 @@ else if (!b) accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); return new GridDhtEmbeddedFuture<>( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java index 6bf6c13aedc80..775463af60f60 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java @@ -170,6 +170,9 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF /** Skip read-through cache store flag. */ private final boolean skipReadThrough; + /** Calcite engine operation flag. */ + private final boolean calciteOpCall; + /** */ private Deque mappings; @@ -198,6 +201,8 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF * @param createTtl TTL for create operation. * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. */ public GridDhtColocatedLockFuture( GridCacheContext cctx, @@ -210,6 +215,7 @@ public GridDhtColocatedLockFuture( long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary, boolean recovery ) { @@ -229,6 +235,7 @@ public GridDhtColocatedLockFuture( this.skipReadThrough = skipReadThrough; this.keepBinary = keepBinary; this.recovery = recovery; + this.calciteOpCall = calciteOpCall; ignoreInterrupts(); @@ -990,8 +997,6 @@ private synchronized void map0( if (log.isDebugEnabled()) log.debug("Starting (re)map for mappings [mappings=" + mappings + ", fut=" + this + ']'); - boolean hasRmtNodes = false; - boolean first = true; // Create mini futures. @@ -1086,6 +1091,7 @@ private synchronized void map0( read ? accessTtl : -1L, skipStore, skipReadThrough, + calciteOpCall, keepBinary, clientFirst, false, @@ -1128,11 +1134,8 @@ private synchronized void map0( } } - if (!distributedKeys.isEmpty()) { + if (!distributedKeys.isEmpty()) mapping.distributedKeys(distributedKeys); - - hasRmtNodes |= !mapping.node().isLocal(); - } else { assert mapping.request() == null; @@ -1259,6 +1262,7 @@ private void lockLocally( accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); // Add new future. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java index 6a5df13cd5a4a..9a0d38bbed7db 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java @@ -160,6 +160,9 @@ public final class GridNearLockFuture extends GridCacheCompoundIdentityFuture mappings; @@ -183,6 +186,8 @@ public final class GridNearLockFuture extends GridCacheCompoundIdentityFuture keys, boolean remap, boolean topLocked read ? accessTtl : -1L, skipStore, skipReadThrough, + calciteOpCall, keepBinary, clientFirst, true, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java index a6f63d1312253..cfe6f7a4b2d19 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java @@ -130,6 +130,7 @@ public GridNearLockRequest( long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary, boolean firstClientReq, boolean nearCache, @@ -151,6 +152,7 @@ public GridNearLockRequest( txSize, skipStore, skipReadThrough, + calciteOpCall, keepBinary); assert topVer.compareTo(AffinityTopologyVersion.ZERO) > 0; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java index 72c4f540b7acc..b4cd4cfe2e60e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java @@ -495,7 +495,7 @@ private void proceedPrepare(final Queue mappings) { } /** - * Continues prepare after previous mapping successfully finished. + * Continues to prepare after previous mapping successfully finished. * * @param m Mapping. * @param mappings Queue of mappings. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index e6b2678065926..0c330dc771173 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -133,6 +133,7 @@ public void dht(GridDhtCache dht) { final boolean skipStore = opCtx != null && opCtx.skipStore(); final boolean skipReadThrough = opCtx != null && opCtx.skipReadThrough(); + boolean calciteOpCall = opCtx != null && opCtx.calciteEngine(); if (tx != null && !tx.implicit() && !skipTx) { return asyncOp(tx, new AsyncOp>(keys) { @@ -145,6 +146,7 @@ public void dht(GridDhtCache dht) { false, skipStore, skipReadThrough, + calciteOpCall, recovery, readRepairStrategy, needVer); @@ -307,6 +309,7 @@ private void processLockResponse(UUID nodeId, GridNearLockResponse res) { accessTtl, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 04183f5c45431..381107ae40a46 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -623,6 +623,7 @@ private IgniteInternalFuture putAsync0( ret, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), keepBinary, opCtx != null && opCtx.recovery(), dataCenterId); @@ -750,7 +751,7 @@ private IgniteInternalFuture putAllAsync0( final Byte dataCenterId; - if (opCtx != null && opCtx.hasDataCenterId()) { + if (opCtx != null && opCtx.dataCenterId() != null) { assert drMap == null : drMap; dataCenterId = opCtx.dataCenterId(); @@ -799,6 +800,7 @@ private IgniteInternalFuture putAllAsync0( null, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), false, keepBinary, opCtx != null && opCtx.recovery(), @@ -899,6 +901,7 @@ private IgniteInternalFuture putAllAsync0( * @param ret Return value. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param recovery Recovery flag. * @param dataCenterId Optional data center Id. * @return Future for entry values loading. @@ -916,6 +919,7 @@ private IgniteInternalFuture enlistWrite( final GridCacheReturn ret, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary, boolean recovery, Byte dataCenterId) { @@ -954,6 +958,7 @@ private IgniteInternalFuture enlistWrite( /*enlisted*/null, skipStore, skipReadThrough, + calciteOpCall, false, hasFilters, needVal, @@ -1021,6 +1026,7 @@ private IgniteInternalFuture enlistWrite( * @param drRmvMap DR remove map (optional). * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param singleRmv {@code True} for single key remove operation ({@link Cache#remove(Object)}. * @param keepBinary Keep binary flag. * @param recovery Recovery flag. @@ -1043,6 +1049,7 @@ private IgniteInternalFuture enlistWrite( @Nullable Map drRmvMap, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, final boolean singleRmv, final boolean keepBinary, final boolean recovery, @@ -1148,6 +1155,7 @@ else if (dataCenterId != null) { enlisted, skipStore, skipReadThrough, + calciteOpCall, singleRmv, hasFilters, needVal, @@ -1220,6 +1228,7 @@ else if (dataCenterId != null) { * @param enlisted Enlisted keys collection. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param singleRmv {@code True} for single remove operation. * @param hasFilters {@code True} if filters not empty. * @param needVal {@code True} if value is needed. @@ -1243,6 +1252,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, @Nullable final Collection enlisted, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean singleRmv, boolean hasFilters, final boolean needVal, @@ -1363,6 +1373,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, drVer, skipStore, skipReadThrough, + calciteOpCall, keepBinary, CU.isNearEnabled(cacheCtx)); } @@ -1380,6 +1391,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, null, skipStore, skipReadThrough, + calciteOpCall, keepBinary, CU.isNearEnabled(cacheCtx)); } @@ -1417,6 +1429,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, drVer, skipStore, skipReadThrough, + calciteOpCall, keepBinary, CU.isNearEnabled(cacheCtx)); @@ -1537,6 +1550,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, drVer, skipStore, skipReadThrough, + calciteOpCall, keepBinary, CU.isNearEnabled(cacheCtx)); @@ -1619,7 +1633,7 @@ private IgniteInternalFuture removeAllAsync0( final Byte dataCenterId; - if (opCtx != null && opCtx.hasDataCenterId()) { + if (opCtx != null && opCtx.dataCenterId() != null) { assert drMap == null : drMap; dataCenterId = opCtx.dataCenterId(); @@ -1689,6 +1703,7 @@ private IgniteInternalFuture removeAllAsync0( drMap, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), + opCtx != null && opCtx.calciteEngine(), singleRmv, keepBinary, opCtx != null && opCtx.recovery(), @@ -1825,6 +1840,7 @@ private IgniteInternalFuture removeAllAsync0( * @param keepCacheObjects Keep cache objects * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param readRepairStrategy Read Repair strategy. * @return Future for this get. */ @@ -1838,6 +1854,7 @@ public IgniteInternalFuture> getAllAsync( final boolean keepCacheObjects, final boolean skipStore, final boolean skipReadThrough, + boolean calciteOpCall, final boolean recovery, final ReadRepairStrategy readRepairStrategy, final boolean needVer) { @@ -1881,6 +1898,7 @@ public IgniteInternalFuture> getAllAsync( keepCacheObjects, skipStore, skipReadThrough, + calciteOpCall, recovery, readRepairStrategy, needVer); @@ -2069,6 +2087,7 @@ public IgniteInternalFuture> getAllAsync( null, skipStore, skipReadThrough, + calciteOpCall, !deserializeBinary, recovery, null); @@ -2203,6 +2222,7 @@ public IgniteInternalFuture> getAllAsync( * @param keepCacheObjects Keep cache objects flag. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param recovery Recovery flag. * @return Enlisted keys. * @throws IgniteCheckedException If failed. @@ -2221,6 +2241,7 @@ private Collection enlistRead( boolean keepCacheObjects, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean recovery, ReadRepairStrategy readRepairStrategy, final boolean needVer @@ -2469,6 +2490,7 @@ private Collection enlistRead( null, skipStore, skipReadThrough, + calciteOpCall, !deserializeBinary, CU.isNearEnabled(cacheCtx)); @@ -4199,6 +4221,7 @@ public IgniteInternalFuture rollbackAsyncLocal() { * @param Key type. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param keepBinary Keep binary flag. * @return Future with respond. */ @@ -4210,6 +4233,7 @@ public IgniteInternalFuture lockAllAsync(GridCacheContext c long accessTtl, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary) { assert pessimistic(); @@ -4246,6 +4270,7 @@ public IgniteInternalFuture lockAllAsync(GridCacheContext c accessTtl, skipStore, skipReadThrough, + calciteOpCall, keepBinary); return new GridEmbeddedFuture<>( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java index c4f024b2d25b0..0dc68edec2509 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java @@ -93,6 +93,9 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message { /** Skip read-through cache store flag bit mask. */ private static final int TX_ENTRY_SKIP_READ_THROUGH_FLAG_MASK = 1 << 5; + /** Calcite engine operation call flag bit mask. */ + private static final int CALCITE_OP_CALL_FLAG_MASK = 1 << 6; + /** Prepared flag updater. */ private static final AtomicIntegerFieldUpdater PREPARED_UPD = AtomicIntegerFieldUpdater.newUpdater(IgniteTxEntry.class, "prepared"); @@ -280,6 +283,7 @@ public IgniteTxEntry(GridCacheContext ctx, * @param conflictVer Data center replication version. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @param addReader Add reader flag. */ public IgniteTxEntry(GridCacheContext ctx, @@ -294,6 +298,7 @@ public IgniteTxEntry(GridCacheContext ctx, GridCacheVersion conflictVer, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary, boolean addReader ) { @@ -312,6 +317,7 @@ public IgniteTxEntry(GridCacheContext ctx, skipStore(skipStore); skipReadThrough(skipReadThrough); + calciteOpCall(calciteOpCall); keepBinary(keepBinary); addReader(addReader); @@ -618,12 +624,24 @@ public void skipReadThrough(boolean skipReadThrough) { } /** - * @return Skip store flag. + * @return Skip read through flag. */ public boolean skipReadThrough() { return isFlag(TX_ENTRY_SKIP_READ_THROUGH_FLAG_MASK); } + /** Sets calcite operation flag. */ + public void calciteOpCall(boolean calciteOpCall) { + setFlag(calciteOpCall, CALCITE_OP_CALL_FLAG_MASK); + } + + /** + * @return Calcite engine operation flag. + */ + public boolean calciteOpCall() { + return isFlag(CALCITE_OP_CALL_FLAG_MASK); + } + /** * @param oldValOnPrimary {@code True} If old value for was non null on primary node. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index bf2ea8938c245..df4a87a11720b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -1338,6 +1338,8 @@ protected void checkValid(boolean checkTimeout) throws IgniteCheckedException { * @param drExpireTime DR expire time (if any). * @param drVer DR version. * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param calciteOpCall Calcite engine operation call. * @return Transaction entry. */ public final IgniteTxEntry addEntry(GridCacheOperation op, @@ -1353,6 +1355,7 @@ public final IgniteTxEntry addEntry(GridCacheOperation op, @Nullable GridCacheVersion drVer, boolean skipStore, boolean skipReadThrough, + boolean calciteOpCall, boolean keepBinary, boolean addReader ) { @@ -1392,9 +1395,10 @@ public final IgniteTxEntry addEntry(GridCacheOperation op, old.cached(entry); old.filters(filter); - // Keep old skipStore and keepBinary flags. + // Keep old flags. old.skipStore(skipStore); old.skipReadThrough(skipReadThrough); + old.calciteOpCall(calciteOpCall); old.keepBinary(keepBinary); // Update ttl if specified. @@ -1426,6 +1430,7 @@ public final IgniteTxEntry addEntry(GridCacheOperation op, drVer, skipStore, skipReadThrough, + calciteOpCall, keepBinary, addReader); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java index fd144b035c639..3f1456e2155e1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java @@ -433,17 +433,10 @@ protected GridCacheQueueAdapter(String queueName, GridCacheQueueHeader hdr, Grid if (opCtx != null && opCtx.isKeepBinary()) return (GridCacheQueueAdapter)this; - opCtx = opCtx == null ? new CacheOperationContext( - false, - false, - true, - null, - false, - null, - false, - null, - null) - : opCtx.keepBinary(); + if (opCtx == null) + opCtx = CacheOperationContext.builder().keepBinary(true).build(); + else + opCtx = opCtx.withKeepBinary(); cctx.operationContextPerCall(opCtx); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 669aa52dda523..8a50386849e33 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -751,8 +751,10 @@ private IgniteInternalFuture executeCommand( destId == null || destId.equals(ctx.localNodeId()) || replicatedCacheAvailable(cacheName); if (locExec) { - IgniteInternalCache prj = localCache(cacheName) - .setSkipStore(cacheFlags.contains(SKIP_STORE)); + IgniteInternalCache prj = localCache(cacheName); + + if (cacheFlags.contains(SKIP_STORE)) + prj = prj.withSkipStore(); if (cacheFlags.contains(KEEP_BINARIES)) prj = prj.keepBinary(); @@ -919,8 +921,10 @@ private FlaggedCacheOperationCallable(String cacheName, /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { - IgniteInternalCache prj = cache(g, cacheName) - .setSkipStore(cacheFlags.contains(SKIP_STORE)); + IgniteInternalCache prj = cache(g, cacheName); + + if (cacheFlags.contains(SKIP_STORE)) + prj = prj.withSkipStore(); if (cacheFlags.contains(KEEP_BINARIES)) prj = prj.keepBinary(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java index f4e290d86c084..90c881d7582bf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java @@ -282,10 +282,6 @@ private static class TestableCacheCommandHandler extends GridCacheCommandHandler return fut; } - // Rewriting flagOn result to keep intercepting invocations after it. - if ("setSkipStore".equals(mtd.getName())) - return proxy; - if ("forSubjectId".equals(mtd.getName())) return proxy; diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java index 95122b2e42936..08b7caf38871e 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java @@ -555,9 +555,9 @@ public static CacheOperationContext setKeepBinaryContext(GridCacheContext if (opCtx == null) // Mimics behavior of GridCacheAdapter#keepBinary and GridCacheProxyImpl#keepBinary - newOpCtx = new CacheOperationContext(false, false, true, null, false, null, false, null, null); + newOpCtx = CacheOperationContext.builder().keepBinary(true).build(); else if (!opCtx.isKeepBinary()) - newOpCtx = opCtx.keepBinary(); + newOpCtx = opCtx.withKeepBinary(); if (newOpCtx != null) cctx.operationContextPerCall(newOpCtx); From 4ebe96cea10ba2911df49ce1dd09bbdbfdfd74d5 Mon Sep 17 00:00:00 2001 From: zstan Date: Mon, 15 Jun 2026 08:41:11 +0300 Subject: [PATCH 2/5] work well --- .../jmh/sql/JmhSqlAbstractBenchmark.java | 6 ---- .../query/calcite/exec/rel/ModifyNode.java | 6 ++-- .../processors/cache/GridCacheEntryEx.java | 6 ++++ .../processors/cache/GridCacheMapEntry.java | 35 ++++++++++++------- .../GridDistributedTxRemoteAdapter.java | 3 ++ .../GridDhtAtomicAbstractUpdateRequest.java | 11 ++++++ .../dht/atomic/GridDhtAtomicCache.java | 7 ++-- .../GridDhtAtomicSingleUpdateFuture.java | 2 ++ .../GridDhtAtomicSingleUpdateRequest.java | 2 ++ .../dht/atomic/GridDhtAtomicUpdateFuture.java | 1 + .../atomic/GridDhtAtomicUpdateRequest.java | 2 ++ .../distributed/near/GridNearAtomicCache.java | 4 +++ .../transactions/IgniteTxLocalAdapter.java | 4 +++ .../cache/GridCacheTestEntryEx.java | 9 +++-- .../consistency/ReadRepairDataGenerator.java | 2 ++ .../dump/IgniteCacheDumpSelf2Test.java | 1 + 16 files changed, 73 insertions(+), 28 deletions(-) diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAbstractBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAbstractBenchmark.java index c30f61dc1020b..802f194e59d4d 100644 --- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAbstractBenchmark.java +++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/sql/JmhSqlAbstractBenchmark.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.benchmarks.jmh.sql; import java.util.List; -import java.util.concurrent.TimeUnit; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteDataStreamer; @@ -49,11 +48,6 @@ /** * Abstract SQL queries benchmark. */ -@Fork(1) -@BenchmarkMode(Mode.Throughput) -@OutputTimeUnit(TimeUnit.SECONDS) -@Warmup(iterations = 3, time = 5) -@Measurement(iterations = 3, time = 5) @State(Scope.Benchmark) public abstract class JmhSqlAbstractBenchmark { /** Count of server nodes. */ 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 f055981440e86..dfd24896c93bc 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 @@ -232,16 +232,14 @@ private void flushTuples(boolean force) throws Exception { this.tuples = new ArrayList<>(MODIFY_BATCH_SIZE); GridCacheContext cctx = desc.cacheContext(); - IgniteInternalCache cache = cctx.cache(); + IgniteInternalCache cache = cctx.cache().keepBinary(); GridNearTxLocal tx = Commons.queryTransaction(context(), cctx.shared()); QueryProperties props = context().unwrap(QueryProperties.class); boolean keepBinaryMode = props == null || props.keepBinary(); if (keepBinaryMode) - cache = cache.keepBinary(); - - cache = cache.withCalciteEngine(); + cache = cache.withCalciteEngine(); if (tx == null) invokeOutsideTransaction(tuples, cache); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java index ccd41cd6e5050..0be78a4ec74c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java @@ -336,6 +336,7 @@ public EntryGetResult innerGetAndReserveForLoad(boolean updateMetrics, * @param drType DR type. * @param drExpireTime DR expire time (if any). * @param explicitVer Explicit version (if any). + * @param unwrapVal {@code true} if value need to be unwrapped. * @param taskName Task name. * @param dhtVer Dht version for near cache entry. * @param updateCntr Update counter. @@ -355,6 +356,7 @@ public GridCacheUpdateTxResult innerSet( boolean evt, boolean metrics, boolean keepBinary, + boolean unwrapVal, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, @@ -374,6 +376,7 @@ public GridCacheUpdateTxResult innerSet( * @param evt Flag to signal event notification. * @param metrics Flag to signal metrics notification. * @param keepBinary Keep binary flag. + * @param unwrapVal {@code true} if value need to be unwrapped. * @param oldValPresent {@code True} if oldValue present. * @param oldVal Old value. * @param topVer Topology version. @@ -394,6 +397,7 @@ public GridCacheUpdateTxResult innerRemove( boolean evt, boolean metrics, boolean keepBinary, + boolean unwrapVal, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, @@ -433,6 +437,7 @@ public GridCacheUpdateTxResult innerRemove( * @param updateCntr Update counter. * @param fut Dht atomic future. * @param transformOp {@code True} if transform operation caused update. + * @param unwrapVal {@code true} if value need to be unwrapped. * @return Tuple where first value is flag showing whether operation succeeded, * second value is old entry value if return value is requested, third is updated entry value, * fourth is the version to enqueue for deferred delete the fifth is DR conflict context @@ -452,6 +457,7 @@ public GridCacheUpdateAtomicResult innerUpdate( boolean readThrough, boolean retval, boolean keepBinary, + boolean unwrapVal, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index 161a25feb9da5..d45c3bb412d86 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -990,6 +990,7 @@ protected void recordNodeId(UUID nodeId, AffinityTopologyVersion topVer) { boolean evt, boolean metrics, boolean keepBinary, + boolean unwrapVal, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, @@ -1056,7 +1057,7 @@ protected void recordNodeId(UUID nodeId, AffinityTopologyVersion topVer) { intercept = !skipInterceptor(explicitVer); if (intercept) { - val0 = cctx.unwrapBinaryIfNeeded(val, keepBinary, false, null); + val0 = cctx.unwrapBinaryIfNeeded(val, unwrapVal, false, null); CacheLazyEntry e = new CacheLazyEntry(cctx, key, old, keepBinary); @@ -1205,6 +1206,7 @@ protected Object keyValue(boolean cpy) { boolean evt, boolean metrics, boolean keepBinary, + boolean unwrapVal, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, @@ -1274,15 +1276,12 @@ protected Object keyValue(boolean cpy) { intercept = !skipInterceptor(explicitVer); if (intercept) { - entry0 = new CacheLazyEntry(cctx, key, old, keepBinary); + entry0 = new CacheLazyEntry(cctx, key, old, unwrapVal); interceptRes = cctx.config().getInterceptor().onBeforeRemove(entry0); - if (cctx.cancelRemove(interceptRes)) { - CacheObject ret = cctx.toCacheObject(cctx.unwrapTemporary(interceptRes.get2())); - + if (cctx.cancelRemove(interceptRes)) return new GridCacheUpdateTxResult(false, logPtr); - } } DumpEntryChangeListener dumpLsnr = cctx.dumpListener(); @@ -1448,6 +1447,7 @@ else if (log.isDebugEnabled()) final boolean readThrough, final boolean retval, final boolean keepBinary, + boolean unwrapVal, @Nullable final IgniteCacheExpiryPolicy expiryPlc, final boolean evt, final boolean metrics, @@ -1501,6 +1501,7 @@ else if (log.isDebugEnabled()) readFromStore, writeThrough, keepBinary, + unwrapVal, expiryPlc, primary, verCheck, @@ -4520,6 +4521,9 @@ private static class AtomicCacheUpdateClosure implements IgniteCacheOffheapManag /** */ private final boolean keepBinary; + /** */ + private final boolean unwrapVal; + /** */ private final IgniteCacheExpiryPolicy expiryPlc; @@ -4585,6 +4589,7 @@ private static class AtomicCacheUpdateClosure implements IgniteCacheOffheapManag boolean readThrough, boolean writeThrough, boolean keepBinary, + boolean unwrapVal, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean primary, boolean verCheck, @@ -4608,6 +4613,7 @@ private static class AtomicCacheUpdateClosure implements IgniteCacheOffheapManag this.readThrough = readThrough; this.writeThrough = writeThrough; this.keepBinary = keepBinary; + this.unwrapVal = unwrapVal; this.expiryPlc = expiryPlc; this.primary = primary; this.verCheck = verCheck; @@ -4807,12 +4813,12 @@ else if ((invokeRes == null || invokeRes.getValue() == null) && writeObj != null if (op == UPDATE) { assert writeObj != null; - update(conflictCtx, invokeRes, storeLoadedVal != null, transformed); + update(conflictCtx, invokeRes, storeLoadedVal != null, unwrapVal, transformed); } else { assert op == DELETE && writeObj == null : op; - remove(conflictCtx, invokeRes, storeLoadedVal != null, transformed); + remove(conflictCtx, invokeRes, storeLoadedVal != null, unwrapVal, transformed); } assert updateRes != null && treeOp != null; @@ -4937,12 +4943,14 @@ else if (updateExpireTime && expiryPlc != null && entry.val != null) { * @param conflictCtx Conflict context. * @param invokeRes Entry processor result (for invoke operation). * @param readFromStore {@code True} if initial entry value was {@code null} and it was read from store. + * @param unwrapVal {@code true} if value need to be unwrapped. * @param transformed {@code True} if update caused by transformation operation. * @throws IgniteCheckedException If failed. */ private void update(@Nullable GridCacheVersionConflictContext conflictCtx, @Nullable IgniteBiTuple invokeRes, boolean readFromStore, + boolean unwrapVal, boolean transformed) throws IgniteCheckedException { GridCacheContext cctx = entry.context(); @@ -4999,18 +5007,18 @@ else if (newSysTtl == CU.TTL_ZERO) { writeObj = null; - remove(conflictCtx, invokeRes, readFromStore, false); + remove(conflictCtx, invokeRes, readFromStore, unwrapVal, false); return; } if (intercept && (conflictVer == null || !skipInterceptorOnConflict)) { - Object updated0 = cctx.unwrapBinaryIfNeeded(updated, keepBinary, false, null); + Object updated0 = cctx.unwrapBinaryIfNeeded(updated, unwrapVal, false, null); CacheLazyEntry interceptEntry = - new CacheLazyEntry<>(cctx, entry.key, null, oldVal, null, keepBinary); + new CacheLazyEntry<>(cctx, entry.key, null, oldVal, null, unwrapVal); - Object interceptorVal = null; + Object interceptorVal; try { interceptorVal = cctx.config().getInterceptor().onBeforePut(interceptEntry, updated0); @@ -5125,6 +5133,7 @@ else if (interceptorVal != updated0) { private void remove(@Nullable GridCacheVersionConflictContext conflictCtx, @Nullable IgniteBiTuple invokeRes, boolean readFromStore, + boolean unwrapVal, boolean transformed) throws IgniteCheckedException { GridCacheContext cctx = entry.context(); @@ -5135,7 +5144,7 @@ private void remove(@Nullable GridCacheVersionConflictContext conflictCtx, if (intercept && (conflictVer == null || !skipInterceptorOnConflict)) { CacheLazyEntry intercepEntry = - new CacheLazyEntry<>(cctx, entry.key, null, oldVal, null, keepBinary); + new CacheLazyEntry<>(cctx, entry.key, null, oldVal, null, unwrapVal); interceptRes = cctx.config().getInterceptor().onBeforeRemove(intercepEntry); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java index 7c83c0cc3a95e..2f60e5aec0e6b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java @@ -617,6 +617,7 @@ else if (conflictCtx.isMerge()) { true, true, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -638,6 +639,7 @@ else if (conflictCtx.isMerge()) { true, true, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -675,6 +677,7 @@ else if (op == DELETE) { true, true, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java index 5ed0e22d39ef3..689e03c7417cd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java @@ -58,6 +58,9 @@ public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheIdMess /** Flag indicating recovery on read repair. */ protected static final int DHT_ATOMIC_READ_REPAIR_RECOVERY_FLAG_MASK = 0x80; + /** */ + protected static final int DHT_ATOMIC_UNWRAP_VALUE_FLAG_MASK = 0x100; + /** Message index. */ public static final int CACHE_MSG_IDX = nextIndexId(); @@ -115,6 +118,7 @@ protected GridDhtAtomicAbstractUpdateRequest(int cacheId, @NotNull AffinityTopologyVersion topVer, int taskNameHash, boolean keepBinary, + boolean unwrapVal, boolean skipStore, boolean readRepairRecovery ) { @@ -133,6 +137,8 @@ protected GridDhtAtomicAbstractUpdateRequest(int cacheId, setFlag(true, DHT_ATOMIC_KEEP_BINARY_FLAG_MASK); if (readRepairRecovery) setFlag(true, DHT_ATOMIC_READ_REPAIR_RECOVERY_FLAG_MASK); + if (unwrapVal) + setFlag(true, DHT_ATOMIC_UNWRAP_VALUE_FLAG_MASK); } /** {@inheritDoc} */ @@ -198,6 +204,11 @@ public final boolean keepBinary() { return isFlag(DHT_ATOMIC_KEEP_BINARY_FLAG_MASK); } + /** */ + public final boolean unwrapValue() { + return isFlag(DHT_ATOMIC_UNWRAP_VALUE_FLAG_MASK); + } + /** * @return Recovery on Read Repair flag. */ 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 b7d8d732b4932..9548aba55b801 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 @@ -2257,7 +2257,7 @@ private void updateWithBatch( if (updated == null) { if (intercept) { - CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.keepBinary()); + CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.calciteOpCall()); IgniteBiTuple interceptorRes = ctx.config().getInterceptor().onBeforeRemove(e); @@ -2302,7 +2302,7 @@ private void updateWithBatch( } else { if (intercept) { - CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.keepBinary()); + CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.calciteOpCall()); Object val = ctx.config().getInterceptor().onBeforePut(e, updatedVal); @@ -2585,6 +2585,7 @@ private void updateSingle( !req.skipStore() && !req.skipReadThrough(), sndPrevVal || req.returnValue(), req.keepBinary(), + req.calciteOpCall(), expiry, /*event*/true, /*metrics*/true, @@ -2870,6 +2871,7 @@ else if (GridDhtCacheEntry.ReaderId.contains(readers, nearNode.id())) { /*read-through*/false, /*retval*/sndPrevVal, req.keepBinary(), + req.calciteOpCall(), expiry, /*event*/true, /*metrics*/true, @@ -3342,6 +3344,7 @@ && writeThrough() && !req.skipStore(), /*read-through*/false, /*retval*/false, req.keepBinary(), + req.unwrapValue(), /*expiry policy*/null, /*event*/true, /*metrics*/true, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java index f212c95b8a353..a10cb27cf94b3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java @@ -91,6 +91,7 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture topVer, updateReq.taskNameHash(), updateReq.keepBinary(), + updateReq.calciteOpCall(), updateReq.skipStore(), readRepairRecovery); } @@ -104,6 +105,7 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture updateReq.taskNameHash(), null, updateReq.keepBinary(), + updateReq.calciteOpCall(), updateReq.skipStore(), false, readRepairRecovery); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java index 20aad2f7dec8b..aac5ed31f8db3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java @@ -87,6 +87,7 @@ public GridDhtAtomicSingleUpdateRequest() { @NotNull AffinityTopologyVersion topVer, int taskNameHash, boolean keepBinary, + boolean unwrapVal, boolean skipStore, boolean readRepairRecovery ) { @@ -97,6 +98,7 @@ public GridDhtAtomicSingleUpdateRequest() { topVer, taskNameHash, keepBinary, + unwrapVal, skipStore, readRepairRecovery); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java index a2814d0a9adb4..88d744fae432b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java @@ -89,6 +89,7 @@ class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture { updateReq.taskNameHash(), null, updateReq.keepBinary(), + updateReq.calciteOpCall(), updateReq.skipStore(), false, readRepairRecovery); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 4d06d1705daaf..eeb8add47023d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -153,6 +153,7 @@ public GridDhtAtomicUpdateRequest( int taskNameHash, Object[] invokeArgs, boolean keepBinary, + boolean unwrapVal, boolean skipStore, boolean forceTransformBackups, boolean readRepairRecovery @@ -164,6 +165,7 @@ public GridDhtAtomicUpdateRequest( topVer, taskNameHash, keepBinary, + unwrapVal, skipStore, readRepairRecovery); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java index 0fb4f1b537293..131a14d7a3e1c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java @@ -206,6 +206,7 @@ public void processNearAtomicUpdateResponse( ttl, expireTime, req.keepBinary(), + req.calciteOpCall(), req.nodeId(), taskName, req.operation() == TRANSFORM); @@ -234,6 +235,7 @@ private void processNearAtomicUpdateResponse( long ttl, long expireTime, boolean keepBinary, + boolean unwrapVal, UUID nodeId, String taskName, boolean transformedValue) throws IgniteCheckedException { @@ -259,6 +261,7 @@ private void processNearAtomicUpdateResponse( /*read-through*/false, /*retval*/false, keepBinary, + unwrapVal, /*expiry policy*/null, /*event*/true, /*metrics*/true, @@ -363,6 +366,7 @@ private void processNearAtomicUpdateResponse( /*read-through*/false, /*retval*/false, req.keepBinary(), + req.unwrapValue(), null, /*event*/true, /*metrics*/true, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index df4a87a11720b..2cedc84fb637f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -693,6 +693,7 @@ else if (conflictCtx.isUseNew()) { evt, metrics, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -725,6 +726,7 @@ else if (conflictCtx.isUseNew()) { false, metrics0, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -746,6 +748,7 @@ else if (op == DELETE) { evt, metrics, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -773,6 +776,7 @@ else if (op == DELETE) { false, metrics0, txEntry.keepBinary(), + txEntry.calciteOpCall(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java index f7a399dfab6b1..4c864b67c4e3a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java @@ -448,6 +448,7 @@ void recheckLock() { boolean evt, boolean metrics, boolean keepBinary, + boolean unwrapVal, boolean hasOldVal, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, @@ -457,7 +458,7 @@ void recheckLock() { String taskName, @Nullable GridCacheVersion dhtVer, @Nullable Long updateCntr - ) throws IgniteCheckedException, GridCacheEntryRemovedException { + ) { rawPut(val, ttl); return new GridCacheUpdateTxResult(true); @@ -475,6 +476,7 @@ void recheckLock() { boolean readThrough, boolean retval, boolean keepBinary, + boolean unwrapVal, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, @@ -493,8 +495,8 @@ void recheckLock() { @Nullable CacheObject prevVal, @Nullable Long updateCntr, @Nullable GridDhtAtomicAbstractUpdateFuture fut, - boolean transformOp) - throws IgniteCheckedException, GridCacheEntryRemovedException { + boolean transformOp + ) { assert false; return null; @@ -509,6 +511,7 @@ void recheckLock() { boolean evt, boolean metrics, boolean keepBinary, + boolean unwrapVal, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java index 441fbbcc267cf..5bd92eca36516 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java @@ -372,6 +372,7 @@ private InconsistentMapping setDifferentValuesForSameKey( false, false, false, + false, null, false, false, @@ -408,6 +409,7 @@ private InconsistentMapping setDifferentValuesForSameKey( false, false, false, + false, null, AffinityTopologyVersion.NONE, GridDrType.DR_NONE, diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java index 991a89bfd1af7..782b67148becc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java @@ -706,6 +706,7 @@ public void testCheckFailOnCorruptedData() throws Exception { false, false, false, + false, null, false, false, From b385185e67c7479ffa91302d86af8e1f8bfb5a59 Mon Sep 17 00:00:00 2001 From: zstan Date: Mon, 15 Jun 2026 10:23:10 +0300 Subject: [PATCH 3/5] rename flags, move logic to interceptor --- .../query/calcite/exec/rel/ModifyNode.java | 2 +- .../cache/CacheOperationContext.java | 52 +++++++++---------- .../cache/GatewayProtectedCacheProxy.java | 3 +- .../processors/cache/GridCacheAdapter.java | 8 +-- .../processors/cache/GridCacheProxyImpl.java | 8 +-- .../processors/cache/IgniteInternalCache.java | 5 +- .../GridDistributedLockRequest.java | 22 ++++---- .../GridDistributedTxRemoteAdapter.java | 6 +-- .../distributed/dht/GridDhtLockFuture.java | 12 ++--- .../distributed/dht/GridDhtLockRequest.java | 6 +-- .../dht/GridDhtTransactionalCacheAdapter.java | 12 ++--- .../dht/GridDhtTxLocalAdapter.java | 14 ++--- .../dht/GridDhtTxPrepareFuture.java | 2 +- .../dht/atomic/GridDhtAtomicCache.java | 20 +++---- .../GridDhtAtomicSingleUpdateFuture.java | 4 +- .../dht/atomic/GridDhtAtomicUpdateFuture.java | 2 +- .../GridNearAtomicAbstractUpdateFuture.java | 12 ++--- .../GridNearAtomicAbstractUpdateRequest.java | 14 ++--- .../GridNearAtomicSingleUpdateFuture.java | 8 +-- .../atomic/GridNearAtomicUpdateFuture.java | 10 ++-- .../dht/colocated/GridDhtColocatedCache.java | 22 ++++---- .../colocated/GridDhtColocatedLockFuture.java | 14 ++--- .../distributed/near/GridNearAtomicCache.java | 2 +- .../distributed/near/GridNearLockFuture.java | 12 ++--- .../distributed/near/GridNearLockRequest.java | 5 +- .../near/GridNearTransactionalCache.java | 6 +-- .../distributed/near/GridNearTxLocal.java | 50 +++++++++--------- .../cache/transactions/IgniteTxEntry.java | 22 ++++---- .../transactions/IgniteTxLocalAdapter.java | 16 +++--- 29 files changed, 187 insertions(+), 184 deletions(-) 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 dfd24896c93bc..65192bd767322 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 @@ -239,7 +239,7 @@ private void flushTuples(boolean force) throws Exception { boolean keepBinaryMode = props == null || props.keepBinary(); if (keepBinaryMode) - cache = cache.withCalciteEngine(); + cache = cache.withHandleBinaryInInterceptor(); if (tx == null) invokeOutsideTransaction(tuples, cache); 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 2bce39e2773ad..baf925036eeba 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 @@ -67,18 +67,18 @@ public class CacheOperationContext implements Serializable { /** Application attributes. */ private final @Nullable Map appAttrs; - /** Calcite engine call flag. */ - private final boolean calciteEngineCall; + /** Handle binary in interceptor operation flag. */ + private final boolean handleBinaryInInterceptor; /** - * @param skipStore Skip store flag. - * @param skipReadThrough Skip read-through cache store flag. - * @param keepBinary Keep binary flag. - * @param expiryPlc Expiry policy. - * @param dataCenterId Data center id. - * @param readRepairStrategy Read-repair strategy. - * @param appAttrs Application attributes. - * @param calciteEngineCall Calcite engine call flag. + * @param skipStore Skip store flag. + * @param skipReadThrough Skip read-through cache store flag. + * @param keepBinary Keep binary flag. + * @param expiryPlc Expiry policy. + * @param dataCenterId Data center id. + * @param readRepairStrategy Read-repair strategy. + * @param appAttrs Application attributes. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ private CacheOperationContext( boolean skipStore, @@ -90,7 +90,7 @@ private CacheOperationContext( boolean recovery, @Nullable ReadRepairStrategy readRepairStrategy, @Nullable Map appAttrs, - boolean calciteEngineCall + boolean handleBinaryInInterceptor ) { this.skipStore = skipStore; this.skipReadThrough = skipReadThrough; @@ -101,7 +101,7 @@ private CacheOperationContext( this.recovery = recovery; this.readRepairStrategy = readRepairStrategy; this.appAttrs = appAttrs; - this.calciteEngineCall = calciteEngineCall; + this.handleBinaryInInterceptor = handleBinaryInInterceptor; } /** @@ -209,14 +209,14 @@ public CacheOperationContext withSkipReadThrough() { return builder(this).skipReadThrough(true).build(); } - /** @return Calcite engine execution flag. */ - public boolean calciteEngine() { - return calciteEngineCall; + /** @return Whether to handle binary in interceptor. */ + public boolean handleBinaryInInterceptor() { + return handleBinaryInInterceptor; } - /** Context with {@link CacheOperationContext#calciteEngine} flag. */ - public CacheOperationContext withCalciteEngine() { - return builder(this).calciteEngine(true).build(); + /** Context with {@link CacheOperationContext#handleBinaryInInterceptor} flag. */ + public CacheOperationContext withHandleBinaryInInterceptor() { + return builder(this).handleBinaryInInterceptor(true).build(); } /** @@ -286,8 +286,8 @@ public static class Builder { /** Application attributes. */ private Map appAttrs; - /** Calcite engine execution flag. */ - private boolean calciteEngine; + /** Flag indicating whether to handle binary in interceptor. */ + private boolean handleBinary; /** */ Builder() { @@ -305,7 +305,7 @@ public static class Builder { expiryPlc = ctx.expiryPlc; dataCenterId = ctx.dataCenterId; appAttrs = ctx.appAttrs; - calciteEngine = ctx.calciteEngineCall; + handleBinary = ctx.handleBinaryInInterceptor; } /** @@ -349,12 +349,12 @@ public Builder skipReadThrough(boolean skipReadThrough) { } /** - * CacheOperationContext with calcite execution flag. + * CacheOperationContext with handle binary in interceptor execution flag. * - * @see IgniteInternalCache#withCalciteEngine() + * @see IgniteInternalCache#withHandleBinaryInInterceptor() */ - public Builder calciteEngine(boolean calciteEngine) { - this.calciteEngine = calciteEngine; + public Builder handleBinaryInInterceptor(boolean handleBinary) { + this.handleBinary = handleBinary; return this; } @@ -416,7 +416,7 @@ public CacheOperationContext build() { recovery, readRepairStrategy, appAttrs, - calciteEngine); + handleBinary); } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java index 205af51e47f46..e447029974fb1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java @@ -261,7 +261,8 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { CacheOperationGate opGate = onEnter(); try { - return new GatewayProtectedCacheProxy<>((IgniteCacheProxy)delegate, opCtx.withKeepBinary(), lock); + return new GatewayProtectedCacheProxy<>((IgniteCacheProxy)delegate, opCtx. + withKeepBinary().withHandleBinaryInInterceptor(), lock); } finally { onLeave(opGate); 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 369537432f116..45b62733f540d 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 @@ -494,14 +494,14 @@ public void active(boolean active) { } /** {@inheritDoc} */ - @Override public IgniteInternalCache withCalciteEngine() { + @Override public IgniteInternalCache withHandleBinaryInInterceptor() { CacheOperationContext opCtx = ctx.operationContextPerCall(); if (opCtx == null) - opCtx = CacheOperationContext.builder().calciteEngine(true).build(); + opCtx = CacheOperationContext.builder().handleBinaryInInterceptor(true).build(); else { - if (!opCtx.calciteEngine()) - opCtx = opCtx.withCalciteEngine(); + if (!opCtx.handleBinaryInInterceptor()) + opCtx = opCtx.withHandleBinaryInInterceptor(); } return new GridCacheProxyImpl<>(ctx, this, opCtx); 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 fe99ce386a828..d7908df7d9aad 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 @@ -1607,20 +1607,20 @@ public IgniteInternalCache delegate() { } /** {@inheritDoc} */ - @Override public IgniteInternalCache withCalciteEngine() { + @Override public IgniteInternalCache withHandleBinaryInInterceptor() { CacheOperationContext prev = gate.enter(opCtx); CacheOperationContext newOpCtx; try { if (opCtx != null) { - if (opCtx.calciteEngine()) + if (opCtx.handleBinaryInInterceptor()) return this; else - newOpCtx = opCtx.withCalciteEngine(); + newOpCtx = opCtx.withHandleBinaryInInterceptor(); } else - newOpCtx = CacheOperationContext.builder().calciteEngine(true).build(); + newOpCtx = CacheOperationContext.builder().handleBinaryInInterceptor(true).build(); return new GridCacheProxyImpl<>(ctx, delegate, newOpCtx); } 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 4b4f8263c7149..586ca24401f36 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 @@ -33,6 +33,7 @@ import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheEntry; +import org.apache.ignite.cache.CacheInterceptor; import org.apache.ignite.cache.CacheMetrics; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cache.CachePeekMode; @@ -1642,9 +1643,9 @@ public Iterator> scanIterator(boolean keepBinary, @Nullable Ig public IgniteInternalCache withExpiryPolicy(ExpiryPolicy plc); /** - * @return Cache with calcite engine execution flag. + * @return Cache with handle binary values during {@link CacheInterceptor} execution flag. */ - public IgniteInternalCache withCalciteEngine(); + public IgniteInternalCache withHandleBinaryInInterceptor(); /** * @return Cache with no-retries behavior enabled. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java index 4ea96fe851356..d37d733fd70e8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java @@ -49,8 +49,8 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage { /** */ private static final int SKIP_READ_THROUGH_FLAG_MASK = 0x08; - /** Calcite engine operation call flag bit mask. */ - private static final int CALCITE_OP_CALL_FLAG_MASK = 0x10; + /** Handle binary in interceptor operation flag bit mask. */ + private static final int HANDLE_BINARY_INTERCEPTOR_FLAG_MASK = 0x10; /** Sender node ID. */ @Order(0) @@ -131,7 +131,7 @@ public GridDistributedLockRequest() { * @param txSize Expected transaction size. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ public GridDistributedLockRequest( int cacheId, @@ -149,7 +149,7 @@ public GridDistributedLockRequest( int txSize, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary ) { super(lockVer, keyCnt, false); @@ -175,7 +175,7 @@ public GridDistributedLockRequest( skipStore(skipStore); skipReadThrough(skipReadThrough); keepBinary(keepBinary); - calciteOpCall(calciteOpCall); + handleBinaryInInterceptor(handleBinaryInInterceptor); } /** @@ -267,16 +267,16 @@ public boolean skipReadThrough() { return isFlag(SKIP_READ_THROUGH_FLAG_MASK); } - /** Sets calcite operation flag. */ - public void calciteOpCall(boolean calciteOpCall) { - setFlag(calciteOpCall, CALCITE_OP_CALL_FLAG_MASK); + /** Sets flag indicating whether to handle binary in interceptor. */ + public void handleBinaryInInterceptor(boolean handleBinary) { + setFlag(handleBinary, HANDLE_BINARY_INTERCEPTOR_FLAG_MASK); } /** - * @return Calcite engine operation flag. + * @return Flag indicating whether to handle binary in interceptor. */ - public boolean calciteOpCall() { - return isFlag(CALCITE_OP_CALL_FLAG_MASK); + public boolean handleBinaryInInterceptor() { + return isFlag(HANDLE_BINARY_INTERCEPTOR_FLAG_MASK); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java index 2f60e5aec0e6b..9966362e691b3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java @@ -617,7 +617,7 @@ else if (conflictCtx.isMerge()) { true, true, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -639,7 +639,7 @@ else if (conflictCtx.isMerge()) { true, true, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -677,7 +677,7 @@ else if (op == DELETE) { true, true, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java index eef499986084d..c32bc7a8c7a7d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java @@ -187,8 +187,8 @@ public final class GridDhtLockFuture extends GridCacheCompoundIdentityFuture entries) { read ? accessTtl : -1L, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, cctx.store().configured(), keepBinary, inTx() ? tx.label() : null); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java index 09db43379175a..bdd7a1bd93ce9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java @@ -112,7 +112,7 @@ public GridDhtLockRequest() { * @param keepBinary Keep binary flag. * @param txLbl Transaction label. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ public GridDhtLockRequest( int cacheId, @@ -134,7 +134,7 @@ public GridDhtLockRequest( long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean storeUsed, boolean keepBinary, String txLbl @@ -154,7 +154,7 @@ public GridDhtLockRequest( txSize, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); this.topVer = topVer; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java index 9bc69ddb02bb9..efe8bbfe705f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java @@ -742,7 +742,7 @@ else if (txLockMsgLog.isDebugEnabled()) { accessTtl, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), opCtx != null && opCtx.isKeepBinary()); } @@ -760,7 +760,7 @@ else if (txLockMsgLog.isDebugEnabled()) { * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @return Lock future. */ public GridDhtFuture lockAllAsyncInternal(@Nullable Collection keys, @@ -774,7 +774,7 @@ public GridDhtFuture lockAllAsyncInternal(@Nullable Collection(true); @@ -798,7 +798,7 @@ public GridDhtFuture lockAllAsyncInternal(@Nullable Collection lockAllAsync( req.accessTtl(), req.skipStore(), req.skipReadThrough(), - req.calciteOpCall(), + req.handleBinaryInInterceptor(), req.keepBinary()); // Add before mapping. @@ -1056,7 +1056,7 @@ public IgniteInternalFuture lockAllAsync( req.accessTtl(), req.skipStore(), req.skipReadThrough(), - req.calciteOpCall(), + req.handleBinaryInInterceptor(), req.keepBinary(), req.nearCache()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java index 391a12b824ce4..ac00d063852b7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java @@ -562,7 +562,7 @@ private void addMapping( * @param needRetVal Return value flag. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param keepBinary Keep binary flag. * @param nearCache {@code True} if near cache enabled on originating node. * @return Lock future. @@ -578,7 +578,7 @@ IgniteInternalFuture lockAllAsync( long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary, boolean nearCache ) { @@ -652,7 +652,7 @@ IgniteInternalFuture lockAllAsync( null, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, nearCache); @@ -697,7 +697,7 @@ IgniteInternalFuture lockAllAsync( accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); } catch (IgniteCheckedException e) { @@ -717,7 +717,7 @@ IgniteInternalFuture lockAllAsync( * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @return Future for lock acquisition. */ private IgniteInternalFuture obtainLockAsync( @@ -730,7 +730,7 @@ private IgniteInternalFuture obtainLockAsync( final long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary) { if (log.isDebugEnabled()) log.debug("Before acquiring transaction lock on keys [keys=" + passedKeys + ']'); @@ -762,7 +762,7 @@ private IgniteInternalFuture obtainLockAsync( accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); return new GridEmbeddedFuture<>( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index f92f548fc3c4f..88a9c076f9d54 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -499,7 +499,7 @@ private void onEntriesLocked() { if (retVal) { if (err != null || procRes != null) ret.addEntryProcessResult(txEntry.context(), key, null, procRes, err, - txEntry.calciteOpCall() || keepBinary); + txEntry.handleBinaryInInterceptor() || keepBinary); else ret.invokeResult(true); } 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 9548aba55b801..1671abedc4482 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 @@ -1113,7 +1113,7 @@ else if (op == GridCacheOperation.DELETE) { opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, opCtx != null ? opCtx.applicationAttributes() : null, - opCtx != null && opCtx.calciteEngine()); + opCtx != null && opCtx.handleBinaryInInterceptor()); if (async) { return asyncOp(new CO>() { @@ -1302,7 +1302,7 @@ else if (op == GridCacheOperation.TRANSFORM) { opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, opCtx != null ? opCtx.applicationAttributes() : null, - opCtx != null && opCtx.calciteEngine() + opCtx != null && opCtx.handleBinaryInInterceptor() ); } else { @@ -1326,7 +1326,7 @@ else if (op == GridCacheOperation.TRANSFORM) { opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, opCtx != null ? opCtx.applicationAttributes() : null, - opCtx != null && opCtx.calciteEngine()); + opCtx != null && opCtx.handleBinaryInInterceptor()); } } @@ -1386,7 +1386,7 @@ private IgniteInternalFuture removeAllAsync0( opCtx != null && opCtx.recovery(), opCtx != null && opCtx.noRetries() ? 1 : MAX_RETRIES, opCtx != null ? opCtx.applicationAttributes() : null, - opCtx != null && opCtx.calciteEngine()); + opCtx != null && opCtx.handleBinaryInInterceptor()); if (async) { return asyncOp(new CO>() { @@ -2257,7 +2257,7 @@ private void updateWithBatch( if (updated == null) { if (intercept) { - CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.calciteOpCall()); + CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.handleBinaryInInterceptor()); IgniteBiTuple interceptorRes = ctx.config().getInterceptor().onBeforeRemove(e); @@ -2302,7 +2302,7 @@ private void updateWithBatch( } else { if (intercept) { - CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.calciteOpCall()); + CacheLazyEntry e = new CacheLazyEntry(ctx, entry.key(), invokeEntry.key(), old, oldVal, req.handleBinaryInInterceptor()); Object val = ctx.config().getInterceptor().onBeforePut(e, updatedVal); @@ -2585,7 +2585,7 @@ private void updateSingle( !req.skipStore() && !req.skipReadThrough(), sndPrevVal || req.returnValue(), req.keepBinary(), - req.calciteOpCall(), + req.handleBinaryInInterceptor(), expiry, /*event*/true, /*metrics*/true, @@ -2701,7 +2701,7 @@ else if (GridDhtCacheEntry.ReaderId.contains(readers, nearNode.id())) { null, compRes.get1(), compRes.get2(), - req.calciteOpCall() || req.keepBinary()); + req.handleBinaryInInterceptor() || req.keepBinary()); } } else { @@ -2871,7 +2871,7 @@ else if (GridDhtCacheEntry.ReaderId.contains(readers, nearNode.id())) { /*read-through*/false, /*retval*/sndPrevVal, req.keepBinary(), - req.calciteOpCall(), + req.handleBinaryInInterceptor(), expiry, /*event*/true, /*metrics*/true, @@ -3182,7 +3182,7 @@ else if (req.operation() == UPDATE) { req.recovery(), MAX_RETRIES, opCtx == null ? null : opCtx.applicationAttributes(), - req.calciteOpCall()); + req.handleBinaryInInterceptor()); updateFut.map(); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java index a10cb27cf94b3..910106d5c6c50 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java @@ -91,7 +91,7 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture topVer, updateReq.taskNameHash(), updateReq.keepBinary(), - updateReq.calciteOpCall(), + updateReq.handleBinaryInInterceptor(), updateReq.skipStore(), readRepairRecovery); } @@ -105,7 +105,7 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture updateReq.taskNameHash(), null, updateReq.keepBinary(), - updateReq.calciteOpCall(), + updateReq.handleBinaryInInterceptor(), updateReq.skipStore(), false, readRepairRecovery); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java index 88d744fae432b..7c2f9ce5c0b5f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java @@ -89,7 +89,7 @@ class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture { updateReq.taskNameHash(), null, updateReq.keepBinary(), - updateReq.calciteOpCall(), + updateReq.handleBinaryInInterceptor(), updateReq.skipStore(), false, readRepairRecovery); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java index 317b4ab7f1c34..fa18599c5e037 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java @@ -150,8 +150,8 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture /** Operation result. */ protected GridCacheReturn opRes; - /** Calcite operation call. */ - protected boolean calciteOpCall; + /** Handle binary in interceptor operation flag. */ + protected boolean handleBinaryInInterceptor; /** * Constructor. @@ -170,7 +170,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture * @param recovery {@code True} if cache operation is called in recovery mode. * @param remapCnt Remap count. * @param appAttrs Application attributes. - * @param calciteOpCall Calcite engine call flag. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ protected GridNearAtomicAbstractUpdateFuture( GridCacheContext cctx, @@ -188,7 +188,7 @@ protected GridNearAtomicAbstractUpdateFuture( boolean recovery, int remapCnt, @Nullable Map appAttrs, - boolean calciteOpCall + boolean handleBinaryInInterceptor ) { if (log == null) { msgLog = cctx.shared().atomicMessageLogger(); @@ -214,7 +214,7 @@ protected GridNearAtomicAbstractUpdateFuture( this.remapCnt = remapCnt; this.appAttrs = appAttrs; - this.calciteOpCall = calciteOpCall; + this.handleBinaryInInterceptor = handleBinaryInInterceptor; } /** @@ -366,7 +366,7 @@ final void completeFuture(@Nullable GridCacheReturn ret, Throwable err, @Nullabl : (this.retval || op == TRANSFORM) ? cctx.unwrapBinaryIfNeeded( ret.value(), - calciteOpCall || keepBinary, + handleBinaryInInterceptor || keepBinary, U.deploymentClassLoader(cctx.kernalContext(), deploymentLdrId)) : ret.success(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java index eb5f516b44c5a..46d8d4529515c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java @@ -73,7 +73,7 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes private static final int SKIP_READ_THROUGH_FLAG_MASK = 0x100; /** */ - private static final int CALCITE_OP_FLAG_MASK = 0x200; + private static final int HANDLE_BINARY_INTERCEPTOR_FLAG_MASK = 0x200; /** Target node ID. */ protected UUID nodeId; @@ -155,7 +155,7 @@ protected GridNearAtomicAbstractUpdateRequest( * @param skipStore Skip write-through to a CacheStore flag. * @param keepBinary Keep binary flag. * @param recovery Recovery mode flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @return Flags. */ static short flags( @@ -168,7 +168,7 @@ static short flags( boolean keepBinary, boolean recovery, boolean skipReadThrough, - boolean calciteOpCall + boolean handleBinaryInInterceptor ) { short flags = 0; @@ -199,8 +199,8 @@ static short flags( if (skipReadThrough) flags |= SKIP_READ_THROUGH_FLAG_MASK; - if (calciteOpCall) - flags |= CALCITE_OP_FLAG_MASK; + if (handleBinaryInInterceptor) + flags |= HANDLE_BINARY_INTERCEPTOR_FLAG_MASK; return flags; } @@ -365,8 +365,8 @@ public final boolean skipReadThrough() { } /** */ - public final boolean calciteOpCall() { - return isFlag(CALCITE_OP_FLAG_MASK); + public final boolean handleBinaryInInterceptor() { + return isFlag(HANDLE_BINARY_INTERCEPTOR_FLAG_MASK); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java index b8acb21a8e733..1540795c2f469 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java @@ -82,7 +82,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda * @param keepBinary Keep binary flag. * @param recovery {@code True} if cache operation is called in recovery mode. * @param remapCnt Maximum number of retries. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ public GridNearAtomicSingleUpdateFuture( GridCacheContext cctx, @@ -102,7 +102,7 @@ public GridNearAtomicSingleUpdateFuture( boolean recovery, int remapCnt, @Nullable Map appAttrs, - boolean calciteOpCall + boolean handleBinaryInInterceptor ) { super(cctx, cache, @@ -119,7 +119,7 @@ public GridNearAtomicSingleUpdateFuture( recovery, remapCnt, appAttrs, - calciteOpCall); + handleBinaryInInterceptor); this.key = key; this.val = val; } @@ -557,7 +557,7 @@ private PrimaryRequestState mapSingleUpdate(AffinityTopologyVersion topVer, long keepBinary, recovery, skipReadThrough, - calciteOpCall); + handleBinaryInInterceptor); if (canUseSingleRequest()) { if (op == TRANSFORM) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java index 06c10eeed8755..7712723df81f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java @@ -111,7 +111,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu * @param keepBinary Keep binary flag. * @param remapCnt Maximum number of retries. * @param appAttrs Application attributes. - * @param calciteOpCall Calcite engine call flag. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ public GridNearAtomicUpdateFuture( GridCacheContext cctx, @@ -133,7 +133,7 @@ public GridNearAtomicUpdateFuture( boolean recovery, int remapCnt, @Nullable Map appAttrs, - boolean calciteOpCall + boolean handleBinaryInInterceptor ) { super( cctx, @@ -151,7 +151,7 @@ public GridNearAtomicUpdateFuture( recovery, remapCnt, appAttrs, - calciteOpCall); + handleBinaryInInterceptor); assert vals == null || vals.size() == keys.size(); assert conflictPutVals == null || conflictPutVals.size() == keys.size(); @@ -1005,7 +1005,7 @@ else if (conflictRmvVals != null) { keepBinary, recovery, skipReadThrough, - calciteOpCall); + handleBinaryInInterceptor); GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest( cctx.cacheId(), @@ -1119,7 +1119,7 @@ else if (conflictRmvVals != null) { keepBinary, recovery, skipReadThrough, - calciteOpCall); + handleBinaryInInterceptor); GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest( cctx.cacheId(), diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index 03f93d95ef979..fb2baac75fac3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -205,7 +205,7 @@ public GridDistributedCacheEntry entryExx( false, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), recovery, readRepairStrategy, needVer); @@ -309,7 +309,7 @@ public GridDistributedCacheEntry entryExx( false, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), recovery, readRepairStrategy, needVer); @@ -663,7 +663,7 @@ else if (!skipVals && ctx.statisticsEnabled()) accessTtl, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery()); @@ -906,7 +906,7 @@ public void removeLocks(long threadId, GridCacheVersion ver, Collection lockAllAsync( @@ -923,7 +923,7 @@ IgniteInternalFuture lockAllAsync( final long accessTtl, final boolean skipStore, final boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, final boolean keepBinary ) { assert keys != null; @@ -949,7 +949,7 @@ IgniteInternalFuture lockAllAsync( accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); } else { @@ -972,7 +972,7 @@ IgniteInternalFuture lockAllAsync( accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); } } @@ -994,7 +994,7 @@ IgniteInternalFuture lockAllAsync( * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @return Lock future. */ private IgniteInternalFuture lockAllAsync0( @@ -1011,7 +1011,7 @@ private IgniteInternalFuture lockAllAsync0( final long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary) { int cnt = keys.size(); @@ -1030,7 +1030,7 @@ private IgniteInternalFuture lockAllAsync0( accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); // Add before mapping. @@ -1100,7 +1100,7 @@ else if (!b) accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); return new GridDhtEmbeddedFuture<>( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java index 775463af60f60..563bfc932f428 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java @@ -170,8 +170,8 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF /** Skip read-through cache store flag. */ private final boolean skipReadThrough; - /** Calcite engine operation flag. */ - private final boolean calciteOpCall; + /** Handle binary in interceptor operation flag. */ + private final boolean handleBinaryInInterceptor; /** */ private Deque mappings; @@ -202,7 +202,7 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. */ public GridDhtColocatedLockFuture( GridCacheContext cctx, @@ -215,7 +215,7 @@ public GridDhtColocatedLockFuture( long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary, boolean recovery ) { @@ -235,7 +235,7 @@ public GridDhtColocatedLockFuture( this.skipReadThrough = skipReadThrough; this.keepBinary = keepBinary; this.recovery = recovery; - this.calciteOpCall = calciteOpCall; + this.handleBinaryInInterceptor = handleBinaryInInterceptor; ignoreInterrupts(); @@ -1091,7 +1091,7 @@ private synchronized void map0( read ? accessTtl : -1L, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, clientFirst, false, @@ -1262,7 +1262,7 @@ private void lockLocally( accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); // Add new future. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java index 131a14d7a3e1c..308fdf4f50e9a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java @@ -206,7 +206,7 @@ public void processNearAtomicUpdateResponse( ttl, expireTime, req.keepBinary(), - req.calciteOpCall(), + req.handleBinaryInInterceptor(), req.nodeId(), taskName, req.operation() == TRANSFORM); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java index 9a0d38bbed7db..7c81c58660379 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java @@ -160,8 +160,8 @@ public final class GridNearLockFuture extends GridCacheCompoundIdentityFuture keys, boolean remap, boolean topLocked read ? accessTtl : -1L, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, clientFirst, true, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java index cfe6f7a4b2d19..97fd2730309a1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java @@ -104,6 +104,7 @@ public GridNearLockRequest() { * @param syncCommit Synchronous commit flag. * @param taskNameHash Task name hash code. * @param createTtl TTL for create operation. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param accessTtl TTL for read operation. * @param skipStore Skip store flag. * @param firstClientReq {@code True} if first lock request for lock operation sent from client node. @@ -130,7 +131,7 @@ public GridNearLockRequest( long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary, boolean firstClientReq, boolean nearCache, @@ -152,7 +153,7 @@ public GridNearLockRequest( txSize, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); assert topVer.compareTo(AffinityTopologyVersion.ZERO) > 0; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index 0c330dc771173..45e37d8019eda 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -133,7 +133,7 @@ public void dht(GridDhtCache dht) { final boolean skipStore = opCtx != null && opCtx.skipStore(); final boolean skipReadThrough = opCtx != null && opCtx.skipReadThrough(); - boolean calciteOpCall = opCtx != null && opCtx.calciteEngine(); + boolean handleBinaryInInterceptor = opCtx != null && opCtx.handleBinaryInInterceptor(); if (tx != null && !tx.implicit() && !skipTx) { return asyncOp(tx, new AsyncOp>(keys) { @@ -146,7 +146,7 @@ public void dht(GridDhtCache dht) { false, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, recovery, readRepairStrategy, needVer); @@ -309,7 +309,7 @@ private void processLockResponse(UUID nodeId, GridNearLockResponse res) { accessTtl, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), opCtx != null && opCtx.isKeepBinary(), opCtx != null && opCtx.recovery()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 381107ae40a46..7290c1a55751d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -623,7 +623,7 @@ private IgniteInternalFuture putAsync0( ret, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), keepBinary, opCtx != null && opCtx.recovery(), dataCenterId); @@ -800,7 +800,7 @@ private IgniteInternalFuture putAllAsync0( null, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), false, keepBinary, opCtx != null && opCtx.recovery(), @@ -901,7 +901,7 @@ private IgniteInternalFuture putAllAsync0( * @param ret Return value. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param recovery Recovery flag. * @param dataCenterId Optional data center Id. * @return Future for entry values loading. @@ -919,7 +919,7 @@ private IgniteInternalFuture enlistWrite( final GridCacheReturn ret, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary, boolean recovery, Byte dataCenterId) { @@ -958,7 +958,7 @@ private IgniteInternalFuture enlistWrite( /*enlisted*/null, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, false, hasFilters, needVal, @@ -1026,7 +1026,7 @@ private IgniteInternalFuture enlistWrite( * @param drRmvMap DR remove map (optional). * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param singleRmv {@code True} for single key remove operation ({@link Cache#remove(Object)}. * @param keepBinary Keep binary flag. * @param recovery Recovery flag. @@ -1049,7 +1049,7 @@ private IgniteInternalFuture enlistWrite( @Nullable Map drRmvMap, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, final boolean singleRmv, final boolean keepBinary, final boolean recovery, @@ -1155,7 +1155,7 @@ else if (dataCenterId != null) { enlisted, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, singleRmv, hasFilters, needVal, @@ -1228,7 +1228,7 @@ else if (dataCenterId != null) { * @param enlisted Enlisted keys collection. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param singleRmv {@code True} for single remove operation. * @param hasFilters {@code True} if filters not empty. * @param needVal {@code True} if value is needed. @@ -1252,7 +1252,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, @Nullable final Collection enlisted, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean singleRmv, boolean hasFilters, final boolean needVal, @@ -1373,7 +1373,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, drVer, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, CU.isNearEnabled(cacheCtx)); } @@ -1391,7 +1391,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, null, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, CU.isNearEnabled(cacheCtx)); } @@ -1429,7 +1429,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, drVer, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, CU.isNearEnabled(cacheCtx)); @@ -1550,7 +1550,7 @@ private boolean enlistWriteEntry(GridCacheContext cacheCtx, drVer, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, CU.isNearEnabled(cacheCtx)); @@ -1703,7 +1703,7 @@ private IgniteInternalFuture removeAllAsync0( drMap, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.skipReadThrough(), - opCtx != null && opCtx.calciteEngine(), + opCtx != null && opCtx.handleBinaryInInterceptor(), singleRmv, keepBinary, opCtx != null && opCtx.recovery(), @@ -1840,7 +1840,7 @@ private IgniteInternalFuture removeAllAsync0( * @param keepCacheObjects Keep cache objects * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param readRepairStrategy Read Repair strategy. * @return Future for this get. */ @@ -1854,7 +1854,7 @@ public IgniteInternalFuture> getAllAsync( final boolean keepCacheObjects, final boolean skipStore, final boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, final boolean recovery, final ReadRepairStrategy readRepairStrategy, final boolean needVer) { @@ -1898,7 +1898,7 @@ public IgniteInternalFuture> getAllAsync( keepCacheObjects, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, recovery, readRepairStrategy, needVer); @@ -2087,7 +2087,7 @@ public IgniteInternalFuture> getAllAsync( null, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, !deserializeBinary, recovery, null); @@ -2222,7 +2222,7 @@ public IgniteInternalFuture> getAllAsync( * @param keepCacheObjects Keep cache objects flag. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param recovery Recovery flag. * @return Enlisted keys. * @throws IgniteCheckedException If failed. @@ -2241,7 +2241,7 @@ private Collection enlistRead( boolean keepCacheObjects, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean recovery, ReadRepairStrategy readRepairStrategy, final boolean needVer @@ -2490,7 +2490,7 @@ private Collection enlistRead( null, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, !deserializeBinary, CU.isNearEnabled(cacheCtx)); @@ -4221,7 +4221,7 @@ public IgniteInternalFuture rollbackAsyncLocal() { * @param Key type. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param keepBinary Keep binary flag. * @return Future with respond. */ @@ -4233,7 +4233,7 @@ public IgniteInternalFuture lockAllAsync(GridCacheContext c long accessTtl, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary) { assert pessimistic(); @@ -4270,7 +4270,7 @@ public IgniteInternalFuture lockAllAsync(GridCacheContext c accessTtl, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary); return new GridEmbeddedFuture<>( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java index 0dc68edec2509..1121e28e0830d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java @@ -93,8 +93,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message { /** Skip read-through cache store flag bit mask. */ private static final int TX_ENTRY_SKIP_READ_THROUGH_FLAG_MASK = 1 << 5; - /** Calcite engine operation call flag bit mask. */ - private static final int CALCITE_OP_CALL_FLAG_MASK = 1 << 6; + /** Handle binary in interceptor operation bit mask. */ + private static final int HANDLE_BINARY_INTERCEPTOR_FLAG_MASK = 1 << 6; /** Prepared flag updater. */ private static final AtomicIntegerFieldUpdater PREPARED_UPD = @@ -283,7 +283,7 @@ public IgniteTxEntry(GridCacheContext ctx, * @param conflictVer Data center replication version. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @param addReader Add reader flag. */ public IgniteTxEntry(GridCacheContext ctx, @@ -298,7 +298,7 @@ public IgniteTxEntry(GridCacheContext ctx, GridCacheVersion conflictVer, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary, boolean addReader ) { @@ -317,7 +317,7 @@ public IgniteTxEntry(GridCacheContext ctx, skipStore(skipStore); skipReadThrough(skipReadThrough); - calciteOpCall(calciteOpCall); + handleBinaryInInterceptor(handleBinaryInInterceptor); keepBinary(keepBinary); addReader(addReader); @@ -630,16 +630,16 @@ public boolean skipReadThrough() { return isFlag(TX_ENTRY_SKIP_READ_THROUGH_FLAG_MASK); } - /** Sets calcite operation flag. */ - public void calciteOpCall(boolean calciteOpCall) { - setFlag(calciteOpCall, CALCITE_OP_CALL_FLAG_MASK); + /** Sets whenever to handle binary in interceptor flag. */ + public void handleBinaryInInterceptor(boolean handleBinary) { + setFlag(handleBinary, HANDLE_BINARY_INTERCEPTOR_FLAG_MASK); } /** - * @return Calcite engine operation flag. + * @return Handle binary in interceptor operation flag. */ - public boolean calciteOpCall() { - return isFlag(CALCITE_OP_CALL_FLAG_MASK); + public boolean handleBinaryInInterceptor() { + return isFlag(HANDLE_BINARY_INTERCEPTOR_FLAG_MASK); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index 2cedc84fb637f..e8fb260ea8720 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -693,7 +693,7 @@ else if (conflictCtx.isUseNew()) { evt, metrics, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -726,7 +726,7 @@ else if (conflictCtx.isUseNew()) { false, metrics0, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -748,7 +748,7 @@ else if (op == DELETE) { evt, metrics, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -776,7 +776,7 @@ else if (op == DELETE) { false, metrics0, txEntry.keepBinary(), - txEntry.calciteOpCall(), + txEntry.handleBinaryInInterceptor(), txEntry.hasOldValue(), txEntry.oldValue(), topVer, @@ -1343,7 +1343,7 @@ protected void checkValid(boolean checkTimeout) throws IgniteCheckedException { * @param drVer DR version. * @param skipStore Skip store flag. * @param skipReadThrough Skip read-through cache store flag. - * @param calciteOpCall Calcite engine operation call. + * @param handleBinaryInInterceptor Handle binary in interceptor operation flag. * @return Transaction entry. */ public final IgniteTxEntry addEntry(GridCacheOperation op, @@ -1359,7 +1359,7 @@ public final IgniteTxEntry addEntry(GridCacheOperation op, @Nullable GridCacheVersion drVer, boolean skipStore, boolean skipReadThrough, - boolean calciteOpCall, + boolean handleBinaryInInterceptor, boolean keepBinary, boolean addReader ) { @@ -1402,7 +1402,7 @@ public final IgniteTxEntry addEntry(GridCacheOperation op, // Keep old flags. old.skipStore(skipStore); old.skipReadThrough(skipReadThrough); - old.calciteOpCall(calciteOpCall); + old.handleBinaryInInterceptor(handleBinaryInInterceptor); old.keepBinary(keepBinary); // Update ttl if specified. @@ -1434,7 +1434,7 @@ public final IgniteTxEntry addEntry(GridCacheOperation op, drVer, skipStore, skipReadThrough, - calciteOpCall, + handleBinaryInInterceptor, keepBinary, addReader); From c61eaa23ca3156db468e6209bbdf887ff80c57ed Mon Sep 17 00:00:00 2001 From: zstan Date: Mon, 15 Jun 2026 11:03:30 +0300 Subject: [PATCH 4/5] fix --- .../KeepBinaryIntegrationTest.java | 85 ++++++++++++++ .../integration/PublicApiIntegrationTest.java | 104 ------------------ .../testsuites/IntegrationTestSuite.java | 2 - .../GridDhtAtomicAbstractUpdateRequest.java | 6 +- 4 files changed, 88 insertions(+), 109 deletions(-) delete mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java index c57597e73b97e..0ee35a6880c4a 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java @@ -22,14 +22,20 @@ import java.util.Objects; import org.apache.ignite.IgniteCache; import org.apache.ignite.binary.BinaryObject; +import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.cache.query.annotations.QuerySqlField; import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; +import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.testframework.SupplierX; +import org.apache.ignite.transactions.Transaction; import org.junit.Test; +import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; +import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; + /** * Test "keep binary" in cache queries. */ @@ -156,6 +162,85 @@ public void testDynamicParameters() { txAction(client, checker); } + /** */ + @Test + public void testSimpleInsert() { + IgniteCache cache = null; + + try { + cache = client.createCache("testInsert"); + + runQuery(0, nodeCount() * 10, false, cache); + + cache = cache.withKeepBinary(); + + runQuery(nodeCount() * 10, 2 * nodeCount() * 10, false, cache); + + List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); + + assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); + } + finally { + if (cache != null) + cache.destroy(); + + sql("DROP TABLE IF EXISTS emp"); + } + } + + /** */ + @Test + public void testTxInsert() { + IgniteCache cache = null; + + try { + CacheConfiguration ccfg = new CacheConfiguration<>("testInsert"); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); + + cache = client.createCache(ccfg); + + runQuery(0, nodeCount() * 10, true, cache); + + cache = cache.withKeepBinary(); + + runQuery(nodeCount() * 10, 2 * nodeCount() * 10, true, cache); + + List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); + + assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); + } + finally { + if (cache != null) + cache.destroy(); + + sql("DROP TABLE IF EXISTS emp"); + } + } + + /** */ + private void runQuery(int begin, int end, boolean transactional, IgniteCache cache) { + cache.query(new SqlFieldsQuery("CREATE TABLE IF NOT EXISTS emp(empid INTEGER, deptid INTEGER, name VARCHAR, salary INTEGER, " + + "PRIMARY KEY(empid, deptid)) WITH \"AFFINITY_KEY=deptid" + (transactional ? ", ATOMICITY=transactional" : "") + "\"")) + .getAll(); + + try (Transaction tx = transactional ? client.transactions().txStart(PESSIMISTIC, READ_COMMITTED) : null) { + for (int i = begin; i < end; i++) { + cache.query(new SqlFieldsQuery("INSERT INTO emp (empid, deptid, name, salary) VALUES (?, ?, ?, ?)").setArgs( + i, i % 2, "Employee " + i, i)).getAll(); + + cache.query(new SqlFieldsQuery("UPDATE emp SET name = '' WHERE empid = ? AND deptid = ?").setArgs(i, i % 2)).getAll(); + cache.query(new SqlFieldsQuery("DELETE FROM emp WHERE empid = ?").setArgs(i - 1)).getAll(); + + cache.query(new SqlFieldsQuery( + "MERGE INTO emp dst USING table(system_range(1, 1000)) src ON dst.salary = src.x " + + "WHEN MATCHED THEN UPDATE SET dst.salary = src.x")).getAll(); + } + + if (tx != null) + tx.commit(); + } + } + /** */ private static class Person { /** */ diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java deleted file mode 100644 index 8c81cde7f0fc2..0000000000000 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PublicApiIntegrationTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.List; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -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.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; - -/** Public api integration tests. */ -public class PublicApiIntegrationTest extends AbstractBasicIntegrationTest { - /** */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - cfg.setSqlConfiguration(new SqlConfiguration() - .setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration().setDefault(true))); - - return cfg; - } - - /** */ - @Test - public void testSimpleInsert() { - IgniteCache cache = client.createCache(DEFAULT_CACHE_NAME); - - runQuery(0, nodeCount() * 10, false, cache); - - cache = cache.withKeepBinary(); - - runQuery(nodeCount() * 10, 2 * nodeCount() * 10, false, cache); - - List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); - - assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); - } - - /** */ - @Test - public void testTxInsert() { - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - - IgniteCache cache = client.createCache(ccfg); - - runQuery(0, nodeCount() * 10, true, cache); - - cache = cache.withKeepBinary(); - - runQuery(nodeCount() * 10, 2 * nodeCount() * 10, true, cache); - - List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); - - assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); - } - - /** */ - private void runQuery(int begin, int end, boolean transactional, IgniteCache cache) { - cache.query(new SqlFieldsQuery("CREATE TABLE IF NOT EXISTS emp(empid INTEGER, deptid INTEGER, name VARCHAR, salary INTEGER, " + - "PRIMARY KEY(empid, deptid)) WITH \"AFFINITY_KEY=deptid" + (transactional ? ", ATOMICITY=transactional" : "") + "\"")) - .getAll(); - - try (Transaction tx = transactional ? client.transactions().txStart(PESSIMISTIC, READ_COMMITTED) : null) { - for (int i = begin; i < end; i++) { - cache.query(new SqlFieldsQuery("INSERT INTO emp (empid, deptid, name, salary) VALUES (?, ?, ?, ?)").setArgs( - i, i % 2, "Employee " + i, i)).getAll(); - - cache.query(new SqlFieldsQuery("UPDATE emp SET name = '' WHERE empid = ? AND deptid = ?").setArgs(i, i % 2)).getAll(); - cache.query(new SqlFieldsQuery("DELETE FROM emp WHERE empid = ?").setArgs(i - 1)).getAll(); - - cache.query(new SqlFieldsQuery( - "MERGE INTO emp dst USING table(system_range(1, 1000)) src ON dst.salary = src.x " + - "WHEN MATCHED THEN UPDATE SET dst.salary = src.x")).getAll(); - } - - if (tx != null) - tx.commit(); - } - } -} 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 39726224cf074..f4e123c6a7c40 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 @@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.query.calcite.integration.OperatorsExtensionIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.PartitionPruneTest; import org.apache.ignite.internal.processors.query.calcite.integration.PartitionsReservationIntegrationTest; -import org.apache.ignite.internal.processors.query.calcite.integration.PublicApiIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.QueryBlockingTaskExecutorIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.QueryEngineConfigurationIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.QueryMetadataIntegrationTest; @@ -184,7 +183,6 @@ CacheWithInterceptorIntegrationTest.class, TxThreadLockingTest.class, SelectByKeyFieldTest.class, - PublicApiIntegrationTest.class, }) public class IntegrationTestSuite { } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java index 689e03c7417cd..600ff30da54f8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java @@ -59,7 +59,7 @@ public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheIdMess protected static final int DHT_ATOMIC_READ_REPAIR_RECOVERY_FLAG_MASK = 0x80; /** */ - protected static final int DHT_ATOMIC_UNWRAP_VALUE_FLAG_MASK = 0x100; + protected static final int DHT_ATOMIC_UNWRAP_VALUE_ON_INTERCEPTOR_FLAG_MASK = 0x100; /** Message index. */ public static final int CACHE_MSG_IDX = nextIndexId(); @@ -138,7 +138,7 @@ protected GridDhtAtomicAbstractUpdateRequest(int cacheId, if (readRepairRecovery) setFlag(true, DHT_ATOMIC_READ_REPAIR_RECOVERY_FLAG_MASK); if (unwrapVal) - setFlag(true, DHT_ATOMIC_UNWRAP_VALUE_FLAG_MASK); + setFlag(true, DHT_ATOMIC_UNWRAP_VALUE_ON_INTERCEPTOR_FLAG_MASK); } /** {@inheritDoc} */ @@ -206,7 +206,7 @@ public final boolean keepBinary() { /** */ public final boolean unwrapValue() { - return isFlag(DHT_ATOMIC_UNWRAP_VALUE_FLAG_MASK); + return isFlag(DHT_ATOMIC_UNWRAP_VALUE_ON_INTERCEPTOR_FLAG_MASK); } /** From 146e6199ed8e18801ad1e8d157ff1a805d38de12 Mon Sep 17 00:00:00 2001 From: zstan Date: Mon, 15 Jun 2026 13:26:53 +0300 Subject: [PATCH 5/5] change test --- .../KeepBinaryIntegrationTest.java | 88 ++++++------------- 1 file changed, 25 insertions(+), 63 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java index 0ee35a6880c4a..cd19da7dc9fbd 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java @@ -22,20 +22,14 @@ import java.util.Objects; import org.apache.ignite.IgniteCache; import org.apache.ignite.binary.BinaryObject; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.cache.query.annotations.QuerySqlField; import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.testframework.SupplierX; -import org.apache.ignite.transactions.Transaction; import org.junit.Test; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; - /** * Test "keep binary" in cache queries. */ @@ -164,80 +158,48 @@ public void testDynamicParameters() { /** */ @Test - public void testSimpleInsert() { - IgniteCache cache = null; + public void testDmlWithCompositePk() { + IgniteCache cache = client.createCache(cacheConfiguration().setName("testInsert")); - try { - cache = client.createCache("testInsert"); + if (sqlTxMode != SqlTransactionMode.NONE && tx == null) + startTransaction(client); - runQuery(0, nodeCount() * 10, false, cache); + SupplierX checker = () -> { + runQuery(0, nodeCount() * 10, cache); - cache = cache.withKeepBinary(); + IgniteCache cacheBin = cache.withKeepBinary(); - runQuery(nodeCount() * 10, 2 * nodeCount() * 10, false, cache); + runQuery(nodeCount() * 10, 2 * nodeCount() * 10, cacheBin); - List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); + List> res = cacheBin.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); - } - finally { - if (cache != null) - cache.destroy(); - - sql("DROP TABLE IF EXISTS emp"); - } - } - - /** */ - @Test - public void testTxInsert() { - IgniteCache cache = null; - - try { - CacheConfiguration ccfg = new CacheConfiguration<>("testInsert"); - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - - cache = client.createCache(ccfg); - - runQuery(0, nodeCount() * 10, true, cache); - - cache = cache.withKeepBinary(); - runQuery(nodeCount() * 10, 2 * nodeCount() * 10, true, cache); - - List> res = cache.query(new SqlFieldsQuery("SELECT * FROM emp")).getAll(); - - assertEquals("Unexpected result set size: " + res.size(), 1, res.size()); - } - finally { - if (cache != null) - cache.destroy(); + return null; + }; - sql("DROP TABLE IF EXISTS emp"); - } + if (sqlTxMode == SqlTransactionMode.NONE) + checker.get(); + else + txAction(client, checker); } /** */ - private void runQuery(int begin, int end, boolean transactional, IgniteCache cache) { + private void runQuery(int begin, int end, IgniteCache cache) { cache.query(new SqlFieldsQuery("CREATE TABLE IF NOT EXISTS emp(empid INTEGER, deptid INTEGER, name VARCHAR, salary INTEGER, " + - "PRIMARY KEY(empid, deptid)) WITH \"AFFINITY_KEY=deptid" + (transactional ? ", ATOMICITY=transactional" : "") + "\"")) + "PRIMARY KEY(empid, deptid)) WITH \"AFFINITY_KEY=deptid," + atomicity() + "\"")) .getAll(); - try (Transaction tx = transactional ? client.transactions().txStart(PESSIMISTIC, READ_COMMITTED) : null) { - for (int i = begin; i < end; i++) { - cache.query(new SqlFieldsQuery("INSERT INTO emp (empid, deptid, name, salary) VALUES (?, ?, ?, ?)").setArgs( - i, i % 2, "Employee " + i, i)).getAll(); - - cache.query(new SqlFieldsQuery("UPDATE emp SET name = '' WHERE empid = ? AND deptid = ?").setArgs(i, i % 2)).getAll(); - cache.query(new SqlFieldsQuery("DELETE FROM emp WHERE empid = ?").setArgs(i - 1)).getAll(); + for (int i = begin; i < end; i++) { + cache.query(new SqlFieldsQuery("INSERT INTO emp (empid, deptid, name, salary) VALUES (?, ?, ?, ?)").setArgs( + i, i % 2, "Employee " + i, i)).getAll(); - cache.query(new SqlFieldsQuery( - "MERGE INTO emp dst USING table(system_range(1, 1000)) src ON dst.salary = src.x " + - "WHEN MATCHED THEN UPDATE SET dst.salary = src.x")).getAll(); - } + cache.query(new SqlFieldsQuery("UPDATE emp SET name = '' WHERE empid = ? AND deptid = ?").setArgs(i, i % 2)).getAll(); + cache.query(new SqlFieldsQuery("DELETE FROM emp WHERE empid = ?").setArgs(i - 1)).getAll(); - if (tx != null) - tx.commit(); + cache.query(new SqlFieldsQuery( + "MERGE INTO emp dst USING table(system_range(1, 1000)) src ON dst.salary = src.x " + + "WHEN MATCHED THEN UPDATE SET dst.salary = src.x")).getAll(); } }