geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [07/46] geode git commit: GEODE-2100: Add new version of query client server messages
Date Mon, 12 Dec 2016 22:36:10 GMT
GEODE-2100: Add new version of query client server messages

Added new versions of messages, preventing CumulativeNonDistinctResults
from being sent back to a pre Geode client.


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

Branch: refs/heads/feature/GEODE-1930
Commit: 30bcdf8858d48be27b9d312ace6e0314c84a7789
Parents: c45fe4c
Author: Jason Huynh <huynhja@gmail.com>
Authored: Tue Nov 8 15:56:02 2016 -0800
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Wed Nov 16 16:32:58 2016 -0800

----------------------------------------------------------------------
 .../cache/tier/sockets/BaseCommandQuery.java    |  6 ++-
 .../cache/tier/sockets/CommandInitializer.java  |  5 +++
 .../cache/tier/sockets/command/Query.java       |  9 ++++-
 .../cache/tier/sockets/command/Query651.java    | 11 +++++-
 .../tier/sockets/command/QueryGeode10.java      | 39 ++++++++++++++++++++
 .../command/QueryWithParametersGeode10.java     | 35 ++++++++++++++++++
 .../internal/JUnit4DistributedTestCase.java     | 11 ++++--
 7 files changed, 109 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
index 08c2ecf..24711e4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -177,7 +177,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
 
         // Get the collection type (which includes the element type)
         // (used to generate the appropriate instance on the client)
-        collectionType = selectResults.getCollectionType();
+        collectionType = getCollectionType(selectResults);
         isStructs = collectionType.getElementType().isStructType();
 
         // Check if the Query is from CQ execution.
@@ -300,6 +300,10 @@ public abstract class BaseCommandQuery extends BaseCommand {
     return true;
   }
 
