HBASE-12550 ADDENDUM Make HRegion's api not change.

This commit is contained in:
Elliott Clark 2014-11-24 15:41:49 -08:00
parent 7893c013bc
commit e83082a888
5 changed files with 8 additions and 12 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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()));

View File

@ -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;

View File

@ -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());
}