You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/11/25 12:31:13 UTC

[1/6] ignite git commit: IGNITE-1988 - Exception for explicit lock inside a transaction

Repository: ignite
Updated Branches:
  refs/heads/ignite-1990 1d3cf5aab -> dc8268ae4


IGNITE-1988 - Exception for explicit lock inside a transaction


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4d29cb7f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4d29cb7f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4d29cb7f

Branch: refs/heads/ignite-1990
Commit: 4d29cb7f87aafa505807f4b10cddd0264cdac85f
Parents: c23cda1
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 24 16:23:05 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 24 16:23:05 2015 -0800

----------------------------------------------------------------------
 .../processors/cache/CacheLockImpl.java         | 18 ++++++++-
 .../colocated/GridDhtColocatedLockFuture.java   |  8 ++--
 .../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++++++++++++++-
 3 files changed, 61 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
index 2e8dc9b..ae7b42e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
@@ -69,6 +69,8 @@ class CacheLockImpl<K, V> implements Lock {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
+            checkTx();
+
             delegate.lockAll(keys, 0);
 
             incrementLockCounter();
@@ -102,6 +104,8 @@ class CacheLockImpl<K, V> implements Lock {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
+            checkTx();
+
             boolean res = delegate.lockAll(keys, -1);
 
             if (res)
@@ -128,6 +132,8 @@ class CacheLockImpl<K, V> implements Lock {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
+            checkTx();
+
             IgniteInternalFuture<Boolean> fut = delegate.lockAllAsync(keys, unit.toMillis(time));
 
             try {
@@ -198,8 +204,18 @@ class CacheLockImpl<K, V> implements Lock {
         throw new UnsupportedOperationException();
     }
 
+    /**
+     * Verifies there is no ongoing user transaction.
+     *
+     * @throws CacheException
+     */
+    private void checkTx() throws CacheException {
+        if (delegate.context().tm().inUserTx())
+            throw new CacheException("Explicit lock can't be acquired within a transaction.");
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheLockImpl.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
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 7e6ce89..ecdf641 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
@@ -296,10 +296,6 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
         GridCacheMvccCandidate cand = cctx.mvcc().explicitLock(threadId, txKey);
 
         if (inTx()) {
-            IgniteTxEntry txEntry = tx.entry(txKey);
-
-            txEntry.cached(entry);
-
             if (cand != null) {
                 if (!tx.implicit())
                     throw new IgniteCheckedException("Cannot access key within transaction if lock is " +
@@ -308,6 +304,10 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
                     return null;
             }
             else {
+                IgniteTxEntry txEntry = tx.entry(txKey);
+
+                txEntry.cached(entry);
+
                 // Check transaction entries (corresponding tx entries must be enlisted in transaction).
                 cand = new GridCacheMvccCandidate(entry,
                     cctx.localNodeId(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index e8e86e9..89c4029 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -38,6 +36,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.Lock;
 import javax.cache.Cache;
+import javax.cache.CacheException;
 import javax.cache.expiry.Duration;
 import javax.cache.expiry.ExpiryPolicy;
 import javax.cache.expiry.TouchedExpiryPolicy;
@@ -45,6 +44,8 @@ import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.EntryProcessorException;
 import javax.cache.processor.EntryProcessorResult;
 import javax.cache.processor.MutableEntry;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
 import junit.framework.AssertionFailedError;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
@@ -5128,6 +5129,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testLockInsideTransaction() throws Exception {
+        if (txEnabled()) {
+            GridTestUtils.assertThrows(
+                log,
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        try (Transaction tx = ignite(0).transactions().txStart()) {
+                            jcache(0).lock("key").lock();
+                        }
+
+                        return null;
+                    }
+                },
+                CacheException.class,
+                "Explicit lock can't be acquired within a transaction."
+            );
+
+            GridTestUtils.assertThrows(
+                log,
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        try (Transaction tx = ignite(0).transactions().txStart()) {
+                            jcache(0).lockAll(Arrays.asList("key1", "key2")).lock();
+                        }
+
+                        return null;
+                    }
+                },
+                CacheException.class,
+                "Explicit lock can't be acquired within a transaction."
+            );
+        }
+    }
+
+    /**
      * Sets given value, returns old value.
      */
     public static final class SetValueProcessor implements EntryProcessor<String, Integer, Integer> {


[4/6] ignite git commit: IGNITE-1989 Updated scala dependencies.

Posted by ak...@apache.org.
 IGNITE-1989 Updated scala dependencies.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ef2007dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ef2007dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ef2007dc

Branch: refs/heads/ignite-1990
Commit: ef2007dcba0405a2f8921ce2b324b9e7036143ad
Parents: c40ab67
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Nov 25 16:29:22 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Nov 25 16:29:22 2015 +0700

----------------------------------------------------------------------
 examples/pom.xml              | 2 +-
 modules/scalar/pom.xml        | 4 ++--
 modules/spark/pom.xml         | 4 ++--
 modules/visor-console/pom.xml | 2 +-
 parent/pom.xml                | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ef2007dc/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 5129e7f..52b152e 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -124,7 +124,7 @@
                 <dependency>
                     <groupId>org.scalatest</groupId>
                     <artifactId>scalatest_2.11</artifactId>
-                    <version>2.2.2</version>
+                    <version>2.2.4</version>
                     <scope>test</scope>
                     <exclusions>
                         <exclusion>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef2007dc/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index 1443cc1..c8dce64 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.11.2</version>
+            <version>2.11.7</version>
         </dependency>
 
         <dependency>
@@ -72,7 +72,7 @@
         <dependency>
             <groupId>org.scalatest</groupId>
             <artifactId>scalatest_2.11</artifactId>
-            <version>2.2.2</version>
+            <version>2.2.4</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef2007dc/modules/spark/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark/pom.xml b/modules/spark/pom.xml
index 942652c..93c3e41 100644
--- a/modules/spark/pom.xml
+++ b/modules/spark/pom.xml
@@ -52,7 +52,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.11.2</version>
+            <version>2.11.7</version>
         </dependency>
 
         <dependency>
@@ -89,7 +89,7 @@
         <dependency>
             <groupId>org.scalatest</groupId>
             <artifactId>scalatest_2.11</artifactId>
-            <version>2.2.2</version>
+            <version>2.2.4</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef2007dc/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index b85cd69..e514a0f 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -80,7 +80,7 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.11.2</version>
+            <version>2.11.7</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ef2007dc/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2d3ff5f..a7ae644 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -36,7 +36,7 @@
     <properties>
         <ignite.edition>fabric</ignite.edition>
         <hadoop.version>2.4.1</hadoop.version>
-        <spark.version>1.5.1</spark.version>
+        <spark.version>1.5.2</spark.version>
         <spring.version>4.1.0.RELEASE</spring.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.build.timestamp.format>MMMM d yyyy</maven.build.timestamp.format>


[6/6] ignite git commit: IGNITE-1990 Added support for collecting new query and JDBC types metadata for Visor.

Posted by ak...@apache.org.
IGNITE-1990 Added support for collecting new query and JDBC types metadata for Visor.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc8268ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc8268ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc8268ae

Branch: refs/heads/ignite-1990
Commit: dc8268ae494b6a403f8de6ff2bc0234fe2e1d7be
Parents: 8537a7d
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Nov 25 18:31:16 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Nov 25 18:31:16 2015 +0700

----------------------------------------------------------------------
 .../visor/cache/VisorCacheConfiguration.java    |   4 +-
 .../cache/VisorCacheTypeFieldMetadata.java      |  30 +++-
 .../visor/cache/VisorCacheTypeMetadata.java     | 137 +++++++++++++++++--
 3 files changed, 149 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dc8268ae/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 073ad22..69eb311 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -138,7 +138,7 @@ public class VisorCacheConfiguration implements Serializable {
         maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
         memoryMode = ccfg.getMemoryMode();
         interceptor = compactClass(ccfg.getInterceptor());
-        typeMeta = VisorCacheTypeMetadata.list(ccfg.getTypeMetadata());
+        typeMeta = VisorCacheTypeMetadata.list(ccfg.getQueryEntities(), ccfg.getCacheStoreFactory(), ccfg.getTypeMetadata());
         statisticsEnabled = ccfg.isStatisticsEnabled();
         mgmtEnabled = ccfg.isManagementEnabled();
         ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
@@ -350,4 +350,4 @@ public class VisorCacheConfiguration implements Serializable {
     @Override public String toString() {
         return S.toString(VisorCacheConfiguration.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/dc8268ae/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
index c21354b..323e536 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
@@ -45,14 +45,30 @@ public class VisorCacheTypeFieldMetadata implements Serializable {
      * @return Data transfer object for given cache field metadata.
      */
     public static VisorCacheTypeFieldMetadata from(CacheTypeFieldMetadata f) {
-        VisorCacheTypeFieldMetadata fieldMetadata = new VisorCacheTypeFieldMetadata();
+        return new VisorCacheTypeFieldMetadata(f.getDatabaseName(), f.getDatabaseType(),
+            f.getJavaName(), U.compact(f.getJavaType().getName()));
+    }
 
-        fieldMetadata.dbName = f.getDatabaseName();
-        fieldMetadata.dbType = f.getDatabaseType();
-        fieldMetadata.javaName = f.getJavaName();
-        fieldMetadata.javaType = U.compact(f.getJavaType().getName());
+    /**
+     * Empty constructor.
+     */
+    public VisorCacheTypeFieldMetadata() {
+        // No-op.
+    }
 
-        return fieldMetadata;
+    /**
+     * Full constructor.
+     *
+     * @param dbName Column name in database.
+     * @param dbType Column JDBC type in database.
+     * @param javaName Field name in java object.
+     * @param javaType Corresponding java type.
+     */
+    public VisorCacheTypeFieldMetadata(String dbName, int dbType, String javaName, String javaType) {
+        this.dbName = dbName;
+        this.dbType = dbType;
+        this.javaName = javaName;
+        this.javaType = javaType;
     }
 
     /**
@@ -82,4 +98,4 @@ public class VisorCacheTypeFieldMetadata implements Serializable {
     public String javaType() {
         return javaType;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/dc8268ae/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
index 2a00ec1..0093073 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
@@ -18,17 +18,21 @@
 package org.apache.ignite.internal.visor.cache;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
+
 import org.apache.ignite.cache.CacheTypeFieldMetadata;
 import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
+import org.apache.ignite.cache.store.jdbc.JdbcType;
+import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 
+import javax.cache.configuration.Factory;
+
 /**
  * Data transfer object for {@link CacheTypeMetadata}.
  */
@@ -77,19 +81,126 @@ public class VisorCacheTypeMetadata implements Serializable {
     private Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps;
 
     /**
+     * @param qryEntities Collection of query entities.
+     * @param factory Store factory to extract JDBC types info.
      * @param types Cache types metadata configurations.
      * @return Data transfer object for cache type metadata configurations.
      */
-    public static Collection<VisorCacheTypeMetadata> list(Collection<CacheTypeMetadata> types) {
-        if (types == null)
-            return Collections.emptyList();
+    public static Collection<VisorCacheTypeMetadata> list(Collection<QueryEntity> qryEntities, Factory factory,
+        Collection<CacheTypeMetadata> types) {
+        final Collection<VisorCacheTypeMetadata> metas = new ArrayList<>();
+
+        Map<String, VisorCacheTypeMetadata> metaMap =
+                U.newHashMap(qryEntities != null ? qryEntities.size() : 0);
+
+        if (qryEntities != null)
+            for (QueryEntity qryEntity : qryEntities) {
+                VisorCacheTypeMetadata meta = from(qryEntity);
+
+                metas.add(meta);
+
+                metaMap.put(meta.keyType, meta);
+            }
+
+        if (factory != null && factory instanceof CacheJdbcPojoStoreFactory) {
+             CacheJdbcPojoStoreFactory jdbcFactory = (CacheJdbcPojoStoreFactory) factory;
+
+            for (JdbcType jdbcType : jdbcFactory.getTypes()) {
+                VisorCacheTypeMetadata meta = metaMap.get(jdbcType.getKeyType());
+
+                boolean notFound = meta == null;
+
+                if (notFound) {
+                    meta = new VisorCacheTypeMetadata();
+
+                    meta.keyType = jdbcType.getKeyType();
+                    meta.valType = jdbcType.getValueType();
+
+                    meta.qryFlds = Collections.emptyMap();
+                    meta.ascFlds = Collections.emptyMap();
+                    meta.descFlds = Collections.emptyMap();
+                    meta.txtFlds = Collections.emptyList();
+                    meta.grps = Collections.emptyMap();
+                }
+
+                meta.dbSchema = jdbcType.getDatabaseSchema();
+                meta.dbTbl = jdbcType.getDatabaseTable();
+
+                JdbcTypeField[] keyFields = jdbcType.getKeyFields();
+
+                meta.keyFields = new ArrayList<>(keyFields.length);
+
+                for (JdbcTypeField fld : keyFields)
+                    meta.keyFields.add(new VisorCacheTypeFieldMetadata(
+                        fld.getDatabaseFieldName(), fld.getDatabaseFieldType(),
+                        fld.getDatabaseFieldName(), U.compact(fld.getJavaFieldType().getName())));
+
+                JdbcTypeField[] valFields = jdbcType.getValueFields();
+
+                meta.valFields = new ArrayList<>(valFields.length);
+
+                for (JdbcTypeField fld : valFields)
+                    meta.valFields.add(new VisorCacheTypeFieldMetadata(
+                            fld.getDatabaseFieldName(), fld.getDatabaseFieldType(),
+                            fld.getDatabaseFieldName(), U.compact(fld.getJavaFieldType().getName())));
+
+                if (notFound)
+                    metas.add(meta);
+            }
+        }
+
+        if (types != null)
+            for (CacheTypeMetadata type : types)
+                metas.add(from(type));
+
+        return metas;
+    }
+
+    /**
+     * @param q Actual cache query entities.
+     * @return Data transfer object for given cache type metadata.
+     */
+    public static VisorCacheTypeMetadata from(QueryEntity q) {
+        assert q != null;
+
+        VisorCacheTypeMetadata metadata = new VisorCacheTypeMetadata();
+
+        metadata.keyType = q.getKeyType();
+        metadata.valType = q.getValueType();
+
+        metadata.dbSchema = "";
+        metadata.dbTbl = "";
+
+        metadata.keyFields = Collections.emptyList();
+        metadata.valFields = Collections.emptyList();
 
-        final Collection<VisorCacheTypeMetadata> cfgs = new ArrayList<>(types.size());
+        LinkedHashMap<String, String> qryFields = q.getFields();
 
-        for (CacheTypeMetadata type : types)
-            cfgs.add(from(type));
+        metadata.qryFlds = new LinkedHashMap<>(qryFields);
 
-        return cfgs;
+        metadata.ascFlds = Collections.emptyMap();
+        metadata.descFlds = Collections.emptyMap();
+        metadata.txtFlds = Collections.emptyList();
+
+        Collection<QueryIndex> qryIdxs = q.getIndexes();
+
+        metadata.grps = new LinkedHashMap<>(qryIdxs.size());
+
+        for (QueryIndex qryIdx : qryIdxs) {
+            LinkedHashMap<String, Boolean> qryIdxFlds = qryIdx.getFields();
+
+            LinkedHashMap<String, IgniteBiTuple<String, Boolean>> grpFlds = new LinkedHashMap<>();
+
+            for (Map.Entry<String, Boolean> qryIdxFld : qryIdxFlds.entrySet()) {
+                String fldName = qryIdxFld.getKey();
+
+                grpFlds.put(fldName, new IgniteBiTuple<>(qryFields.get(fldName), !qryIdxFld.getValue()));
+            }
+
+            metadata.grps.put(qryIdx.getName(), grpFlds);
+        }
+
+        return metadata;
     }
 
     /**
@@ -246,4 +357,4 @@ public class VisorCacheTypeMetadata implements Serializable {
     public Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps() {
         return grps;
     }
-}
\ No newline at end of file
+}


[3/6] ignite git commit: IGNITE-1983 Platforms: fixed a problem with incorrect reader behavior for platform streams.

Posted by ak...@apache.org.
IGNITE-1983 Platforms: fixed a problem with incorrect reader behavior for platform streams.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c40ab677
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c40ab677
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c40ab677

Branch: refs/heads/ignite-1990
Commit: c40ab677e69f0d756281c62549cb2f63de907ed6
Parents: dafad52
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Nov 25 10:14:26 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 25 10:14:26 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryReaderExImpl.java     | 18 +++++++++++++++---
 .../processors/platform/PlatformContextImpl.java  |  2 +-
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c40ab677/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 4809c3c..872d7a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -162,6 +162,20 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
      */
     public BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, ClassLoader ldr,
         @Nullable BinaryReaderHandles hnds) {
+        this(ctx, in, ldr, hnds, false);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param ctx Context.
+     * @param in Input stream.
+     * @param ldr Class loader.
+     * @param hnds Context.
+     * @param skipHdrCheck Whether to skip header check.
+     */
+    public BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, ClassLoader ldr,
+        @Nullable BinaryReaderHandles hnds, boolean skipHdrCheck) {
         // Initialize base members.
         this.ctx = ctx;
         this.in = in;
@@ -170,10 +184,8 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
 
         start = in.position();
 
-        byte hdr = in.readByte();
-
         // Perform full header parsing in case of portable object.
-        if (hdr == GridPortableMarshaller.OBJ) {
+        if (!skipHdrCheck && (in.readByte() == GridPortableMarshaller.OBJ)) {
             // Ensure protocol is fine.
             PortableUtils.checkProtocolVersion(in.readByte());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c40ab677/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 9a7f0df..7db752a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -177,7 +177,7 @@ public class PlatformContextImpl implements PlatformContext {
     /** {@inheritDoc} */
     @Override public BinaryRawReaderEx reader(PlatformInputStream in) {
         // TODO: IGNITE-1272 - Is class loader needed here?
-        return new BinaryReaderExImpl(marsh.context(), in, null);
+        return new BinaryReaderExImpl(marsh.context(), in, null, null, true);
     }
 
     /** {@inheritDoc} */


[2/6] ignite git commit: Better exception message if Ignite is not started

Posted by ak...@apache.org.
Better exception message if Ignite is not started


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dafad526
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dafad526
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dafad526

Branch: refs/heads/ignite-1990
Commit: dafad526f84ecbf503135c7538ffef07dd5e1c4f
Parents: 4d29cb7
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 24 16:34:37 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 24 16:34:37 2015 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/internal/IgnitionEx.java    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dafad526/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 7d2b2dc..6bd74be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1187,8 +1187,8 @@ public class IgnitionEx {
         Ignite res;
 
         if (grid == null || (res = grid.grid()) == null)
-            throw new IgniteIllegalStateException("Grid instance was not properly started " +
-                "or was already stopped: " + name);
+            throw new IgniteIllegalStateException("Ignite instance with provided name doesn't exist. " +
+                "Did you call Ignition.start(..) to start an Ignite instance? [name=" + name + ']');
 
         return res;
     }
@@ -1205,7 +1205,8 @@ public class IgnitionEx {
         IgniteKernal res;
 
         if (grid == null || (res = grid.gridx()) == null)
-            throw new IllegalStateException("Grid instance was not properly started or was already stopped: " + name);
+            throw new IgniteIllegalStateException("Ignite instance with provided name doesn't exist. " +
+                "Did you call Ignition.start(..) to start an Ignite instance? [name=" + name + ']');
 
         return res;
     }
@@ -2388,4 +2389,4 @@ public class IgnitionEx {
             }
         }
     }
-}
\ No newline at end of file
+}


[5/6] ignite git commit: Merge branches 'ignite-1.5' and 'ignite-1990' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1990

Posted by ak...@apache.org.
Merge branches 'ignite-1.5' and 'ignite-1990' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1990


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8537a7d1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8537a7d1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8537a7d1

Branch: refs/heads/ignite-1990
Commit: 8537a7d1ef62b813ca8cbb82624f95f06d3e519b
Parents: 1d3cf5a ef2007d
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Nov 25 16:40:03 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Nov 25 16:40:03 2015 +0700

----------------------------------------------------------------------
 examples/pom.xml                                |  2 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  9 +++--
 .../internal/portable/BinaryReaderExImpl.java   | 18 +++++++--
 .../processors/cache/CacheLockImpl.java         | 18 ++++++++-
 .../colocated/GridDhtColocatedLockFuture.java   |  8 ++--
 .../platform/PlatformContextImpl.java           |  2 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++++++++++++++-
 modules/scalar/pom.xml                          |  4 +-
 modules/spark/pom.xml                           |  4 +-
 modules/visor-console/pom.xml                   |  2 +-
 parent/pom.xml                                  |  2 +-
 11 files changed, 89 insertions(+), 22 deletions(-)
----------------------------------------------------------------------