@VisibleForTesting
  @SuppressWarnings("WeakerAccess") // used in upsource for some reason
  public boolean makesSenseToCompact() {
    if (!isCompactionSupported()) return false;

    final long fileSize = myValueStorage.getSize();
    final int megabyte = 1024 * 1024;

    // the file is longer than 5MB, and (more than 50% of keys are garbage or approximate benefit larger than 100M)
    if (fileSize > 5 * megabyte) {
      int liveKeys = (int)(myLiveAndGarbageKeysCounter / LIVE_KEY_MASK);
      int deadKeys = (int)(myLiveAndGarbageKeysCounter & DEAD_KEY_NUMBER_MASK);

      if (fileSize > 50 * megabyte && forceNewCompact()) return true;
      if (deadKeys < 50) return false;

      final long benefitSize = Math.max(100 * megabyte, fileSize / 4);
      final long avgValueSize = fileSize / (liveKeys + deadKeys);

      return deadKeys > liveKeys ||
             avgValueSize * deadKeys > benefitSize ||
             myReadCompactionGarbageSize > fileSize / 2;
    }
    return false;
  }
@VisibleForTesting
  @SuppressWarnings("WeakerAccess") // used in upsource for some reason
  public boolean makesSenseToCompact()