Class MasterRegion
java.lang.Object
org.apache.hadoop.hbase.master.region.MasterRegion
A region that stores data in a separated directory, which can be used to store master local data.
FileSystem layout:
hbase | --<region dir> | --data | | | --/<ns>/<table>/<encoded-region-name> <---- The region data | | | --replay <---- The edits to replay | --WALs | --<master-server-name> <---- The WAL dir for active master | --<master-server-name>-dead <---- The WAL dir for dead masterNotice that, you can use different root file system and WAL file system. Then the above directory will be on two file systems, the root file system will have the data directory while the WAL filesystem will have the WALs directory. The archived HFile will be moved to the global HFile archived directory with the
MasterRegionParams.archivedWalSuffix()
suffix. The archived
WAL will be moved to the global WAL archived directory with the
MasterRegionParams.archivedHFileSuffix()
suffix.-
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
(package private) final MasterRegionFlusherAndCompactor
(package private) static final String
(package private) static final String
private static final org.slf4j.Logger
(package private) final HRegion
private static final int
private static final String
private final WALFactory
private MasterRegionWALRoller
-
Constructor Summary
ModifierConstructorDescriptionprivate
MasterRegion
(HRegion region, WALFactory walFactory, MasterRegionFlusherAndCompactor flusherAndCompactor, MasterRegionWALRoller walRoller) -
Method Summary
Modifier and TypeMethodDescriptionprivate static HRegion
bootstrap
(org.apache.hadoop.conf.Configuration conf, TableDescriptor td, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, WALFactory walFactory, MasterRegionWALRoller walRoller, String serverName, boolean touchInitializingFlag) void
close
(boolean abort) private void
closeRegion
(boolean abort) static MasterRegion
create
(MasterRegionParams params) private static WAL
createWAL
(WALFactory walFactory, MasterRegionWALRoller walRoller, String serverName, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, RegionInfo regionInfo) flush
(boolean force) getRegionScanner
(Scan scan) getScanner
(Scan scan) private static RegionInfo
loadRegionInfo
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir) private static HRegion
open
(org.apache.hadoop.conf.Configuration conf, TableDescriptor td, RegionInfo regionInfo, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, WALFactory walFactory, MasterRegionWALRoller walRoller, String serverName) private static void
replayWALs
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.Path walsDir, RegionInfo regionInfo, String serverName, org.apache.hadoop.fs.Path replayEditsDir) void
private void
private static void
tryMigrate
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir, RegionInfo regionInfo, TableDescriptor oldTd, TableDescriptor newTd) void
update
(UpdateMasterRegion action) void
-
Field Details
-
LOG
-
REPLAY_EDITS_DIR
- See Also:
-
DEAD_WAL_DIR_SUFFIX
- See Also:
-
INITIALIZING_FLAG
- See Also:
-
INITIALIZED_FLAG
- See Also:
-
REGION_ID
- See Also:
-
walFactory
-
region
-
flusherAndCompactor
-
walRoller
-
-
Constructor Details
-
MasterRegion
private MasterRegion(HRegion region, WALFactory walFactory, MasterRegionFlusherAndCompactor flusherAndCompactor, MasterRegionWALRoller walRoller)
-
-
Method Details
-
closeRegion
-
shutdownWAL
-
update
- Throws:
IOException
-
get
- Throws:
IOException
-
getScanner
- Throws:
IOException
-
getRegionScanner
- Throws:
IOException
-
flush
- Throws:
IOException
-
requestRollAll
-
waitUntilWalRollFinished
- Throws:
InterruptedException
-
close
-
createWAL
private static WAL createWAL(WALFactory walFactory, MasterRegionWALRoller walRoller, String serverName, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, RegionInfo regionInfo) throws IOException - Throws:
IOException
-
bootstrap
private static HRegion bootstrap(org.apache.hadoop.conf.Configuration conf, TableDescriptor td, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, WALFactory walFactory, MasterRegionWALRoller walRoller, String serverName, boolean touchInitializingFlag) throws IOException - Throws:
IOException
-
loadRegionInfo
private static RegionInfo loadRegionInfo(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir) throws IOException - Throws:
IOException
-
open
private static HRegion open(org.apache.hadoop.conf.Configuration conf, TableDescriptor td, RegionInfo regionInfo, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, WALFactory walFactory, MasterRegionWALRoller walRoller, String serverName) throws IOException - Throws:
IOException
-
replayWALs
private static void replayWALs(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem walFs, org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.Path walsDir, RegionInfo regionInfo, String serverName, org.apache.hadoop.fs.Path replayEditsDir) throws IOException - Throws:
IOException
-
tryMigrate
private static void tryMigrate(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir, RegionInfo regionInfo, TableDescriptor oldTd, TableDescriptor newTd) throws IOException - Throws:
IOException
-
create
- Throws:
IOException
-