Pavel Pereslegin created IGNITE-23778:
-----------------------------------------
Summary: Sql. Synchronous cancellation of a locally initiated
request
Key: IGNITE-23778
URL: https://issues.apache.org/jira/browse/IGNITE-23778
Project: Ignite
Issue Type: Improvement
Components: sql
Reporter: Pavel Pereslegin
If query has opened cursor call to CancelHandle.cancel() will wait until
something will be done with cursor (from the user side).
For example:
{code:java}
@Test
public void simpleCancelTest() {
IgniteSql sql = igniteSql();
CancelHandle cancelHandle = CancelHandle.create();
CancellationToken token = cancelHandle.token();
Statement statement = sql.statementBuilder()
.query("SELECT * FROM system_range(0, 10000000000)")
.build();
try (ResultSet<SqlRow> rs = sql.execute(null, token, statement)) {
// PROBLEM
// We hang here until the user does something with the cursor.
cancelHandle.cancel();
try {
while (rs.hasNext()) {
rs.next();
}
fail("Exception was not thrown");
} catch (SqlException expected) {
assertEquals(Sql.EXECUTION_CANCELLED_ERR, expected.code());
}
}
}
{code}
If you change {{cancelHandle.cancel();}} to {{cancelHandle.cancelAsync();}},
the test will pass.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)