Repository: hbase Updated Branches: refs/heads/branch-1 8272c84f6 -> 032f5574b
HBASE-14962 TestSplitWalDataLoss fails on all branches Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/032f5574 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/032f5574 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/032f5574 Branch: refs/heads/branch-1 Commit: 032f5574b01ea1eb87453be1231570b70a34e15d Parents: 8272c84 Author: stack <st...@apache.org> Authored: Sat Jan 16 15:53:07 2016 -0800 Committer: stack <st...@apache.org> Committed: Sat Jan 16 15:53:33 2016 -0800 ---------------------------------------------------------------------- .../hadoop/hbase/regionserver/TestSplitWalDataLoss.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/032f5574/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java index 102e7bc..962412f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.spy; import java.io.IOException; import java.util.Collection; +import java.util.Map; import org.apache.commons.lang.mutable.MutableBoolean; import org.apache.commons.logging.Log; @@ -117,7 +118,15 @@ public class TestSplitWalDataLoss { }).when(spiedRegion).internalFlushCacheAndCommit(Matchers.<WAL> any(), Matchers.<MonitoredTask> any(), Matchers.<PrepareFlushResult> any(), Matchers.<Collection<Store>> any()); - rs.onlineRegions.put(rs.onlineRegions.keySet().iterator().next(), spiedRegion); + // Find region key; don't pick up key for hbase:meta by mistake. + String key = null; + for (Map.Entry<String, Region> entry: rs.onlineRegions.entrySet()) { + if (entry.getValue().getRegionInfo().getTable().equals(this.tableName)) { + key = entry.getKey(); + break; + } + } + rs.onlineRegions.put(key, spiedRegion); Connection conn = testUtil.getConnection(); try (Table table = conn.getTable(tableName)) {