Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-19991

Unit test org.apache.cassandra.tools.TopPartitionsTest#testServiceTopPartitionsSingleTable is still flaky

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.0.15, 4.1.8, 5.0.2, 5.1
    • Test/unit
    • None

    Description

      org.apache.cassandra.tools.TopPartitionsTest#testServiceTopPartitionsSingleTable fails randomly and quite frequently on CI:

      https://ci-cassandra.apache.org/view/Cassandra%204.1/job/Cassandra-4.1/521/testReport/org.apache.cassandra.tools/TopPartitionsTest/

      https://ci-cassandra.apache.org/job/Cassandra-4.0/726/testReport/junit/org.apache.cassandra.tools/TopPartitionsTest/

      Based on the source code - the most probably cause of this flakiness is async logic when we submit a sample here: org.apache.cassandra.metrics.Sampler#addSample - the submitted task can executed after we invoke finishLocalSampling(..) within the test.

      The failure can be emulated by adding a synthetic delay to this logic like this:

      public void addSample(final T item, final int value)
      {
          if (isEnabled())
              samplerExecutor.submit(() -> {
                  // ------ synthetic delay -----
                  try
                  {
                      Thread.sleep(10000);
                  } catch (Exception e) {};
                  // ----------------------- -----
                  insert(item, value);
              });
      }

      Attachments

        1. image-2024-10-09-22-29-03-576.png
          616 kB
          Dmitry Konstantinov
        2. image-2024-10-09-22-28-39-629.png
          618 kB
          Dmitry Konstantinov

        Issue Links

          Activity

            People

              dnk Dmitry Konstantinov
              dnk Dmitry Konstantinov
              Dmitry Konstantinov
              Berenguer Blasi, Stefan Miklosovic
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m