Uploaded image for project: 'Kudu'
  1. Kudu
  2. KUDU-406

[java client] TestKuduSession is flaky when testing for PleaseThrottleException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • M4
    • n/a
    • client
    • None

    Description

      From Adar:

      This code:
      
          // Test sending edits too fast
          session.setFlushMode(KuduSession.FlushMode.AUTO_FLUSH_BACKGROUND);
          session.setMutationBufferSpace(10);
      
          // The buffer has a capacity of 10, we insert 21 rows, meaning we fill the first one,
          // force flush, fill a second one before the first one could come back,
          // and the 21st row will be sent back.
          boolean gotException = false;
          for (int i = 50; i < 71; i++) {
            try {
              session.apply(createInsert(i));
            } catch (PleaseThrottleException ex) {
              gotException = true;
              assertEquals(70, i);
              // Wait for the buffer to clear
              ex.getDeferred().join(DEFAULT_SLEEP);
              session.apply(ex.getFailedRpc());
              session.flush().join(DEFAULT_SLEEP);
            }
          }
          assertTrue(gotException); <--
          assertEquals(21, countInRange(50, 71));
      
      
      If the client is running particularly slowly, isn't it possible for the background flush to finish before the 11th (or possibly 21st) row is inserted? Then we won't throw a PleaseThrottleException.
      

      It's indeed possible and it happened once. We need a way to block the background flushing from happening, maybe through mocking.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jdcryans Jean-Daniel Cryans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: