Package org.apache.hadoop.hbase.master
Class MasterWalManager
java.lang.Object
org.apache.hadoop.hbase.master.MasterWalManager
This class abstracts a bunch of operations the HMaster needs when splitting log files e.g.
finding log files, dirs etc.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configuration
private final org.apache.hadoop.fs.FileSystem
private boolean
private static final org.slf4j.Logger
(package private) static final org.apache.hadoop.fs.PathFilter
Filter *in* WAL files that are for the hbase:meta Region.private final MetricsMasterFileSystem
static final org.apache.hadoop.fs.PathFilter
Filter *out* WAL files that are for the hbase:meta Region; i.e.private final org.apache.hadoop.fs.Path
private long
private final org.apache.hadoop.fs.Path
private final MasterServices
private final Lock
private final SplitLogManager
Deprecated. -
Constructor Summary
ConstructorDescriptionMasterWalManager
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, MasterServices services) MasterWalManager
(MasterServices services) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveMetaLog
(ServerName serverName) The hbase:meta region may OPEN and CLOSE without issue on a server and then move elsewhere.private boolean
Checks to see if the file system is still accessible.Deprecated.With proc-v2, we can record the crash server with procedure store, so do not need to scan the wal directory to find out the splitting wal directory any more.org.apache.hadoop.fs.FileSystem
Get Servernames that COULD BE 'alive'; excludes those that have a '-splitting' suffix as these are already being split -- they cannot be 'alive'.(package private) List<org.apache.hadoop.fs.Path>
getLogDirs
(Set<ServerName> serverNames) (package private) org.apache.hadoop.fs.Path
Get the directory where old logs golong
getServerNamesFromWALDirPath
(org.apache.hadoop.fs.PathFilter filter) Returns listing of ServerNames found by parsing WAL directory paths in FS.(package private) SplitLogManager
Get Servernames which are currently splitting; paths have a '-splitting' suffix.org.apache.hadoop.fs.FileStatus[]
getWALDirPaths
(org.apache.hadoop.fs.PathFilter filter) Returns List of all RegionServer WAL dirs; i.e.void
splitLog
(Set<ServerName> serverNames) void
splitLog
(Set<ServerName> serverNames, org.apache.hadoop.fs.PathFilter filter) This method is the base split method that splits WAL files matching a filter.void
splitLog
(ServerName serverName) void
splitMetaLog
(Set<ServerName> serverNames) Specialized method to handle the splitting for meta WALvoid
splitMetaLog
(ServerName serverName) Specialized method to handle the splitting for meta WALvoid
stop()
void
-
Field Details
-
LOG
-
META_FILTER
Filter *in* WAL files that are for the hbase:meta Region. -
NON_META_FILTER
Filter *out* WAL files that are for the hbase:meta Region; i.e. return user-space WALs only. -
metricsMasterFilesystem
-
services
-
conf
-
fs
-
oldLogDir
-
rootDir
-
splitLogLock
-
oldWALsDirSize
-
splitLogManager
Deprecated.since 2.3.0 and 3.0.0 to be removed in 4.0.0; replaced bySplitWALManager
.Superceded bySplitWALManager
; i.e. procedure-based WAL splitting rather than 'classic' zk-coordinated WAL splitting.- See Also:
-
fsOk
-
-
Constructor Details
-
MasterWalManager
- Throws:
IOException
-
MasterWalManager
public MasterWalManager(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, MasterServices services) throws IOException - Throws:
IOException
-
-
Method Details
-
stop
-
getSplitLogManager
-
getOldLogDir
org.apache.hadoop.fs.Path getOldLogDir()Get the directory where old logs go- Returns:
- the dir
-
updateOldWALsDirSize
- Throws:
IOException
-
getOldWALsDirSize
-
getFileSystem
-
checkFileSystem
Checks to see if the file system is still accessible. If not, sets closed- Returns:
- false if file system is not available
-
getSplittingServersFromWALDir
Get Servernames which are currently splitting; paths have a '-splitting' suffix.- Throws:
IOException
-
getLiveServersFromWALDir
Get Servernames that COULD BE 'alive'; excludes those that have a '-splitting' suffix as these are already being split -- they cannot be 'alive'.- Throws:
IOException
-
getServerNamesFromWALDirPath
public Set<ServerName> getServerNamesFromWALDirPath(org.apache.hadoop.fs.PathFilter filter) throws IOException Returns listing of ServerNames found by parsing WAL directory paths in FS.- Throws:
IOException
-
getWALDirPaths
public org.apache.hadoop.fs.FileStatus[] getWALDirPaths(org.apache.hadoop.fs.PathFilter filter) throws IOException Returns List of all RegionServer WAL dirs; i.e. this.rootDir/HConstants.HREGION_LOGDIR_NAME.- Throws:
IOException
-
getFailedServersFromLogFolders
Deprecated.With proc-v2, we can record the crash server with procedure store, so do not need to scan the wal directory to find out the splitting wal directory any more. Leave it here only becauseRecoverMetaProcedure
(which is also deprecated) uses it.Inspect the log directory to find dead servers which need recovery work- Returns:
- A set of ServerNames which aren't running but still have WAL files left in file system
- Throws:
IOException
-
splitLog
- Throws:
IOException
-
splitMetaLog
Specialized method to handle the splitting for meta WAL- Parameters:
serverName
- logs belonging to this server will be split- Throws:
IOException
-
splitMetaLog
Specialized method to handle the splitting for meta WAL- Parameters:
serverNames
- logs belonging to these servers will be split- Throws:
IOException
-
getLogDirs
- Throws:
IOException
-
splitLog
- Throws:
IOException
-
splitLog
public void splitLog(Set<ServerName> serverNames, org.apache.hadoop.fs.PathFilter filter) throws IOException This method is the base split method that splits WAL files matching a filter. Callers should pass the appropriate filter for meta and non-meta WALs.- Parameters:
serverNames
- logs belonging to these servers will be split; this will rename the log directory out from under a soft-failed server- Throws:
IOException
-
archiveMetaLog
The hbase:meta region may OPEN and CLOSE without issue on a server and then move elsewhere. On CLOSE, the WAL for the hbase:meta table may not be archived yet (The WAL is only needed if hbase:meta did not close cleanaly). Since meta region is no long on this server, the ServerCrashProcedure won't split these leftover hbase:meta WALs, just leaving them in the WAL splitting dir. If we try to delete the WAL splitting for the server, it fail since the dir is not totally empty. We can safely archive these hbase:meta log; then the WAL dir can be deleted.- Parameters:
serverName
- the server to archive meta log
-
SplitWALManager
.