private long getInvalidationTime(long numSegmentsToWritePutRecordsTo) {
    // set some invalidation time that is far enough into the future that it cannot be affected by segment rollovers
    long possiblePutRecords = numSegmentsToWritePutRecordsTo * state.log.getSegmentCapacity() / PUT_RECORD_SIZE + 1;
    long possibleIndexSegments = numSegmentsToWritePutRecordsTo + possiblePutRecords / state.getMaxInMemElements() + 1;
    long invalidationTimeMs = state.time.milliseconds() + possibleIndexSegments * DELAY_BETWEEN_LAST_MODIFIED_TIMES_MS;
    // round up to the next second
    return (invalidationTimeMs / Time.MsPerSec + 1) * Time.MsPerSec;
  }
Calculates a safe time for invalidation (i.e. records should expire at a time later than the last PUT record).
@param numSegmentsToWritePutRecordsTo the number of log segments that will be filled with PUT records.
@return a safe time for invalidation (i.e. records should expire at a time later than the last PUT record).
ambry-store/src/test/java/com/github/ambry/store/BlobStoreCompactorTest.java