+  protected CollectionType getCollectionType(SelectResults results) {
+    return results.getCollectionType();
+  }
+
   private boolean sendCqResultsWithKey(ServerConnection servConn) {
     Version clientVersion = servConn.getClientVersion();
     if (clientVersion.compareTo(Version.GFE_65) >= 0) {

http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
index 579a3e1..0fe44cf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
@@ -81,6 +81,8 @@ import org.apache.geode.internal.cache.tier.sockets.command.PutAll80;
 import org.apache.geode.internal.cache.tier.sockets.command.PutAllWithCallback;
 import org.apache.geode.internal.cache.tier.sockets.command.PutUserCredentials;
 import org.apache.geode.internal.cache.tier.sockets.command.Query651;
+import org.apache.geode.internal.cache.tier.sockets.command.QueryGeode10;
+import org.apache.geode.internal.cache.tier.sockets.command.QueryWithParametersGeode10;
 import org.apache.geode.internal.cache.tier.sockets.command.RegisterDataSerializers;
 import org.apache.geode.internal.cache.tier.sockets.command.RegisterInstantiators;
 import org.apache.geode.internal.cache.tier.sockets.command.RegisterInterest;
@@ -325,6 +327,9 @@ public class CommandInitializer {
       Map<Integer, Command> gfe90Commands = new HashMap<Integer, Command>();
       gfe90Commands.putAll(ALL_COMMANDS.get(Version.GFE_82));
       ALL_COMMANDS.put(Version.GFE_90, gfe90Commands);
+      gfe90Commands.put(MessageType.QUERY_WITH_PARAMETERS, QueryWithParametersGeode10.getCommand());
+      gfe90Commands.put(MessageType.QUERY, QueryGeode10.getCommand());
+
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
index a6dc022..54235c1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
@@ -18,13 +18,17 @@
 package org.apache.geode.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.geode.cache.operations.QueryOperationContext;
 import org.apache.geode.cache.query.QueryExecutionLowMemoryException;
 import org.apache.geode.cache.query.QueryInvalidException;
 import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.SelectResults;
 import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.cache.query.internal.types.CollectionTypeImpl;
+import org.apache.geode.cache.query.types.CollectionType;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.sockets.BaseCommandQuery;
@@ -40,7 +44,7 @@ public class Query extends BaseCommandQuery {
     return singleton;
   }
 
-  private Query() {}
+  protected Query() {}
 
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
@@ -97,4 +101,7 @@ public class Query extends BaseCommandQuery {
     }
   }
 
+  protected CollectionType getCollectionType(SelectResults selectResults) {
+    return new CollectionTypeImpl(List.class, selectResults.getCollectionType().getElementType());
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
index 51b2a24..4e30039 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
@@ -17,6 +17,9 @@
  */
 package org.apache.geode.internal.cache.tier.sockets.command;
 
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.internal.types.CollectionTypeImpl;
+import org.apache.geode.cache.query.types.CollectionType;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.MessageType;
@@ -27,6 +30,7 @@ import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.cache.query.internal.DefaultQuery;
 import org.apache.geode.cache.query.QueryInvalidException;
 import java.io.IOException;
+import java.util.List;
 import java.util.Set;
 
 public class Query651 extends BaseCommandQuery {
@@ -37,7 +41,7 @@ public class Query651 extends BaseCommandQuery {
     return singleton;
   }
 
-  private Query651() {}
+  protected Query651() {}
 
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
@@ -131,4 +135,9 @@ public class Query651 extends BaseCommandQuery {
     }
   }
 
+  protected CollectionType getCollectionType(SelectResults selectResults) {
+    return new CollectionTypeImpl(List.class, selectResults.getCollectionType().getElementType());
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryGeode10.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryGeode10.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryGeode10.java
new file mode 100644
index 0000000..36ee1f5
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryGeode10.java
@@ -0,0 +1,39 @@
+/*
+ * 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.geode.internal.cache.tier.sockets.command;
+
+import java.util.List;
+
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.internal.types.CollectionTypeImpl;
+import org.apache.geode.cache.query.types.CollectionType;
+import org.apache.geode.internal.cache.tier.Command;
+
+
+public class QueryGeode10 extends Query {
+
+  private final static QueryGeode10 singleton = new QueryGeode10();
+
+  public static Command getCommand() {
+    return singleton;
+  }
+
+  protected CollectionType getCollectionType(SelectResults selectResults) {
+    return selectResults.getCollectionType();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryWithParametersGeode10.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryWithParametersGeode10.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryWithParametersGeode10.java
new file mode 100644
index 0000000..1137a30
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/QueryWithParametersGeode10.java
@@ -0,0 +1,35 @@
+/*
+ * 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.geode.internal.cache.tier.sockets.command;
+
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.types.CollectionType;
+import org.apache.geode.internal.cache.tier.Command;
+
+public class QueryWithParametersGeode10 extends Query651 {
+
+  private final static QueryWithParametersGeode10 singleton = new QueryWithParametersGeode10();
+
+  public static Command getCommand() {
+    return singleton;
+  }
+
+  protected CollectionType getCollectionType(SelectResults selectResults) {
+    return selectResults.getCollectionType();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/30bcdf88/geode-core/src/test/java/org/apache/geode/test/dunit/internal/JUnit4DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/internal/JUnit4DistributedTestCase.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/JUnit4DistributedTestCase.java
index 838bb29..ebbb2fd 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/internal/JUnit4DistributedTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/JUnit4DistributedTestCase.java
@@ -484,13 +484,16 @@ public abstract class JUnit4DistributedTestCase implements DistributedTestFixtur
   @After
   public final void tearDown() throws Exception {
     try {
-      preTearDownAssertions();
+      try {
+        preTearDownAssertions();
+      } finally {
+        preTearDown();
+        tearDownDistributedTestCase();
+      }
     } finally {
-      preTearDown();
-      tearDownDistributedTestCase();
       postTearDown();
+      postTearDownAssertions();
     }
-    postTearDownAssertions();
   }
 
   private final void tearDownDistributedTestCase() throws Exception {


Mime
View raw message