void dropSegment(LogSegmentName segmentName, boolean decreaseUsedSegmentCount) throws StoreException {
    LogSegment segment = segmentsByName.get(segmentName);
    if (segment == null || segment == activeSegment) {
      throw new IllegalArgumentException("Segment does not exist or is the active segment: " + segmentName);
    }
    segmentsByName.remove(segmentName);
    free(segment, !decreaseUsedSegmentCount);
    if (decreaseUsedSegmentCount) {
      remainingUnallocatedSegments.incrementAndGet();
    }
  }
Drops an existing {@link LogSegment} instance from the log.
@param segmentName the {@link LogSegment} instance to drop.
@param decreaseUsedSegmentCount {@code true} if the number of segments used has to be decremented, {@code false}
                                            otherwise.
@throws IllegalArgumentException if {@code segmentName} is not a part of the log.
@throws StoreException if there is any store exception while cleaning up the log segment.
ambry-store/src/main/java/com/github/ambry/store/Log.java