[
https://issues.apache.org/jira/browse/IGNITE-22088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor updated IGNITE-22088:
--------------------------
Description:
*Details:*
IgniteClient do not run retry with set retryPolicy on transaction lock. The
default retry policy also doesn't work. The debugging also shows that no any
code inside `RetryReadPolicy` is not used during transaction lock exception.
*Steps to reproduce:*
Run the next code:
{code:java}
AtomicInteger retriesCount = new AtomicInteger(0);
RetryReadPolicy retry = new RetryReadPolicy() {
@Override
public boolean shouldRetry(RetryPolicyContext context) {
System.out.println("CHECK IF RETRY SHOULD HAPPEN");
retriesCount.addAndGet(1);
return super.shouldRetry(context);
}
};
try (IgniteClient igniteClient1 =
IgniteClient.builder().retryPolicy(retry).addresses("localhost:10800").build();
IgniteClient igniteClient2 =
IgniteClient.builder().retryPolicy(retry).addresses("localhost:10800").build())
{
igniteClient1.sql().execute(null, "CREATE TABLE teachers(id INTEGER PRIMARY
KEY, name VARCHAR(200))");
Transaction tr1 = igniteClient1.transactions().begin();
Transaction tr2 = igniteClient2.transactions().begin();
igniteClient1.sql().execute(tr1, "INSERT INTO TEACHERS (id, name) VALUES ("
+ 3 + ", '" + "Pavel" + "')");
SqlException exception = assertThrows(SqlException.class, () ->
igniteClient2.sql().execute(tr2, "SELECT * FROM teachers"));
assertTrue(exception.getMessage().contains("Failed to acquire a lock due to
a possible deadlock "));
}
assertEquals(16, retriesCount.get()); {code}
*Expected:*
Executed without errors.
*Actual:*
Fails on the last step expected 16 retries, actual 0.
was:
*Details:*
IgniteClient do not run retry with set retryPolicy on transaction lock. The
default retry policy also doesn't work. The debugging also shows that no any
code inside `RetryReadPolicy` is not used during transaction lock exception.
*Steps to reproduce:*
Run the next code:
{code:java}
AtomicInteger retriesCount = new AtomicInteger(0);
RetryReadPolicy retry = new RetryReadPolicy() {
@Override
public boolean shouldRetry(RetryPolicyContext context) {
System.out.println("CHECK IF RETRY SHOULD HAPPEN");
retriesCount.addAndGet(1);
return super.shouldRetry(context);
}
};
try (IgniteClient igniteClient1 =
IgniteClient.builder().retryPolicy(retry).addresses("localhost:10800").build();
IgniteClient igniteClient2 =
IgniteClient.builder().addresses("localhost:10800").build()) {
igniteClient1.sql().execute(null, "CREATE TABLE teachers(id INTEGER PRIMARY
KEY, name VARCHAR(200))");
Transaction tr1 = igniteClient1.transactions().begin();
Transaction tr2 = igniteClient2.transactions().begin();
igniteClient1.sql().execute(tr1, "INSERT INTO TEACHERS (id, name) VALUES ("
+ 3 + ", '" + "Pavel" + "')");
SqlException exception = assertThrows(SqlException.class, () ->
igniteClient2.sql().execute(tr2, "SELECT * FROM teachers"));
assertTrue(exception.getMessage().contains("Failed to acquire a lock due to
a possible deadlock "));
}
assertEquals(16, retriesCount.get()); {code}
*Expected:*
Executed without errors.
*Actual:*
Fails on the last step expected 16 retries, actual 0.
> retryPolicy of IgniteClient doesn't work on transaction fail
> ------------------------------------------------------------
>
> Key: IGNITE-22088
> URL: https://issues.apache.org/jira/browse/IGNITE-22088
> Project: Ignite
> Issue Type: Bug
> Components: clients, thin client
> Affects Versions: 3.0.0-beta1
> Reporter: Igor
> Priority: Major
> Labels: ignite-3
>
> *Details:*
> IgniteClient do not run retry with set retryPolicy on transaction lock. The
> default retry policy also doesn't work. The debugging also shows that no any
> code inside `RetryReadPolicy` is not used during transaction lock exception.
> *Steps to reproduce:*
> Run the next code:
> {code:java}
> AtomicInteger retriesCount = new AtomicInteger(0);
> RetryReadPolicy retry = new RetryReadPolicy() {
> @Override
> public boolean shouldRetry(RetryPolicyContext context) {
> System.out.println("CHECK IF RETRY SHOULD HAPPEN");
> retriesCount.addAndGet(1);
> return super.shouldRetry(context);
> }
> };
> try (IgniteClient igniteClient1 =
> IgniteClient.builder().retryPolicy(retry).addresses("localhost:10800").build();
> IgniteClient igniteClient2 =
> IgniteClient.builder().retryPolicy(retry).addresses("localhost:10800").build())
> {
> igniteClient1.sql().execute(null, "CREATE TABLE teachers(id INTEGER
> PRIMARY KEY, name VARCHAR(200))");
> Transaction tr1 = igniteClient1.transactions().begin();
> Transaction tr2 = igniteClient2.transactions().begin();
> igniteClient1.sql().execute(tr1, "INSERT INTO TEACHERS (id, name) VALUES
> (" + 3 + ", '" + "Pavel" + "')");
> SqlException exception = assertThrows(SqlException.class, () ->
> igniteClient2.sql().execute(tr2, "SELECT * FROM teachers"));
> assertTrue(exception.getMessage().contains("Failed to acquire a lock due
> to a possible deadlock "));
> }
> assertEquals(16, retriesCount.get()); {code}
> *Expected:*
> Executed without errors.
> *Actual:*
> Fails on the last step expected 16 retries, actual 0.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)