diff --git storage-api/src/java/org/apache/hadoop/hive/common/ValidReadTxnList.java storage-api/src/java/org/apache/hadoop/hive/common/ValidReadTxnList.java index b8ff03f9c4..856cc3256f 100644 --- storage-api/src/java/org/apache/hadoop/hive/common/ValidReadTxnList.java +++ storage-api/src/java/org/apache/hadoop/hive/common/ValidReadTxnList.java @@ -26,7 +26,7 @@ * This class will view a transaction as valid only if it is committed. Both open and aborted * transactions will be seen as invalid. */ -public class ValidReadTxnList implements ValidTxnList { +public final class ValidReadTxnList implements ValidTxnList { protected long[] exceptions; protected BitSet abortedBits; // BitSet for flagging aborted transactions. Bit is true if aborted, false if open @@ -62,33 +62,6 @@ public boolean isTxnValid(long txnid) { return Arrays.binarySearch(exceptions, txnid) < 0; } - @Override - public RangeResponse isTxnRangeValid(long minTxnId, long maxTxnId) { - // check the easy cases first - if (minTxnId > highWatermark) { - return RangeResponse.NONE; - } else if (exceptions.length > 0 && exceptions[0] > maxTxnId) { - return RangeResponse.ALL; - } - - // since the exceptions and the range in question overlap, count the - // exceptions in the range - long count = Math.max(0, maxTxnId - highWatermark); - for(long txn: exceptions) { - if (minTxnId <= txn && txn <= maxTxnId) { - count += 1; - } - } - - if (count == 0) { - return RangeResponse.ALL; - } else if (count == (maxTxnId - minTxnId + 1)) { - return RangeResponse.NONE; - } else { - return RangeResponse.SOME; - } - } - @Override public String toString() { return writeToString(); @@ -191,34 +164,5 @@ public boolean isTxnAborted(long txnid) { int index = Arrays.binarySearch(exceptions, txnid); return index >= 0 && abortedBits.get(index); } - - @Override - public RangeResponse isTxnRangeAborted(long minTxnId, long maxTxnId) { - // check the easy cases first - if (highWatermark < minTxnId) { - return RangeResponse.NONE; - } - - int count = 0; // number of aborted txns found in exceptions - - // traverse the aborted txns list, starting at first aborted txn index - for (int i = abortedBits.nextSetBit(0); i >= 0; i = abortedBits.nextSetBit(i + 1)) { - long abortedTxnId = exceptions[i]; - if (abortedTxnId > maxTxnId) { // we've already gone beyond the specified range - break; - } - if (abortedTxnId >= minTxnId && abortedTxnId <= maxTxnId) { - count++; - } - } - - if (count == 0) { - return RangeResponse.NONE; - } else if (count == (maxTxnId - minTxnId + 1)) { - return RangeResponse.ALL; - } else { - return RangeResponse.SOME; - } - } } diff --git storage-api/src/java/org/apache/hadoop/hive/common/ValidTxnList.java storage-api/src/java/org/apache/hadoop/hive/common/ValidTxnList.java index d4c3b09730..919a75ede0 100644 --- storage-api/src/java/org/apache/hadoop/hive/common/ValidTxnList.java +++ storage-api/src/java/org/apache/hadoop/hive/common/ValidTxnList.java @@ -46,16 +46,6 @@ */ public boolean isTxnValid(long txnid); - /** - * Find out if a range of transaction ids are valid. Note that valid may have different meanings - * for different implementations, as some will only want to see committed transactions and some - * both committed and aborted. - * @param minTxnId minimum txnid to look for, inclusive - * @param maxTxnId maximum txnid to look for, inclusive - * @return Indicate whether none, some, or all of these transactions are valid. - */ - public RangeResponse isTxnRangeValid(long minTxnId, long maxTxnId); - /** * Write this validTxnList into a string. This should produce a string that * can be used by {@link #readFromString(String)} to populate a validTxnsList. @@ -90,14 +80,6 @@ */ public boolean isTxnAborted(long txnid); - /** - * Find out if a range of transaction ids are aborted. - * @param minTxnId minimum txnid to look for, inclusive - * @param maxTxnId maximum txnid to look for, inclusive - * @return Indicate whether none, some, or all of these transactions are aborted. - */ - public RangeResponse isTxnRangeAborted(long minTxnId, long maxTxnId); - /** * Returns smallest Open transaction in this set, {@code null} if there is none. */