ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-9362: SQL: removed NODES.IS_LOCAL attribute. This closes #4610.
Date Tue, 28 Aug 2018 08:04:05 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 114f4c848 -> e2ff347ea


IGNITE-9362: SQL: removed NODES.IS_LOCAL attribute. This closes #4610.


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

Branch: refs/heads/master
Commit: e2ff347eaaf6a17dc8754fde1a5251967dcff124
Parents: 114f4c8
Author: Aleksey Plekhanov <plehanov.alex@gmail.com>
Authored: Tue Aug 28 11:03:57 2018 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Tue Aug 28 11:03:57 2018 +0300

----------------------------------------------------------------------
 .../query/h2/sys/view/SqlSystemViewNodes.java   |  9 ++---
 .../query/SqlSystemViewsSelfTest.java           | 37 ++++++++------------
 2 files changed, 17 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e2ff347e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodes.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodes.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodes.java
index 3e97faa..514f92e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodes.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodes.java
@@ -39,11 +39,10 @@ public class SqlSystemViewNodes extends SqlAbstractLocalSystemView {
      * @param ctx Grid context.
      */
     public SqlSystemViewNodes(GridKernalContext ctx) {
-        super("NODES", "Topology nodes", ctx, new String[] {"ID", "IS_LOCAL"},
+        super("NODES", "Topology nodes", ctx, new String[] {"ID"},
             newColumn("ID", Value.UUID),
             newColumn("CONSISTENT_ID"),
             newColumn("VERSION"),
-            newColumn("IS_LOCAL", Value.BOOLEAN),
             newColumn("IS_CLIENT", Value.BOOLEAN),
             newColumn("IS_DAEMON", Value.BOOLEAN),
             newColumn("NODE_ORDER", Value.INT),
@@ -58,12 +57,9 @@ public class SqlSystemViewNodes extends SqlAbstractLocalSystemView {
 
         Collection<ClusterNode> nodes;
 
-        SqlSystemViewColumnCondition locCond = conditionForColumn("IS_LOCAL", first, last);
         SqlSystemViewColumnCondition idCond = conditionForColumn("ID", first, last);
 
-        if (locCond.isEquality() && locCond.valueForEquality().getBoolean())
-            nodes = Collections.singleton(ctx.discovery().localNode());
-        else if (idCond.isEquality()) {
+        if (idCond.isEquality()) {
             UUID nodeId = uuidFromValue(idCond.valueForEquality());
 
             nodes = nodeId == null ? Collections.emptySet() : Collections.singleton(ctx.discovery().node(nodeId));
@@ -78,7 +74,6 @@ public class SqlSystemViewNodes extends SqlAbstractLocalSystemView {
                         node.id(),
                         node.consistentId(),
                         node.version(),
-                        node.isLocal(),
                         node.isClient(),
                         node.isDaemon(),
                         node.order(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/e2ff347e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
index bc5afa1..c8374a7 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
@@ -135,7 +135,7 @@ public class SqlSystemViewsSelfTest extends GridCommonAbstractTest {
 
         IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME);
 
-        String sql = "SELECT ID FROM IGNITE.NODES WHERE IS_LOCAL = true";
+        String sql = "SELECT ID FROM IGNITE.NODES WHERE NODE_ORDER = 1";
 
         SqlFieldsQuery qry;
 
@@ -187,47 +187,41 @@ public class SqlSystemViewsSelfTest extends GridCommonAbstractTest {
 
         awaitPartitionMapExchange();
 
-        List<List<?>> resAll = execSql("SELECT ID, CONSISTENT_ID, VERSION, IS_LOCAL,
IS_CLIENT, IS_DAEMON, " +
+        List<List<?>> resAll = execSql("SELECT ID, CONSISTENT_ID, VERSION, IS_CLIENT,
IS_DAEMON, " +
                 "NODE_ORDER, ADDRESSES, HOSTNAMES FROM IGNITE.NODES");
 
         assertColumnTypes(resAll.get(0), UUID.class, String.class, String.class, Boolean.class,
Boolean.class,
-            Boolean.class, Integer.class, String.class, String.class);
+            Integer.class, String.class, String.class);
 
         assertEquals(3, resAll.size());
 
         List<List<?>> resSrv = execSql(
-            "SELECT ID, IS_LOCAL, NODE_ORDER FROM IGNITE.NODES WHERE IS_CLIENT = FALSE AND
IS_DAEMON = FALSE"
+            "SELECT ID, NODE_ORDER FROM IGNITE.NODES WHERE IS_CLIENT = FALSE AND IS_DAEMON
= FALSE"
         );
 
         assertEquals(1, resSrv.size());
 
         assertEquals(ignite1.cluster().localNode().id(), resSrv.get(0).get(0));
 
-        assertEquals(true, resSrv.get(0).get(1));
-
-        assertEquals(1, resSrv.get(0).get(2));
+        assertEquals(1, resSrv.get(0).get(1));
 
         List<List<?>> resCli = execSql(
-            "SELECT ID, IS_LOCAL, NODE_ORDER FROM IGNITE.NODES WHERE IS_CLIENT = TRUE");
+            "SELECT ID, NODE_ORDER FROM IGNITE.NODES WHERE IS_CLIENT = TRUE");
 
         assertEquals(1, resCli.size());
 
         assertEquals(ignite2.cluster().localNode().id(), resCli.get(0).get(0));
 
-        assertEquals(false, resCli.get(0).get(1));
-
-        assertEquals(2, resCli.get(0).get(2));
+        assertEquals(2, resCli.get(0).get(1));
 
         List<List<?>> resDaemon = execSql(
-            "SELECT ID, IS_LOCAL, NODE_ORDER FROM IGNITE.NODES WHERE IS_DAEMON = TRUE");
+            "SELECT ID, NODE_ORDER FROM IGNITE.NODES WHERE IS_DAEMON = TRUE");
 
         assertEquals(1, resDaemon.size());
 
         assertEquals(ignite3.cluster().localNode().id(), resDaemon.get(0).get(0));
 
-        assertEquals(false, resDaemon.get(0).get(1));
-
-        assertEquals(3, resDaemon.get(0).get(2));
+        assertEquals(3, resDaemon.get(0).get(1));
 
         // Check index on ID column.
         assertEquals(0, execSql("SELECT ID FROM IGNITE.NODES WHERE ID = '-'").size());
@@ -238,23 +232,22 @@ public class SqlSystemViewsSelfTest extends GridCommonAbstractTest {
         assertEquals(1, execSql("SELECT ID FROM IGNITE.NODES WHERE ID = ?",
             ignite3.cluster().localNode().id()).size());
 
-        // Check index on IS_LOCAL column.
-        assertEquals(1, execSql("SELECT ID FROM IGNITE.NODES WHERE IS_LOCAL = true").size());
-
-        // Check index on IS_LOCAL column with disjunction.
-        assertEquals(3, execSql("SELECT ID FROM IGNITE.NODES WHERE IS_LOCAL = true OR node_order=1
OR node_order=2 OR node_order=3").size());
+        // Check index on ID column with disjunction.
+        assertEquals(3, execSql("SELECT ID FROM IGNITE.NODES WHERE ID = ? " +
+            "OR node_order=1 OR node_order=2 OR node_order=3", ignite1.cluster().localNode().id()).size());
 
         // Check quick-count.
         assertEquals(3L, execSql("SELECT COUNT(*) FROM IGNITE.NODES").get(0).get(0));
 
         // Check joins
         assertEquals(ignite1.cluster().localNode().id(), execSql("SELECT N1.ID FROM IGNITE.NODES
N1 JOIN " +
-            "IGNITE.NODES N2 ON N1.IS_LOCAL = N2.IS_LOCAL JOIN IGNITE.NODES N3 ON N2.ID =
N3.ID WHERE N3.IS_LOCAL = true")
+            "IGNITE.NODES N2 ON N1.NODE_ORDER = N2.NODE_ORDER JOIN IGNITE.NODES N3 ON N2.ID
= N3.ID " +
+            "WHERE N3.NODE_ORDER = 1")
             .get(0).get(0));
 
         // Check sub-query
         assertEquals(ignite1.cluster().localNode().id(), execSql("SELECT N1.ID FROM IGNITE.NODES
N1 " +
-            "WHERE NOT EXISTS (SELECT 1 FROM IGNITE.NODES N2 WHERE N2.ID = N1.ID AND N2.IS_LOCAL
= false)")
+            "WHERE NOT EXISTS (SELECT 1 FROM IGNITE.NODES N2 WHERE N2.ID = N1.ID AND N2.NODE_ORDER
<> 1)")
             .get(0).get(0));
 
         // Check node attributes view


Mime
View raw message