private boolean isTtlUpdateEntryValid(StoreKey key, Offset indexSegmentStartOffset) throws StoreException {
      boolean valid = false;
      //  A TTL update entry is "valid" if the corresponding PUT is still alive
      // The PUT entry, if it exists, must be "before" this TTL update entry.
      FileSpan srcSearchSpan = new FileSpan(srcIndex.getStartOffset(), indexSegmentStartOffset);
      IndexValue srcValue = srcIndex.findKey(key, srcSearchSpan, EnumSet.of(PersistentIndex.IndexEntryType.PUT));
      if (srcValue == null) {
        // PUT is not in the source - therefore can't be in target. This TTL update can be cleaned up
        logger.trace("TTL update of {} in segment with start offset {} in {} is not valid the corresponding PUT entry "
            + "does not exist anymore", key, indexSegmentStartOffset, storeId);
      } else {
        // exists in source - now we need to check if it exists in the target
        IndexValue tgtValue = tgtIndex.findKey(key, null, EnumSet.of(PersistentIndex.IndexEntryType.PUT));
        if (tgtValue == null && isOffsetUnderCompaction(srcValue.getOffset())) {
          // exists in src but not in tgt. This can happen either because
          // 1. The FileSpan to which srcValue belongs is not under compaction (so there is no reason for tgt to have it)
          // 2. srcValue will be compacted in this cycle (because it has been determined that the PUT is not valid. Since
          // the PUT is going away in this cycle, it is safe to remove the TTL update also)
          logger.trace(
              "TTL update of {} in segment with start offset {} in {} is not valid because the corresponding PUT entry"
                  + " {} will be compacted in this cycle ({} are being compacted in this cycle)", key,
              indexSegmentStartOffset, storeId, srcValue,
              compactionLog.getCompactionDetails().getLogSegmentsUnderCompaction());
        } else {
          // PUT entry exists in both the src and tgt,
          // OR PUT entry exists in source and the offset of the source entry is not under compaction in this cycle
          // therefore this TTL update entry cannot be compacted
          valid = true;
        }
      }
      return valid;
    }
Determines whether a TTL update entry is valid. A TTL update entry is valid as long as the associated PUT record
is still present in the store (the validity of the PUT record does not matter - only its presence/absence does).
@param key the {@link StoreKey} being examined
@param indexSegmentStartOffset the start offset of the {@link IndexSegment} that the TTL update record is in
@return {@code true} if the TTL update entry is valid
@throws StoreException if there are problems reading the index
ambry-store/src/main/java/com/github/ambry/store/BlobStoreCompactor.java