You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2022/02/02 08:09:32 UTC
[ignite] branch master updated: IGNITE-16405 Fix NoClassDefFound on invokeAsync with using BinaryObjects. (#9772)
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 6c00a0d IGNITE-16405 Fix NoClassDefFound on invokeAsync with using BinaryObjects. (#9772)
6c00a0d is described below
commit 6c00a0d76536b80229bb25984915d87068fd37d6
Author: Andrew V. Mashenkov <AM...@users.noreply.github.com>
AuthorDate: Wed Feb 2 11:08:56 2022 +0300
IGNITE-16405 Fix NoClassDefFound on invokeAsync with using BinaryObjects. (#9772)
---
.../processors/cache/GridCacheAdapter.java | 13 ++++----
.../cache/IgniteCacheManyAsyncOperationsTest.java | 35 ++++++++++++++++++++++
2 files changed, 43 insertions(+), 5 deletions(-)
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 3fb52db..bc233d2 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
@@ -4577,12 +4577,16 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
else if (ctx.gate().isStopped())
fut0 = new GridFinishedFuture<>(new CacheStoppedException(ctx.name()));
else {
+ ctx.operationContextPerCall(opCtx);
+ ctx.shared().txContextReset();
+
try {
- fut0 = op.op(tx0, opCtx).chain(clo);
+ fut0 = op.op(tx0).chain(clo);
}
finally {
// It is necessary to clear tx context in this thread as well.
ctx.shared().txContextReset();
+ ctx.operationContextPerCall(null);
}
}
@@ -4614,7 +4618,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
IgniteInternalFuture<T> f;
try {
- f = op.op(tx, opCtx).chain(clo);
+ f = op.op(tx).chain(clo);
}
finally {
// It is necessary to clear tx context in this thread as well.
@@ -5705,10 +5709,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* @param tx Transaction.
- * @param opCtx Operation context.
* @return Operation future.
*/
- public IgniteInternalFuture<T> op(final GridNearTxLocal tx, CacheOperationContext opCtx) {
+ public IgniteInternalFuture<T> op(final GridNearTxLocal tx) {
AffinityTopologyVersion txTopVer = tx.topologyVersionSnapshot();
if (txTopVer != null)
@@ -5722,7 +5725,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (topFut == null || topFut.isDone())
return op(tx, topVer);
else
- return waitTopologyFuture(topFut, topVer, tx, opCtx);
+ return waitTopologyFuture(topFut, topVer, tx, ctx.operationContextPerCall());
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
index 6981063..d209867 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
@@ -21,8 +21,13 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -99,4 +104,34 @@ public class IgniteCacheManyAsyncOperationsTest extends IgniteCacheAbstractTest
}
}
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testInvokeAsyncWithKeepBinary() throws Exception {
+ try (Ignite client = startClientGrid(gridCount())) {
+ assertTrue(client.configuration().isClientMode());
+
+ IgniteCache<Integer, BinaryObject> cache = client.cache(DEFAULT_CACHE_NAME).withKeepBinary();
+
+ BinaryObject value = client.binary().builder("TEST").build();
+
+ cache.put(1, value);
+
+ // Start parallel operations to initiate operation retry.
+ List<IgniteFuture<Void>> futs = IntStream.range(0, 1000).parallel().mapToObj(i ->
+ cache.invokeAsync(1, new EntryProcessor<Integer, BinaryObject, Void>() {
+ @Override public Void process(MutableEntry<Integer, BinaryObject> e, Object... args) {
+ BinaryObject val = e.getValue();
+
+ assertNotNull(val);
+
+ return null;
+ }
+ })).collect(Collectors.toList());
+
+ futs.forEach(f -> f.get());
+ }
+ }
}