TxUtils { public static long getPruneUpperBound(Transaction tx) { if (tx.getInvalids().length == 0 && tx.getInProgress().length == 0) { return tx.getReadPointer() - 1; } long maxInvalidTx = tx.getInvalids().length > 0 ? tx.getInvalids()[tx.getInvalids().length - 1] : Transaction.NO_TX_IN_PROGRESS; long firstInProgress = tx.getFirstInProgress(); return Math.min(maxInvalidTx, firstInProgress - 1); }  static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx); static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx, boolean readNonTxnData); static long getMaxVisibleTimestamp(Transaction tx); static Transaction createDummyTransaction(TransactionVisibilityState txVisibilityState); static long getFirstShortInProgress(Map<Long, TransactionManager.InProgressTx> inProgress); static long getTimestampForTTL(long cellTs); static boolean isPreExistingVersion(long version); static long getPruneUpperBound(Transaction tx); static long getInactiveTxBound(long timeMills, long txMaxLifetimeMillis); static long getTimestamp(long txId);  }
@Test public void testPruneUpperBound() { Transaction tx = new Transaction(100, 100, new long[] {10, 30}, new long[] {80, 90}, 80); Assert.assertEquals(30, TxUtils.getPruneUpperBound(tx)); tx = new Transaction(100, 100, new long[] {10, 95}, new long[] {80, 90}, 80); Assert.assertEquals(79, TxUtils.getPruneUpperBound(tx)); tx = new Transaction(100, 110, new long[] {10}, new long[] {}, Transaction.NO_TX_IN_PROGRESS); Assert.assertEquals(10, TxUtils.getPruneUpperBound(tx)); tx = new Transaction(100, 110, new long[] {}, new long[] {60}, 60); Assert.assertEquals(59, TxUtils.getPruneUpperBound(tx)); tx = new Transaction(100, 110, new long[] {}, new long[] {50}, 50); Assert.assertEquals(49, TxUtils.getPruneUpperBound(tx)); tx = new Transaction(100, 110, new long[] {}, new long[] {}, Transaction.NO_TX_IN_PROGRESS); Assert.assertEquals(99, TxUtils.getPruneUpperBound(tx)); }