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 master
Notice 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.archivedHFileSuffix() suffix. The archived
WAL will be moved to the global WAL archived directory with the
MasterRegionParams.archivedWalSuffix() suffix.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String(package private) final MasterRegionFlusherAndCompactor(package private) static final String(package private) static final Stringprivate static final org.slf4j.Loggerprivate final int(package private) final HRegionprivate static final intprivate final longprivate static final Stringprivate final Serverprivate final WALFactoryprivate MasterRegionWALRoller -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMasterRegion(Server server, HRegion region, WALFactory walFactory, MasterRegionFlusherAndCompactor flusherAndCompactor, MasterRegionWALRoller walRoller) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidLog the error and abort the master daemon immediately.private static HRegionbootstrap(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) voidclose(boolean abort) private voidcloseRegion(boolean abort) static MasterRegioncreate(MasterRegionParams params) private static WALcreateWAL(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 RegionInfoloadRegionInfo(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir) private static HRegionopen(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 voidreplayWALs(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) voidprivate voidprivate static voidtryMigrate(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tableDir, RegionInfo regionInfo, TableDescriptor oldTd, TableDescriptor newTd) voidupdate(UpdateMasterRegion action) Performs the mutation to the master region using UpdateMasterRegion update action.private voidupdate0(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:
-
server
-
walFactory
-
region
-
flusherAndCompactor
-
walRoller
-
maxRetriesForRegionUpdates
-
regionUpdateRetryPauseTime
-
-
Constructor Details
-
MasterRegion
private MasterRegion(Server server, HRegion region, WALFactory walFactory, MasterRegionFlusherAndCompactor flusherAndCompactor, MasterRegionWALRoller walRoller)
-
-
Method Details
-
closeRegion
-
shutdownWAL
-
update0
- Throws:
IOException
-
update
Performs the mutation to the master region using UpdateMasterRegion update action.- Parameters:
action- Update region action.- Throws:
IOException- IO error that causes active master to abort.
-
abortServer
Log the error and abort the master daemon immediately. Use this utility only when procedure state store update fails and the only way to recover is by terminating the active master so that new failed-over active master can resume the procedure execution.- Parameters:
e- IO error that causes active master to abort.- Throws:
IOException- IO error that causes active master to abort.
-
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
-