ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [ignite] branch master updated: IGNITE-13261 Fix transactions and scan queries inside the ignite sandbox - Fixes #8049.
Date Tue, 21 Jul 2020 14:29:19 GMT
This is an automated email from the ASF dual-hosted git repository.

alexpl 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 cd87fbd  IGNITE-13261 Fix transactions and scan queries inside the ignite sandbox
- Fixes #8049.
cd87fbd is described below

commit cd87fbd0ddac730ff2b2ad00ed4c488c875b06cd
Author: d.garus <garus.d.g@gmail.com>
AuthorDate: Tue Jul 21 19:26:48 2020 +0500

    IGNITE-13261 Fix transactions and scan queries inside the ignite sandbox - Fixes #8049.
    
    Signed-off-by: Aleksey Plekhanov <plehanov.alex@gmail.com>
---
 .../sandbox/SandboxIgniteComponentProxy.java       |  8 +++++-
 .../sandbox/IgniteOperationsInsideSandboxTest.java | 29 +++++++++++++++++++---
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/sandbox/SandboxIgniteComponentProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/sandbox/SandboxIgniteComponentProxy.java
index c8863eb..a8d79ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/sandbox/SandboxIgniteComponentProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/sandbox/SandboxIgniteComponentProxy.java
@@ -39,7 +39,10 @@ import org.apache.ignite.IgniteSemaphore;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.IgniteTransactions;
 import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.internal.processors.security.SecurityUtils;
+import org.apache.ignite.internal.util.lang.GridIterator;
+import org.apache.ignite.transactions.Transaction;
 
 /** Create instace of Ignite component proxy to use inside the Ignite Sandbox. */
 public final class SandboxIgniteComponentProxy {
@@ -62,7 +65,10 @@ public final class SandboxIgniteComponentProxy {
         IgniteQueue.class,
         IgniteSet.class,
         IgniteBinary.class,
-        Affinity.class
+        Affinity.class,
+        QueryCursor.class,
+        GridIterator.class,
+        Transaction.class
     };
 
     /**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/sandbox/IgniteOperationsInsideSandboxTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/sandbox/IgniteOperationsInsideSandboxTest.java
index aa64e27..f0df33c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/sandbox/IgniteOperationsInsideSandboxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/sandbox/IgniteOperationsInsideSandboxTest.java
@@ -21,11 +21,13 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
+import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCompute;
 import org.apache.ignite.IgniteDataStreamer;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheEntryProcessor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cluster.ClusterNode;
@@ -40,6 +42,7 @@ import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
@@ -110,19 +113,18 @@ public class IgniteOperationsInsideSandboxTest extends AbstractSandboxTest
{
         return super.getConfiguration(igniteInstanceName)
             .setCacheConfiguration(
                 new CacheConfiguration<String, String>(TEST_CACHE)
+                    .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
                     .setCacheStoreFactory(new TestStoreFactory("1", "val"))
             );
     }
 
     /** {@inheritDoc} */
     @Override protected void prepareCluster() throws Exception {
-        Ignite srv = startGrid(SRV, ALLOW_ALL, false);
+        startGrid(SRV, ALLOW_ALL, false);
 
         startGrid("srv_2", ALLOW_ALL, false);
 
         startGrid(CLNT_ALLOWED_WRITE_PROP, ALLOW_ALL, true);
-
-        srv.cluster().active(true);
     }
 
     /** */
@@ -181,7 +183,10 @@ public class IgniteOperationsInsideSandboxTest extends AbstractSandboxTest
{
                     cache.invokeAsync("key", processor()).get();
                     cache.invokeAllAsync(singleton("key"), processor()).get();
 
-                    cache.query(new ScanQuery<String, Integer>()).getAll();
+                    for (Cache.Entry<String, String> entry : cache)
+                        log.info(entry.toString());
+
+                    cache.query(new ScanQuery<String, String>()).getAll();
                 }
             }
         );
@@ -204,6 +209,22 @@ public class IgniteOperationsInsideSandboxTest extends AbstractSandboxTest
{
     }
 
     /** */
+    @Test
+    public void testTransaction() {
+        compute().broadcast(
+            new TestRunnable() {
+                @Override public void run() {
+                    try (Transaction tx = ignite.transactions().txStart()) {
+                        ignite.cache(TEST_CACHE).put("key", "transaction_test");
+                        ignite.cache(TEST_CACHE).get("key");
+
+                        tx.commit();
+                    }
+                }
+            });
+    }
+
+    /** */
     private IgniteCompute compute() {
         Ignite clnt = grid(CLNT_ALLOWED_WRITE_PROP);
 


Mime
View raw message