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

checkAvailableDiskSpace doesn't update expectedWriteSize when reducing thread scope

    Details

      Description

      If a compaction occurs that looks like it'll take up more space than remaining disk available, the compaction manager attempts to reduce the scope of the compaction by calling reduceScopeForLimitedSpace() repeatedly.

      Unfortunately, the while loop passes the estimatedWriteSize calculated from the original call to hasAvailableDiskSpace, so the comparisons that are done will always be against the size of the original compaction, rather than the reduced scope one.

      Full method below:

          protected void checkAvailableDiskSpace(long estimatedSSTables, long expectedWriteSize)
          {
              if(!cfs.isCompactionDiskSpaceCheckEnabled() && compactionType == OperationType.COMPACTION)
              {
                  logger.info("Compaction space check is disabled");
                  return;
              }
      
              while (!getDirectories().hasAvailableDiskSpace(estimatedSSTables, expectedWriteSize))
              {
                  if (!reduceScopeForLimitedSpace())
                      throw new RuntimeException(String.format("Not enough space for compaction, estimated sstables = %d, expected write size = %d", estimatedSSTables, expectedWriteSize));
      
            
              }
          }
      

      I'm proposing to recalculate the estimatedSSTables and expectedWriteSize after each iteration of reduceScopeForLimitedSpace.

        Attachments

        1. trunk-12979.patch
          6 kB
          Jon Haddad
        2. 3.0.patch
          6 kB
          Jon Haddad
        3. 2.2.patch
          6 kB
          Jon Haddad

          Activity

            People

            • Assignee:
              rustyrazorblade Jon Haddad
              Reporter:
              rustyrazorblade Jon Haddad
              Reviewer:
              Nate McCall
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: