shishkovilja commented on code in PR #13095:
URL: https://github.com/apache/ignite/pull/13095#discussion_r3637302281


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessageUnmarshalThreadIntegrationTest.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.processors.query.calcite.message;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import 
org.apache.ignite.internal.processors.query.calcite.exec.task.AbstractQueryTaskExecutor;
+import 
org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
+import org.junit.Test;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Verifies that payload of calcite messages is unmarshalled on the query task 
executor, not on a NIO thread: probe
+ * objects travel as {@code QueryStartRequest} parameters and as {@code 
QueryBatchMessage} rows, and record the thread
+ * that deserializes them.
+ */
+public class CalciteMessageUnmarshalThreadIntegrationTest extends 
AbstractBasicIntegrationTest {
+    /** */
+    private static final int ROWS = 200;
+
+    /** Names of the threads that deserialized a {@link Probe}. */
+    private static final Queue<String> unmarshalThreads = new 
ConcurrentLinkedQueue<>();
+
+    /** {@inheritDoc} */
+    @Override protected int nodeCount() {
+        return 2;
+    }
+
+    /** */
+    @Test
+    public void testPayloadUnmarshalledOnQueryExecutor() {
+        sql("CREATE TABLE t(id INT PRIMARY KEY, oth OTHER)");
+
+        for (int i = 0; i < ROWS; i++)
+            sql("INSERT INTO t VALUES (?, ?)", i, new Probe());
+
+        unmarshalThreads.clear();
+
+        List<List<?>> res = sql("SELECT id, oth FROM t WHERE oth != ?", new 
Probe());
+
+        assertEquals(ROWS, res.size());
+
+        assertFalse("No probe deserialization recorded", 
unmarshalThreads.isEmpty());
+
+        List<String> nioThreads = unmarshalThreads.stream().filter(t -> 
t.contains("nio")).collect(toList());
+
+        assertTrue("Message payload unmarshalled on NIO threads: " + 
nioThreads, nioThreads.isEmpty());
+
+        assertTrue("No probe deserialization on the query task executor: " + 
unmarshalThreads,
+            unmarshalThreads.stream().anyMatch(t -> 
t.startsWith(AbstractQueryTaskExecutor.THREAD_PREFIX)));

Review Comment:
   ```suggestion
               unmarshalThreads.stream().allMatch(t -> 
t.startsWith(AbstractQueryTaskExecutor.THREAD_PREFIX)));
   ```



##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessageUnmarshalThreadIntegrationTest.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.ignite.internal.processors.query.calcite.message;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import 
org.apache.ignite.internal.processors.query.calcite.exec.task.AbstractQueryTaskExecutor;
+import 
org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
+import org.junit.Test;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Verifies that payload of calcite messages is unmarshalled on the query task 
executor, not on a NIO thread: probe
+ * objects travel as {@code QueryStartRequest} parameters and as {@code 
QueryBatchMessage} rows, and record the thread
+ * that deserializes them.
+ */
+public class CalciteMessageUnmarshalThreadIntegrationTest extends 
AbstractBasicIntegrationTest {
+    /** */
+    private static final int ROWS = 200;
+
+    /** Names of the threads that deserialized a {@link Probe}. */
+    private static final Queue<String> unmarshalThreads = new 
ConcurrentLinkedQueue<>();
+
+    /** {@inheritDoc} */
+    @Override protected int nodeCount() {
+        return 2;
+    }
+
+    /** */
+    @Test
+    public void testPayloadUnmarshalledOnQueryExecutor() {
+        sql("CREATE TABLE t(id INT PRIMARY KEY, oth OTHER)");
+
+        for (int i = 0; i < ROWS; i++)
+            sql("INSERT INTO t VALUES (?, ?)", i, new Probe());
+
+        unmarshalThreads.clear();
+
+        List<List<?>> res = sql("SELECT id, oth FROM t WHERE oth != ?", new 
Probe());
+
+        assertEquals(ROWS, res.size());
+
+        assertFalse("No probe deserialization recorded", 
unmarshalThreads.isEmpty());
+
+        List<String> nioThreads = unmarshalThreads.stream().filter(t -> 
t.contains("nio")).collect(toList());

Review Comment:
   ```suggestion
           List<String> nioThreads = unmarshalThreads.stream().filter(t -> 
t.contains("nio")).toList();
   ```



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java:
##########
@@ -58,25 +58,25 @@ public class CacheContinuousQueryEntry implements 
GridCacheDeployable, Marshalla
     @GridToStringInclude
     KeyCacheObject key;
 
-    /** */
+    /** {@code null} for a filtered entry. */
     @Order(2)
-    byte[] keyBytes;
+    KeyCacheObject keyWire;
 
     /** New value. */
     @GridToStringInclude
     CacheObject newVal;
 
-    /** */
+    /** {@code null} for a filtered entry. */
     @Order(3)
-    byte[] newValBytes;
+    CacheObject newValWire;

Review Comment:
   Why do we need a duplicate?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java:
##########
@@ -58,25 +58,25 @@ public class CacheContinuousQueryEntry implements 
GridCacheDeployable, Marshalla
     @GridToStringInclude
     KeyCacheObject key;
 
-    /** */
+    /** {@code null} for a filtered entry. */
     @Order(2)
-    byte[] keyBytes;
+    KeyCacheObject keyWire;
 
     /** New value. */
     @GridToStringInclude
     CacheObject newVal;
 
-    /** */
+    /** {@code null} for a filtered entry. */
     @Order(3)
-    byte[] newValBytes;
+    CacheObject newValWire;
 
     /** Old value. */
     @GridToStringInclude
     CacheObject oldVal;
 
-    /** */
+    /** {@code null} for a filtered entry. */
     @Order(4)
-    byte[] oldValBytes;
+    CacheObject oldValWire;

Review Comment:
   Why do we need it?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java:
##########
@@ -58,25 +58,25 @@ public class CacheContinuousQueryEntry implements 
GridCacheDeployable, Marshalla
     @GridToStringInclude
     KeyCacheObject key;
 
-    /** */
+    /** {@code null} for a filtered entry. */
     @Order(2)
-    byte[] keyBytes;
+    KeyCacheObject keyWire;

Review Comment:
   Why do we need a duplicate?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to