Class OMDBCheckpointServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.hadoop.hdds.utils.DBCheckpointServlet
org.apache.hadoop.ozone.om.OMDBCheckpointServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, org.apache.hadoop.ozone.lock.BootstrapStateHandler

public class OMDBCheckpointServlet extends org.apache.hadoop.hdds.utils.DBCheckpointServlet
Provides the current checkpoint Snapshot of the OM DB. (tar.gz) When Ozone ACL is enabled (`ozone.acl.enabled`=`true`), only users/principals configured in `ozone.administrator` (along with the user that starts OM, which automatically becomes an Ozone administrator but not necessarily in the config) are allowed to access this endpoint. If Kerberos is enabled, the principal should be appended to `ozone.administrator`, e.g. `scm/scm@EXAMPLE.COM` If Kerberos is not enabled, simply append the login username to `ozone.administrator`, e.g. `scm`
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.ozone.lock.BootstrapStateHandler.Lock
     
    org.apache.hadoop.hdds.utils.db.DBCheckpoint
    getCheckpoint(Path tmpdir, boolean flush)
    Copies compaction logs and hard links of sst backups to tmpDir.
    void
     
    normalizeExcludeList(Collection<String> toExcludeList, Path checkpointLocation, org.apache.hadoop.ozone.om.OMDBCheckpointServlet.DirectoryData sstBackupDir)
    Format the list of excluded sst files from follower to match data on leader.
    static long
    processFile(Path file, Map<String,Map<Path,Path>> copyFiles, Map<Path,Path> hardLinkFiles, Map<String,Map<Path,Path>> sstFilesToExclude, Path destDir)
    Takes a db file and determines whether it should be included in the tarball, or added as a link, or excluded altogether.
    void
    writeDbDataToStream(org.apache.hadoop.hdds.utils.db.DBCheckpoint checkpoint, javax.servlet.http.HttpServletRequest request, OutputStream destination, Set<String> toExcludeList, Path tmpdir)
     

    Methods inherited from class org.apache.hadoop.hdds.utils.DBCheckpointServlet

    doGet, doPost, extractSstFilesToExclude, getDbStore, initialize

    Methods inherited from class javax.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service

    Methods inherited from class javax.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OMDBCheckpointServlet

      public OMDBCheckpointServlet()
  • Method Details

    • init

      public void init() throws javax.servlet.ServletException
      Overrides:
      init in class javax.servlet.GenericServlet
      Throws:
      javax.servlet.ServletException
    • writeDbDataToStream

      public void writeDbDataToStream(org.apache.hadoop.hdds.utils.db.DBCheckpoint checkpoint, javax.servlet.http.HttpServletRequest request, OutputStream destination, Set<String> toExcludeList, Path tmpdir) throws IOException, InterruptedException
      Overrides:
      writeDbDataToStream in class org.apache.hadoop.hdds.utils.DBCheckpointServlet
      Throws:
      IOException
      InterruptedException
    • normalizeExcludeList

      public static Map<String,Map<Path,Path>> normalizeExcludeList(Collection<String> toExcludeList, Path checkpointLocation, org.apache.hadoop.ozone.om.OMDBCheckpointServlet.DirectoryData sstBackupDir)
      Format the list of excluded sst files from follower to match data on leader.
      Parameters:
      toExcludeList - - list of excluded sst files from follower
      checkpointLocation - - location of checkpoint for this tarball
      sstBackupDir - - location info about sstBackupDir
      Returns:
      A Map of src and dest paths for the entries in the toExcludeList. Formatted in a manner analogous to the copyFiles data structure described above. Because this structure only points to sst files, the implementation ignores the compactionLog dir, (which doesn't include sst files.)
    • getCheckpoint

      public org.apache.hadoop.hdds.utils.db.DBCheckpoint getCheckpoint(Path tmpdir, boolean flush) throws IOException
      Copies compaction logs and hard links of sst backups to tmpDir.
      Overrides:
      getCheckpoint in class org.apache.hadoop.hdds.utils.DBCheckpointServlet
      Parameters:
      tmpdir - - Place to create copies/links
      flush - - Whether to flush the db or not.
      Returns:
      Checkpoint containing snapshot entries expected.
      Throws:
      IOException
    • processFile

      public static long processFile(Path file, Map<String,Map<Path,Path>> copyFiles, Map<Path,Path> hardLinkFiles, Map<String,Map<Path,Path>> sstFilesToExclude, Path destDir) throws IOException
      Takes a db file and determines whether it should be included in the tarball, or added as a link, or excluded altogether. Uses the sstFilesToExclude list to know what already exists on the follower.
      Parameters:
      file - The db file to be processed.
      copyFiles - The db files to be added to tarball.
      hardLinkFiles - The db files to be added as hard links.
      sstFilesToExclude - The db files to be excluded from tarball.
      Throws:
      IOException
    • getBootstrapStateLock

      public org.apache.hadoop.ozone.lock.BootstrapStateHandler.Lock getBootstrapStateLock()
      Specified by:
      getBootstrapStateLock in interface org.apache.hadoop.ozone.lock.BootstrapStateHandler
      Overrides:
      getBootstrapStateLock in class org.apache.hadoop.hdds.utils.DBCheckpointServlet