You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by we...@apache.org on 2017/05/24 23:52:19 UTC
[45/54] [abbrv] hive git commit: BitSet set() is not incorrectly used
in TxnUtils.createValidCompactTxnList() (Wei Zheng,
reviewed by Eugene Koifman)
BitSet set() is not incorrectly used in TxnUtils.createValidCompactTxnList() (Wei Zheng, reviewed by Eugene Koifman)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1c303933
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1c303933
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1c303933
Branch: refs/heads/hive-14535
Commit: 1c3039333ba71665e8b954fbee88188757bb4050
Parents: 1c891ad
Author: Wei Zheng <we...@apache.org>
Authored: Wed May 24 10:58:17 2017 -0700
Committer: Wei Zheng <we...@apache.org>
Committed: Wed May 24 10:58:17 2017 -0700
----------------------------------------------------------------------
.../apache/hadoop/hive/metastore/txn/TxnUtils.java | 2 +-
.../hive/metastore/txn/TestValidCompactorTxnList.java | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/1c303933/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
index 6e0070b..b2ced6b 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
@@ -99,7 +99,7 @@ public class TxnUtils {
}
highWater = minOpenTxn == Long.MAX_VALUE ? highWater : minOpenTxn - 1;
BitSet bitSet = new BitSet(exceptions.length);
- bitSet.set(0, bitSet.length()); // for ValidCompactorTxnList, everything in exceptions are aborted
+ bitSet.set(0, exceptions.length); // for ValidCompactorTxnList, everything in exceptions are aborted
return new ValidCompactorTxnList(exceptions, bitSet, highWater);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/1c303933/metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestValidCompactorTxnList.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestValidCompactorTxnList.java b/metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestValidCompactorTxnList.java
index ec653ed..91d6215 100644
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestValidCompactorTxnList.java
+++ b/metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestValidCompactorTxnList.java
@@ -29,7 +29,7 @@ public class TestValidCompactorTxnList {
@Test
public void minTxnHigh() {
BitSet bitSet = new BitSet(2);
- bitSet.set(0, bitSet.length());
+ bitSet.set(0, 2);
ValidTxnList txns = new ValidCompactorTxnList(new long[]{3, 4}, bitSet, 2);
ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
@@ -38,7 +38,7 @@ public class TestValidCompactorTxnList {
@Test
public void maxTxnLow() {
BitSet bitSet = new BitSet(2);
- bitSet.set(0, bitSet.length());
+ bitSet.set(0, 2);
ValidTxnList txns = new ValidCompactorTxnList(new long[]{13, 14}, bitSet, 12);
ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
Assert.assertEquals(ValidTxnList.RangeResponse.ALL, rsp);
@@ -61,7 +61,7 @@ public class TestValidCompactorTxnList {
@Test
public void exceptionsAllBelow() {
BitSet bitSet = new BitSet(2);
- bitSet.set(0, bitSet.length());
+ bitSet.set(0, 2);
ValidTxnList txns = new ValidCompactorTxnList(new long[]{3, 6}, bitSet, 3);
ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
@@ -70,7 +70,7 @@ public class TestValidCompactorTxnList {
@Test
public void exceptionsInMidst() {
BitSet bitSet = new BitSet(1);
- bitSet.set(0, bitSet.length());
+ bitSet.set(0, 1);
ValidTxnList txns = new ValidCompactorTxnList(new long[]{8}, bitSet, 7);
ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
@@ -78,7 +78,7 @@ public class TestValidCompactorTxnList {
@Test
public void exceptionsAbveHighWaterMark() {
BitSet bitSet = new BitSet(4);
- bitSet.set(0, bitSet.length());
+ bitSet.set(0, 4);
ValidTxnList txns = new ValidCompactorTxnList(new long[]{8, 11, 17, 29}, bitSet, 15);
Assert.assertArrayEquals("", new long[]{8, 11}, txns.getInvalidTransactions());
ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
@@ -90,9 +90,9 @@ public class TestValidCompactorTxnList {
@Test
public void writeToString() {
BitSet bitSet = new BitSet(4);
- bitSet.set(0, bitSet.length());
+ bitSet.set(0, 4);
ValidTxnList txns = new ValidCompactorTxnList(new long[]{7, 9, 10, Long.MAX_VALUE}, bitSet, 8);
- Assert.assertEquals("8:" + Long.MAX_VALUE + ":7:", txns.writeToString());
+ Assert.assertEquals("8:" + Long.MAX_VALUE + "::7", txns.writeToString());
txns = new ValidCompactorTxnList();
Assert.assertEquals(Long.toString(Long.MAX_VALUE) + ":" + Long.MAX_VALUE + "::", txns.writeToString());
txns = new ValidCompactorTxnList(new long[0], new BitSet(), 23);