Package org.apache.hadoop.ozone.om
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 -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.ozone.lock.BootstrapStateHandler.Lockorg.apache.hadoop.hdds.utils.db.DBCheckpointgetCheckpoint(Path tmpdir, boolean flush) Copies compaction logs and hard links of sst backups to tmpDir.voidinit()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 longprocessFile(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.voidwriteDbDataToStream(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, initializeMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
OMDBCheckpointServlet
public OMDBCheckpointServlet()
-
-
Method Details
-
init
public void init() throws javax.servlet.ServletException- Overrides:
initin classjavax.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:
writeDbDataToStreamin classorg.apache.hadoop.hdds.utils.DBCheckpointServlet- Throws:
IOExceptionInterruptedException
-
normalizeExcludeList
public static Map<String,Map<Path, normalizeExcludeListPath>> (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 followercheckpointLocation- - location of checkpoint for this tarballsstBackupDir- - 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:
getCheckpointin classorg.apache.hadoop.hdds.utils.DBCheckpointServlet- Parameters:
tmpdir- - Place to create copies/linksflush- - 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, throws IOExceptionPath>> 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. 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:
getBootstrapStateLockin interfaceorg.apache.hadoop.ozone.lock.BootstrapStateHandler- Overrides:
getBootstrapStateLockin classorg.apache.hadoop.hdds.utils.DBCheckpointServlet
-