public static ValidTxnList createValidTxnListForCleaner(GetOpenTxnsResponse txns, long minOpenTxn, boolean isAbortCleanup) {
    long highWatermark = minOpenTxn - 1;
    long[] exceptions = new long[txns.getOpen_txnsSize()];
    BitSet abortedBits = BitSet.valueOf(txns.getAbortedBits());
    int i = 0;
    for (long txnId : txns.getOpen_txns()) {
      if (txnId > highWatermark) {
        break;
      }
      if (abortedBits.get(i)) {
        exceptions[i] = txnId;
      } else {
        if (isAbortCleanup) {
          exceptions[i] = txnId;
        } else {
          assert false : JavaUtils.txnIdToString(txnId) + " is open and <= hwm:" + highWatermark;
        }
      }
      ++i;
    }
    exceptions = Arrays.copyOf(exceptions, i);
    if (!isAbortCleanup) {
      BitSet bitSet = new BitSet(exceptions.length);
      bitSet.set(0, exceptions.length);
      //add ValidCleanerTxnList? - could be problematic for all the places that read it from
      // string as they'd have to know which object to instantiate
      return new ValidReadTxnList(exceptions, bitSet, highWatermark, Long.MAX_VALUE);
    } else {
      return new ValidReadTxnList(exceptions, abortedBits, highWatermark, Long.MAX_VALUE);
    }
  }
Returns a valid txn list for cleaner.
@param txns Response containing open txns list.
@param minOpenTxn Minimum open txn which is min open write txn on the table in the case of abort cleanup.
@param isAbortCleanup Whether the request is for abort cleanup.
@return a valid txn list
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java