Skip to content

Commit b4349cb

Browse files
IGNITE-28709 SQL Calcite: Fix flaky CancelTest.testNotOriginatorNodeStop (#13168)
1 parent 8fc3e09 commit b4349cb

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,10 @@ private void onMessage(UUID nodeId, final QueryStartRequest msg) {
980980
U.error(log, "Error occurred during send error message: " + X.getFullStackTrace(e));
981981
}
982982
finally {
983-
qryReg.query(msg.queryId()).onError(ex);
983+
Query<?> qry = qryReg.query(msg.queryId());
984+
985+
if (qry != null)
986+
qry.onError(ex);
984987
}
985988
}
986989
}

modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ public void testNotOriginatorNodeStop() throws Exception {
142142
// Sometimes remote node during stopping can send error to originator node and this error processed before
143143
// node left event, in this case exception stack will looks like:
144144
// IgniteSQLException -> RemoteException -> exception on remote node during node stop.
145+
// Also, remote node can be stopped during processing of QueryStartRequest, in this case QueryCloseRequest
146+
// with an error will be sent to originator node, this causes query cancelation with an IgniteSQLException.
145147
if (!X.hasCause(ex, "node left", ClusterTopologyCheckedException.class) &&
146-
!X.hasCause(ex, RemoteException.class)) {
148+
!X.hasCause(ex, RemoteException.class) &&
149+
!X.hasCause(ex, "The query was cancelled while executing", IgniteSQLException.class)
150+
) {
147151
log.error("Unexpected exception", ex);
148152

149153
fail("Unexpected exception: " + ex);

0 commit comments

Comments
 (0)