Class MasterWalManager

java.lang.Object
org.apache.hadoop.hbase.master.MasterWalManager

@Private public class MasterWalManager extends Object
This class abstracts a bunch of operations the HMaster needs when splitting log files e.g. finding log files, dirs etc.
  • Field Details

  • Constructor Details

  • Method Details

    • stop

      public void stop()
    • getSplitLogManager

    • getOldLogDir

      org.apache.hadoop.fs.Path getOldLogDir()
      Get the directory where old logs go
      Returns:
      the dir
    • updateOldWALsDirSize

      public void updateOldWALsDirSize() throws IOException
      Throws:
      IOException
    • getOldWALsDirSize

      public long getOldWALsDirSize()
    • getFileSystem

      public org.apache.hadoop.fs.FileSystem getFileSystem()
    • checkFileSystem

      private boolean 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 because RecoverMetaProcedure(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

      public void splitLog(ServerName serverName) throws IOException
      Throws:
      IOException
    • splitMetaLog

      public void splitMetaLog(ServerName serverName) throws IOException
      Specialized method to handle the splitting for meta WAL
      Parameters:
      serverName - logs belonging to this server will be split
      Throws:
      IOException
    • splitMetaLog

      public void splitMetaLog(Set<ServerName> serverNames) throws IOException
      Specialized method to handle the splitting for meta WAL
      Parameters:
      serverNames - logs belonging to these servers will be split
      Throws:
      IOException
    • getLogDirs

      List<org.apache.hadoop.fs.Path> getLogDirs(Set<ServerName> serverNames) throws IOException
      Throws:
      IOException
    • splitLog

      public void splitLog(Set<ServerName> serverNames) throws IOException
      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

      public void archiveMetaLog(ServerName serverName)
      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