Class OmRatisSnapshotProvider
java.lang.Object
org.apache.hadoop.hdds.utils.RDBSnapshotProvider
org.apache.hadoop.ozone.om.ratis_snapshot.OmRatisSnapshotProvider
- All Implemented Interfaces:
Closeable,AutoCloseable
public class OmRatisSnapshotProvider
extends org.apache.hadoop.hdds.utils.RDBSnapshotProvider
OmRatisSnapshotProvider downloads the latest checkpoint from the
leader OM and loads the checkpoint into State Machine. In addtion
to the latest checkpoint, it also downloads any previous
omSnapshots the leader has created.
The term "snapshot" has two related but slightly different meanings
in ozone. An "omSnapshot" is a copy of the om's metadata at a
point in time. It is created by users through the "ozone sh
snapshot create" cli.
A "ratisSnapshot", (provided by this class), is used by om
followers to bootstrap themselves to the current state of the om
leader. ratisSnapshots will contain copies of all the individual
"omSnapshot"s that exist on the leader at the time of the
bootstrap. The follower needs these copies to respond the users
snapshot requests when it becomes the leader.
-
Constructor Summary
ConstructorsConstructorDescriptionOmRatisSnapshotProvider(File snapshotDir, Map<String, org.apache.hadoop.ozone.om.helpers.OMNodeDetails> peerNodesMap, org.apache.hadoop.hdds.server.http.HttpConfig.Policy httpPolicy, boolean spnegoEnabled, org.apache.hadoop.hdfs.web.URLConnectionFactory connectionFactory) OmRatisSnapshotProvider(org.apache.hadoop.hdds.conf.MutableConfigurationSource conf, File omRatisSnapshotDir, Map<String, org.apache.hadoop.ozone.om.helpers.OMNodeDetails> peerNodeDetails) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNewPeerNode(org.apache.hadoop.ozone.om.helpers.OMNodeDetails newOMNode) When a new OM is bootstrapped, add it to the peerNode map.voidclose()static voiddownloadFileWithProgress(InputStream inputStream, File targetFile) Writes data from the given InputStream to the target file while logging download progress every 30 seconds.voiddownloadSnapshot(String leaderNodeID, File targetFile) voidremoveDecommissionedPeerNode(String decommNodeId) When an OM is decommissioned, remove it from the peerNode map.static voidwriteFormData(HttpURLConnection connection, List<String> sstFiles) Writes form data to output stream as any HTTP client would for a multipart/form-data request.Methods inherited from class org.apache.hadoop.hdds.utils.RDBSnapshotProvider
downloadDBSnapshotFromLeader, getCandidateDir, getCheckpointFromSnapshotFile, getInitCount, getInjector, getNumDownloaded, getSnapshotDir, getSnapshotFileName, init, setInjector
-
Constructor Details
-
OmRatisSnapshotProvider
-
OmRatisSnapshotProvider
-
-
Method Details
-
addNewPeerNode
public void addNewPeerNode(org.apache.hadoop.ozone.om.helpers.OMNodeDetails newOMNode) When a new OM is bootstrapped, add it to the peerNode map. -
removeDecommissionedPeerNode
When an OM is decommissioned, remove it from the peerNode map. -
downloadSnapshot
- Specified by:
downloadSnapshotin classorg.apache.hadoop.hdds.utils.RDBSnapshotProvider- Throws:
IOException
-
downloadFileWithProgress
public static void downloadFileWithProgress(InputStream inputStream, File targetFile) throws IOException Writes data from the given InputStream to the target file while logging download progress every 30 seconds.- Throws:
IOException
-
writeFormData
public static void writeFormData(HttpURLConnection connection, List<String> sstFiles) throws IOException Writes form data to output stream as any HTTP client would for a multipart/form-data request. Proper form data includes separator, content disposition and value separated by a new line. Example:-----XXX Content-Disposition: form-data; name="field1" value1
- Parameters:
connection- HTTP URL connection which output stream is used.sstFiles- SST files for exclusion.- Throws:
IOException- if an exception occured during writing to output stream.
-
close
- Throws:
IOException
-