[
https://issues.apache.org/jira/browse/IGNITE-27091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Pereslegin updated IGNITE-27091:
--------------------------------------
Description:
Currently, if the channel is closed (for example, if cluster node was
restarted), the transaction rollback fails with the error "Channel is closed".
It seems like an exception shouldn't be thrown in this case. For example, this
wouldn't be expected by a user which uses a finally block to rollback a
transaction.
Reproducer (for RetryPolicyTest)
{code:java}
@Test
public void testTransactionRollbackOnClosedChannel() {
initServer(reqId -> reqId % 4 == 0);
var plc = new TestRetryPolicy();
try (var client = getClient(plc)) {
RecordView<Tuple> recView = client.tables().table("t").recordView();
Transaction tx = client.transactions().begin();
try {
ClientLazyTransaction.ensureStarted(tx, ((TcpIgniteClient)
client).channel()).get1().join();
assertThrows(IgniteException.class, () -> recView.get(tx,
Tuple.create().set("id", 1)));
} finally {
tx.rollback(); // fails with "Channel is closed"
}
}
}
{code}
was:
Currently, if the channel is closed (for example, if the node was restarted),
the transaction rollback fails with the error "Channel is closed".
It seems like an exception shouldn't be thrown in this case. For example, this
wouldn't be expected by a user which uses a finally block to rollback a
transaction.
Reproducer (for RetryPolicyTest)
{code:java}
@Test
public void testTransactionRollbackOnClosedChannel() {
initServer(reqId -> reqId % 4 == 0);
var plc = new TestRetryPolicy();
try (var client = getClient(plc)) {
RecordView<Tuple> recView = client.tables().table("t").recordView();
Transaction tx = client.transactions().begin();
try {
ClientLazyTransaction.ensureStarted(tx, ((TcpIgniteClient)
client).channel()).get1().join();
assertThrows(IgniteException.class, () -> recView.get(tx,
Tuple.create().set("id", 1)));
} finally {
tx.rollback(); // fails with "Channel is closed"
}
}
}
{code}
> Java thin. Rollback of client transaction on a closed channel should not
> throw exceptions
> -----------------------------------------------------------------------------------------
>
> Key: IGNITE-27091
> URL: https://issues.apache.org/jira/browse/IGNITE-27091
> Project: Ignite
> Issue Type: Improvement
> Components: thin clients ai3
> Affects Versions: 3.1
> Reporter: Pavel Pereslegin
> Priority: Major
> Labels: ignite-3
>
> Currently, if the channel is closed (for example, if cluster node was
> restarted), the transaction rollback fails with the error "Channel is closed".
> It seems like an exception shouldn't be thrown in this case. For example,
> this wouldn't be expected by a user which uses a finally block to rollback a
> transaction.
> Reproducer (for RetryPolicyTest)
> {code:java}
> @Test
> public void testTransactionRollbackOnClosedChannel() {
> initServer(reqId -> reqId % 4 == 0);
> var plc = new TestRetryPolicy();
> try (var client = getClient(plc)) {
> RecordView<Tuple> recView = client.tables().table("t").recordView();
> Transaction tx = client.transactions().begin();
> try {
> ClientLazyTransaction.ensureStarted(tx, ((TcpIgniteClient)
> client).channel()).get1().join();
> assertThrows(IgniteException.class, () -> recView.get(tx,
> Tuple.create().set("id", 1)));
> } finally {
> tx.rollback(); // fails with "Channel is closed"
> }
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)