Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-22088

retryPolicy of IgniteClient doesn't work on transaction fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 3.0.0-beta1
    • None
    • clients, thin client
    • Docs Required, Release Notes Required

    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:

      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()); 

      Expected:
      Executed without errors.

      Actual:
      Fails on the last step expected 16 retries, actual 0.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lunigorn Igor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: