From e83082a88816684714d8a563967046e582f9b8c7 Mon Sep 17 00:00:00 2001 From: Elliott Clark Date: Mon, 24 Nov 2014 15:41:49 -0800 Subject: [PATCH] HBASE-12550 ADDENDUM Make HRegion's api not change. --- .../java/org/apache/hadoop/hbase/regionserver/HRegion.java | 6 +++--- .../apache/hadoop/hbase/regionserver/HRegionFileSystem.java | 4 +--- .../apache/hadoop/hbase/regionserver/SplitTransaction.java | 6 ++---- .../hadoop/hbase/regionserver/TestSplitTransaction.java | 2 +- .../org/apache/hadoop/hbase/regionserver/TestStoreFile.java | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 147b1ccaeea..4a4d0044192 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -4805,12 +4805,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { // /** * Create a daughter region from given a temp directory with the region data. * @param hri Spec. for daughter region to open. - * @param expectedReferenceFileCount * @throws IOException */ - HRegion createDaughterRegionFromSplits(final HRegionInfo hri, int expectedReferenceFileCount) throws IOException { + HRegion createDaughterRegionFromSplits(final HRegionInfo hri) throws IOException { // Move the files from the temporary .splits to the final /table/region directory - fs.commitDaughterRegion(hri, expectedReferenceFileCount); + fs.commitDaughterRegion(hri); // Create the daughter HRegion instance HRegion r = HRegion.newHRegion(this.fs.getTableDir(), this.getWAL(), fs.getFileSystem(), @@ -4834,6 +4833,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { // r.readRequestsCount.set(this.getReadRequestsCount() + region_b.getReadRequestsCount()); r.writeRequestsCount.set(this.getWriteRequestsCount() + + region_b.getWriteRequestsCount()); this.fs.commitMergedRegion(mergedRegionInfo); return r; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java index 49649a1e14c..4f728aee1f2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java @@ -518,11 +518,9 @@ public class HRegionFileSystem { * to the proper location in the filesystem. * * @param regionInfo daughter {@link org.apache.hadoop.hbase.HRegionInfo} - * @param expectedReferenceFileCount number of expected reference files to have created and to - * move into the new location. * @throws IOException */ - Path commitDaughterRegion(final HRegionInfo regionInfo, int expectedReferenceFileCount) + Path commitDaughterRegion(final HRegionInfo regionInfo) throws IOException { Path regionDir = new Path(this.tableDir, regionInfo.getEncodedName()); Path daughterTmpDir = this.getSplitsDir(regionInfo); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java index 74d0e7a61e6..388cb6a016f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransaction.java @@ -392,8 +392,7 @@ public class SplitTransaction { this.journal.add(new JournalEntry(JournalEntryType.STARTED_REGION_A_CREATION)); assertReferenceFileCount(expectedReferences.getFirst(), this.parent.getRegionFileSystem().getSplitsDir(this.hri_a)); - HRegion a = this.parent.createDaughterRegionFromSplits(this.hri_a, - expectedReferences.getFirst()); + HRegion a = this.parent.createDaughterRegionFromSplits(this.hri_a); assertReferenceFileCount(expectedReferences.getFirst(), new Path(this.parent.getRegionFileSystem().getTableDir(), this.hri_a.getEncodedName())); @@ -401,8 +400,7 @@ public class SplitTransaction { this.journal.add(new JournalEntry(JournalEntryType.STARTED_REGION_B_CREATION)); assertReferenceFileCount(expectedReferences.getSecond(), this.parent.getRegionFileSystem().getSplitsDir(this.hri_b)); - HRegion b = this.parent.createDaughterRegionFromSplits(this.hri_b, - expectedReferences.getSecond()); + HRegion b = this.parent.createDaughterRegionFromSplits(this.hri_b); assertReferenceFileCount(expectedReferences.getSecond(), new Path(this.parent.getRegionFileSystem().getTableDir(), this.hri_b.getEncodedName())); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java index 2cbedd319a2..66375e97dbc 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransaction.java @@ -297,7 +297,7 @@ public class TestSplitTransaction { SplitTransaction spiedUponSt = spy(st); doNothing().when(spiedUponSt).assertReferenceFileCount(anyInt(), eq(parent.getRegionFileSystem().getSplitsDir(st.getFirstDaughter()))); - when(spiedRegion.createDaughterRegionFromSplits(spiedUponSt.getSecondDaughter(), 1)). + when(spiedRegion.createDaughterRegionFromSplits(spiedUponSt.getSecondDaughter())). thenThrow(new MockedFailedDaughterCreation()); // Run the execute. Look at what it returns. boolean expectedException = false; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java index fe70fd87f43..95f66964fdc 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java @@ -959,7 +959,7 @@ public class TestStoreFile extends HBaseTestCase { if (null == path) { return null; } - Path regionDir = regionFs.commitDaughterRegion(hri, 1); + Path regionDir = regionFs.commitDaughterRegion(hri); return new Path(new Path(regionDir, family), path.getName()); }