private void updateStateForMessages(List<MessageInfo> messageEntries) throws StoreException {
    ListIterator<MessageInfo> messageEntriesIterator = messageEntries.listIterator();
    while (messageEntriesIterator.hasNext()) {
      MessageInfo messageInfo = messageEntriesIterator.next();
      // If the message is already deleted and DELETE is the final state of the blob, then we don't have
      // to update the state for this message.
      if (isDeleteFinalStateOfBlob && messageInfo.isDeleted()) {
        continue;
      }
      IndexValue indexValue = findKey(messageInfo.getStoreKey(), null,
          EnumSet.of(IndexEntryType.TTL_UPDATE, IndexEntryType.DELETE, IndexEntryType.UNDELETE));
      if (indexValue != null) {
        messageInfo = new MessageInfo(messageInfo.getStoreKey(), indexValue.getSize(), indexValue.isDelete(),
            indexValue.isTtlUpdate(), indexValue.isUndelete(), indexValue.getExpiresAtMs(), null,
            indexValue.getAccountId(), indexValue.getContainerId(), indexValue.getOperationTimeInMs(),
            indexValue.getLifeVersion());
        messageEntriesIterator.set(messageInfo);
      }
    }
  }
Updates the messages with their updated state (ttl update/delete/undelete). This method can be used when
the messages have been retrieved from an old index segment and needs to be updated with the state from the new
index segment
@param messageEntries The message entries that may need to be updated.
ambry-store/src/main/java/com/github/ambry/store/PersistentIndex.java