xtern commented on code in PR #4827:
URL: https://github.com/apache/ignite-3/pull/4827#discussion_r1869854293
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/message/ErrorMessage.java:
##########
@@ -34,6 +34,8 @@ public interface ErrorMessage extends NetworkMessage,
Serializable {
*/
UUID queryId();
+ int executionToken();
Review Comment:
I would recommend adding javadoc for consistency with other methods.
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -600,13 +589,10 @@ public void onDisappeared(ClusterNode member) {
/** Returns local fragments for the query with given id. */
public List<AbstractNode<?>> localFragments(UUID queryId) {
- DistributedQueryManager mgr = queryManagerMap.get(queryId);
-
- if (mgr == null) {
- return List.of();
- }
-
- return mgr.localFragments();
+ return queryManagerMap.entrySet().stream()
Review Comment:
Since this method is only used in tests, can we mark it as an `@Testonly`
method?
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImplTest.java:
##########
@@ -1081,6 +1041,70 @@ public void timeoutFiredOnInitialization() throws
Throwable {
}
}
+ @Test
+ void executionsWithTheSameQueryIdMustNotInterfere() {
+ QueryPlan plan = prepare("SELECT * FROM test_tbl",
operationContext(null).build());
+
+ String expectedExceptionMessage = "This is expected";
+
+ TestNode corruptedNode = testCluster.node(nodeNames.get(2));
+ corruptedNode.interceptor((nodeName, msg, original) -> {
+ if (msg instanceof QueryBatchRequestMessage) {
+ corruptedNode.messageService().send(nodeName, new
SqlQueryMessagesFactory().errorMessage()
+ .queryId(((QueryBatchRequestMessage) msg).queryId())
+ .executionToken(((QueryBatchRequestMessage)
msg).executionToken())
+ .fragmentId(((QueryBatchRequestMessage)
msg).fragmentId())
+ .message(expectedExceptionMessage)
+ .traceId(((QueryBatchRequestMessage) msg).queryId())
+ .code(Common.INTERNAL_ERR)
+ .build()
+ );
+ } else {
+ original.onMessage(nodeName, msg);
+ }
+
+ return nullCompletedFuture();
+ });
+
+ SqlOperationContext ctx = operationContext(null).build();
+
+ Queue<Throwable> exceptions = new ConcurrentLinkedQueue<>();
+ BiFunction<AsyncDataCursor<InternalSqlRow>, Integer,
CompletableFuture<Void>> retryChainBuilder = new BiFunction<>() {
+ @Override
+ public CompletableFuture<Void> apply(
+ @Nullable AsyncDataCursor<InternalSqlRow> cursor, Integer
remainingAttempts
+ ) {
+ CompletableFuture<Void> previousStep;
+ if (cursor == null) {
+ previousStep = nullCompletedFuture();
+ } else {
+ previousStep = cursor.onFirstPageReady()
+ .thenCompose(none -> cursor.onClose())
+ .exceptionally(ex -> {
+ exceptions.add(ex);
+
+ return null;
+ });
+ }
+
+ if (remainingAttempts > 0) {
+ return previousStep
+ .thenCompose(ignored ->
executionServices.get(0).executePlan(plan, ctx))
+ .thenCompose(c -> this.apply(c, remainingAttempts
- 1));
+ }
+
+ return previousStep;
+ }
+ };
+
+ int retryCount = 20;
+ await(retryChainBuilder.apply(null, retryCount));
+
Review Comment:
```suggestion
assertThat(exceptions, hasSize(retryCount));
```
--
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]