You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ru...@apache.org on 2021/03/02 02:14:06 UTC

[ozone] branch HDDS-2823 updated: Merge remote-tracking branch 'github/master' into HDDS-2823-2021-03-01 (#1972)

This is an automated email from the ASF dual-hosted git repository.

runzhiwang pushed a commit to branch HDDS-2823
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-2823 by this push:
     new 8f6941a   Merge remote-tracking branch 'github/master' into HDDS-2823-2021-03-01 (#1972)
8f6941a is described below

commit 8f6941a46cdfb5ccce32b04e8cd0b423a3babb09
Author: Glen Geng <gl...@tencent.com>
AuthorDate: Tue Mar 2 10:13:49 2021 +0800

     Merge remote-tracking branch 'github/master' into HDDS-2823-2021-03-01 (#1972)
---
 .github/workflows/post-commit.yml                  |   3 +-
 .../apache/hadoop/hdds/scm/XceiverClientGrpc.java  |   1 +
 .../hadoop/hdds/scm/XceiverClientManager.java      |   4 +
 .../hadoop/hdds/scm/storage/BlockInputStream.java  |   7 +
 .../client/src/test/resources/log4j.properties     |   2 +-
 .../org/apache/hadoop/hdds/DatanodeVersions.java   |  28 +-
 .../java/org/apache/hadoop/hdds/JavaUtils.java     |  36 +-
 .../apache/hadoop/hdds/client/ReplicationType.java |   4 +-
 .../hadoop/hdds/protocol/DatanodeDetails.java      |  56 ++-
 .../org/apache/hadoop/hdds/ratis/RatisHelper.java  |  36 +-
 .../org/apache/hadoop/hdds/scm/ScmConfigKeys.java  |   5 +
 .../apache/hadoop/hdds/scm/client/ScmClient.java   |  13 +
 .../hadoop/hdds/scm/container/ContainerInfo.java   |   1 +
 .../apache/hadoop/hdds/scm/net/InnerNodeImpl.java  |   7 +
 .../hadoop/hdds/scm/net/NetworkTopologyImpl.java   |  18 +
 .../org/apache/hadoop/hdds/scm/net/NodeImpl.java   |  12 +
 .../hadoop/hdds/scm/pipeline/PipelineID.java       |   2 +
 .../protocol/StorageContainerLocationProtocol.java |  19 +-
 .../apache/hadoop/hdds/utils/BackgroundTask.java   |   1 +
 .../org/apache/hadoop/ozone/OzoneConfigKeys.java   |  12 +
 .../java/org/apache/hadoop/ozone/OzoneConsts.java  |   5 +
 .../org/apache/hadoop/ozone/common/Checksum.java   |   6 +-
 .../ozone/common/ChecksumByteBufferFactory.java    |  93 +++++
 .../ozone/common/ChecksumByteBufferImpl.java       |  66 ++++
 .../hadoop/ozone/common/NativeCheckSumCRC32.java   |  85 +++++
 .../ozone/common/PureJavaCrc32ByteBuffer.java      |   3 +-
 .../ozone/common/PureJavaCrc32CByteBuffer.java     |   3 +-
 .../org/apache/hadoop/util/NativeCRC32Wrapper.java |  72 ++++
 .../java/org/apache/hadoop/util/package-info.java} |  14 +-
 .../common/src/main/resources/ozone-default.xml    |  26 +-
 .../ozone/common/TestChecksumByteBuffer.java       |   4 +-
 .../common/TestChecksumImplsComputeSameValues.java |  99 ++++++
 .../common/src/test/resources/log4j.properties     |   2 +-
 .../org/apache/hadoop/hdds/conf/StorageUnit.java   |   1 +
 .../apache/hadoop/hdds/conf/TimeDurationUtil.java  |  14 +
 .../apache/hadoop/ozone/HddsDatanodeService.java   |   8 +-
 .../container/common/helpers/DatanodeIdYaml.java   |  38 ++-
 .../container/common/impl/ContainerDataYaml.java   |   2 +
 .../common/impl/StorageLocationReport.java         |   6 +
 .../common/statemachine/DatanodeStateMachine.java  |   3 +-
 .../common/statemachine/EndpointStateMachine.java  |   4 +
 .../common/statemachine/SCMConnectionManager.java  |   9 +-
 .../common/statemachine/StateContext.java          |  34 +-
 .../transport/server/ratis/XceiverServerRatis.java | 124 ++++---
 .../container/common/utils/HddsVolumeUtil.java     |   6 +-
 .../container/common/utils/ReferenceCountedDB.java |   1 +
 .../container/keyvalue/KeyValueContainer.java      |   8 +
 .../container/keyvalue/KeyValueContainerData.java  |   3 +
 .../container/keyvalue/impl/BlockManagerImpl.java  |  14 +-
 .../keyvalue/impl/FilePerChunkStrategy.java        |   2 +
 .../metadata/DatanodeSchemaOneDBDefinition.java    |   1 +
 .../metadata/DatanodeSchemaTwoDBDefinition.java    |   2 +-
 .../ozone/container/ozoneimpl/ContainerReader.java |   6 +-
 .../replication/GrpcReplicationClient.java         |  18 +-
 .../replication/SimpleContainerDownloader.java     |  10 +-
 .../protocol/commands/CommandForDatanode.java      |   1 +
 .../hadoop/ozone/protocol/commands/SCMCommand.java |   1 +
 .../common/statemachine/TestStateContext.java      |  24 +-
 .../container/keyvalue/ChunkLayoutTestInfo.java    |   2 +
 .../keyvalue/impl/TestBlockManagerImpl.java        |  43 +++
 .../src/test/resources/log4j.properties            |   2 +-
 hadoop-hdds/docs/content/interface/Cli.md          |   2 +-
 ...inerLocationProtocolClientSideTranslatorPB.java |  68 ++--
 .../x509/certificate/authority/CRLApprover.java    |  39 ++-
 .../certificate/authority/CertificateServer.java   |  31 +-
 .../certificate/authority/CertificateStore.java    |  34 +-
 .../certificate/authority/DefaultApprover.java     |   1 +
 .../certificate/authority/DefaultCAServer.java     |  39 ++-
 .../certificate/authority/DefaultCRLApprover.java  |  58 ++++
 .../certificate/client/DNCertificateClient.java    |   1 +
 .../certificate/client/OMCertificateClient.java    |   2 +
 .../certificates/utils/CertificateSignRequest.java |  14 +-
 .../hadoop/hdds/security/x509/crl/CRLInfo.java     | 168 +++++++++
 .../x509/crl/package-info.java}                    |  18 +-
 .../hadoop/hdds/utils/DBCheckpointMetrics.java     |  95 ++++++
 .../hadoop/hdds/utils/DBCheckpointServlet.java     | 113 +++----
 .../apache/hadoop/hdds/utils/HddsServerUtil.java   |  32 ++
 .../org/apache/hadoop/hdds/utils/RocksDBStore.java |  12 +-
 .../hadoop/hdds/utils/db/BatchOperation.java       |   1 +
 .../hadoop/hdds/utils/db/ByteArrayKeyValue.java    |   2 +
 .../hadoop/hdds/utils/db/DBConfigFromFile.java     |   4 +-
 .../hadoop/hdds/utils/db/RDBCheckpointManager.java |   2 +-
 .../apache/hadoop/hdds/utils/db/RDBMetrics.java    |   2 +-
 .../org/apache/hadoop/hdds/utils/db/RDBStore.java  |  14 +-
 .../org/apache/hadoop/hdds/utils/db/RDBTable.java  |  18 +-
 .../apache/hadoop/hdds/utils/db/TypedTable.java    |   1 +
 .../hadoop/hdds/utils/db/cache/EpochEntry.java     |   1 +
 .../hadoop/hdds/utils/db/cache/FullTableCache.java |   4 +
 .../hdds/utils/db/cache/PartialTableCache.java     |   4 +
 .../x509/certificate/authority/MockCAStore.java    |  14 +-
 .../certificate/authority/TestDefaultCAServer.java |  67 +++-
 .../src/test/resources/log4j.properties            |   2 +-
 .../src/main/proto/ScmAdminProtocol.proto          |  17 +-
 .../interface-client/src/main/proto/hdds.proto     |  14 +
 .../hadoop/hdds/scm/block/BlockManagerImpl.java    |   2 +
 .../hdds/scm/container/SCMContainerManager.java    |  23 +-
 .../container/placement/metrics/SCMMetrics.java    |   8 +
 .../scm/container/states/ContainerAttribute.java   |   5 +-
 .../scm/container/states/ContainerStateMap.java    |   7 +-
 .../hadoop/hdds/scm/metadata/CRLInfoCodec.java     |  58 ++++
 .../hadoop/hdds/scm/metadata/SCMDBDefinition.java  |  23 +-
 .../hadoop/hdds/scm/metadata/SCMMetadataStore.java |  16 +
 .../hdds/scm/metadata/SCMMetadataStoreImpl.java    |  32 ++
 .../hdds/scm/node/NodeDecommissionManager.java     |  29 +-
 .../hadoop/hdds/scm/node/SCMNodeManager.java       |  18 +-
 .../hadoop/hdds/scm/pipeline/PipelineStateMap.java |   6 +
 .../hdds/scm/pipeline/RatisPipelineProvider.java   |   1 +
 .../hdds/scm/pipeline/SCMPipelineManager.java      |   3 +
 ...inerLocationProtocolServerSideTranslatorPB.java |  73 ++--
 .../hdds/scm/safemode/SCMSafeModeManager.java      |   1 +
 .../hadoop/hdds/scm/server/SCMCertStore.java       | 105 ++++--
 .../hdds/scm/server/SCMClientProtocolServer.java   |  95 +++++-
 .../hdds/scm/server/SCMDBCheckpointServlet.java    |  64 ++++
 .../hdds/scm/server/StorageContainerManager.java   |  54 ++-
 .../server/StorageContainerManagerHttpServer.java  |   8 +-
 .../scm/server/StorageContainerManagerStarter.java |   5 +-
 .../scm/TestStorageContainerManagerHttpServer.java |   2 +-
 .../hadoop/hdds/scm/container/MockNodeManager.java |   2 +
 ...TestSCMStoreImplWithOldPipelineIDKeyFormat.java |  11 +
 .../hadoop/hdds/scm/server/TestSCMCertStore.java   | 269 +++++++++++++++
 .../server/TestStorageContainerManagerStarter.java |   5 +
 .../hdds/scm/cli/ContainerOperationClient.java     |  26 +-
 .../hadoop/hdds/scm/cli/TopologySubcommand.java    |   1 +
 .../hdds/scm/cli/container/InfoSubcommand.java     |  39 ++-
 .../hdds/scm/cli/datanode/DatanodeCommands.java    |   8 +-
 .../scm/cli/datanode/DecommissionSubCommand.java   |  14 +-
 .../hdds/scm/cli/datanode/ListInfoSubcommand.java  |   4 +-
 .../scm/cli/datanode/MaintenanceSubCommand.java    |  16 +-
 .../scm/cli/datanode/RecommissionSubCommand.java   |  17 +-
 .../hdds/scm/cli/datanode/UsageInfoSubcommand.java | 103 ++++++
 .../hadoop/ozone/client/io/KeyInputStream.java     |  43 +++
 .../client/io/MultipartCryptoKeyInputStream.java   | 375 +++++++++++++++++++++
 .../ozone/client/io/OzoneCryptoInputStream.java    |  57 ++++
 .../hadoop/ozone/client/io/OzoneInputStream.java   |   3 +
 .../hadoop/ozone/client/io/OzoneOutputStream.java  |   7 +
 .../apache/hadoop/ozone/client/rpc/RpcClient.java  |  74 ++--
 .../org/apache/hadoop/ozone/om/ha/OMProxyInfo.java |   1 +
 .../apache/hadoop/ozone/om/helpers/OmKeyInfo.java  |   7 +-
 .../hadoop/ozone/om/helpers/OmKeyLocationInfo.java |  35 +-
 .../ozone/om/helpers/OmKeyLocationInfoGroup.java   |  29 +-
 .../hadoop/ozone/om/helpers/OzoneFileStatus.java   |   6 +-
 ...OzoneManagerProtocolClientSideTranslatorPB.java |   5 +
 hadoop-ozone/datanode/pom.xml                      |   4 +
 .../intellij/runConfigurations/Datanode2.xml       |   2 +-
 .../intellij/runConfigurations/Datanode3.xml       |   2 +-
 .../dist/src/main/compose/ozone-ha/test.sh         |   4 +
 .../compose/ozone-om-ha-s3/docker-compose.yaml     |  99 ------
 .../main/compose/ozonesecure-om-ha/docker-config   |   3 +-
 .../src/main/compose/ozonesecure/docker-config     |   6 +
 .../dist/src/main/compose/ozonesecure/test.sh      |   9 +-
 .../main/compose/{ozone-om-ha-s3 => restart}/.env  |   4 +-
 .../dist/src/main/compose/restart/README.md        |  22 ++
 .../src/main/compose/restart/docker-compose.yaml   | 134 ++++++++
 .../{ozone-om-ha-s3 => restart}/docker-config      |  18 +-
 .../compose/{ozone-om-ha-s3 => restart}/test.sh    |  34 +-
 hadoop-ozone/dist/src/main/compose/testlib.sh      |  40 ++-
 .../dist/src/main/compose/xcompat/clients.yaml     |   9 -
 hadoop-ozone/dist/src/main/compose/xcompat/test.sh |   2 +-
 .../dist/src/main/dockerlibexec/entrypoint.sh      |   2 +-
 .../smoketest/admincli/replicationmanager.robot    |  10 +-
 .../src/main/smoketest/compatibility/read.robot    |  11 +-
 .../src/main/smoketest/compatibility/write.robot   |  10 +-
 .../dist/src/main/smoketest/recon/recon-api.robot  |   6 +-
 .../write.robot => replication/wait.robot}         |  17 +-
 .../src/main/smoketest/s3/MultipartUpload.robot    |  39 +++
 .../apache/hadoop/ozone/MiniOzoneChaosCluster.java |   6 +
 .../org/apache/hadoop/ozone/failure/Failures.java  |   4 +
 .../ozone/loadgenerators/RandomLoadGenerator.java  |   1 +
 .../loadgenerators/ReadOnlyLoadGenerator.java      |   1 +
 .../insight}/src/test/resources/log4j.properties   |   2 +-
 .../hadoop/fs/ozone/TestRootedOzoneFileSystem.java |  55 ++-
 .../scm/TestSCMDbCheckpointServlet.java}           | 144 ++------
 .../apache/hadoop/ozone/MiniOzoneClusterImpl.java  |  24 +-
 .../apache/hadoop/ozone/TestMiniOzoneCluster.java  |  66 ++--
 .../client/rpc/TestOzoneAtRestEncryption.java      | 198 ++++++++++-
 .../client/rpc/TestOzoneRpcClientAbstract.java     |  17 +-
 .../hadoop/ozone/om/TestOMDbCheckpointServlet.java |  54 +--
 .../hadoop/ozone/recon/TestReconAsPassiveScm.java  |   2 +
 .../src/main/proto/OmClientProtocol.proto          |   3 +
 .../org/apache/hadoop/ozone/om/KeyManagerImpl.java |  10 +-
 .../hadoop/ozone/om/OMDBCheckpointServlet.java     | 226 +------------
 .../java/org/apache/hadoop/ozone/om/OMMetrics.java |  48 +--
 .../hadoop/ozone/om/OmMetadataManagerImpl.java     |   3 +
 .../org/apache/hadoop/ozone/om/OzoneManager.java   |  26 +-
 .../hadoop/ozone/om/OzoneManagerStarter.java       |   2 +
 .../hadoop/ozone/om/TrashOzoneFileSystem.java      |  12 +-
 .../ozone/om/ratis/OzoneManagerRatisServer.java    |  33 +-
 .../ozone/om/request/key/OMKeyCommitRequest.java   |   2 +-
 .../ozone/om/request/key/OMKeyCreateRequest.java   |   6 +-
 .../hadoop/ozone/om/request/key/OMKeyRequest.java  |  31 ++
 .../S3InitiateMultipartUploadRequest.java          |  18 +-
 .../S3MultipartUploadCommitPartRequest.java        |   2 +-
 .../S3MultipartUploadCompleteRequest.java          |  23 +-
 .../om/response/key/OMKeysDeleteResponse.java      |   1 +
 .../om/response/key/OMOpenKeysDeleteRequest.java   |   1 +
 .../protocolPB/OzoneManagerRequestHandler.java     |  14 +-
 .../OzoneDelegationTokenSecretManager.java         |   1 +
 .../ozone/security/acl/OzoneNativeAuthorizer.java  |   1 +
 .../hadoop/ozone/om/TestOzoneManagerStarter.java   |   2 +
 .../om/ratis/TestOzoneManagerRatisServer.java      |  12 +-
 .../TestS3InitiateMultipartUploadRequest.java      |  60 ----
 .../fs/ozone/BasicOzoneClientAdapterImpl.java      |   2 +
 .../hadoop/fs/ozone/BasicOzoneFileSystem.java      |   1 +
 .../ozone/BasicRootedOzoneClientAdapterImpl.java   |   2 +
 .../fs/ozone/BasicRootedOzoneFileSystem.java       |   2 +
 .../org/apache/hadoop/fs/ozone/O3fsDtFetcher.java  |   3 +
 .../org/apache/hadoop/fs/ozone/OzoneFsShell.java   |   1 +
 .../fs/ozone/Hadoop27OmTransportFactory.java       |   4 +-
 .../hadoop/fs/ozone/Hadoop27RpcTransport.java      |  77 +++--
 .../org/hadoop/ozone/recon/codegen/SqlDbUtils.java |   1 +
 .../hadoop/ozone/recon/ReconRestServletModule.java |   4 +
 .../hadoop/ozone/recon/api/NodeEndpoint.java       |   3 +
 .../ozone/recon/api/types/DatanodeMetadata.java    |  15 +
 .../ozone/recon/fsck/ContainerHealthTask.java      |   1 +
 .../recon/scm/ReconDatanodeProtocolServer.java     |   1 +
 .../hadoop/ozone/recon/scm/ReconNodeManager.java   |  20 +-
 .../scm/ReconStorageContainerManagerFacade.java    |   3 +
 .../webapps/recon/ozone-recon-web/api/db.json      | 286 +++++++++++++++-
 .../ozone-recon-web/src/types/datanode.types.tsx   |  12 +-
 .../src/views/datanodes/datanodes.tsx              |  59 +++-
 .../hadoop/ozone/recon/api/TestEndpoints.java      |  47 +++
 .../ozone/recon/scm/TestReconNodeManager.java      |  33 +-
 .../hadoop/ozone/s3/AWSSignatureProcessor.java     |   4 +
 .../hadoop/ozone/s3/endpoint/ObjectEndpoint.java   |  47 +++
 .../hadoop/ozone/s3/exception/S3ErrorTable.java    |   5 +
 .../apache/hadoop/ozone/s3/util/RangeHeader.java   |   2 +-
 .../org/apache/hadoop/ozone/s3/util/S3Consts.java  |   7 +
 .../s3/endpoint/TestMultipartUploadWithCopy.java   |  90 ++++-
 .../audit/parser/handler/LoadCommandHandler.java   |   1 +
 .../audit/parser/handler/QueryCommandHandler.java  |   1 +
 .../parser/handler/TemplateCommandHandler.java     |   1 +
 .../hadoop/ozone/debug/DBDefinitionFactory.java    |  38 ++-
 .../org/apache/hadoop/ozone/debug/DBScanner.java   |   4 +-
 .../apache/hadoop/ozone/debug/ExportContainer.java | 191 +++++++++++
 .../hadoop/ozone/genesis/BenchMarkCRCBatch.java    | 138 ++++++++
 .../ozone/genesis/BenchMarkCRCStreaming.java       | 170 ++++++++++
 .../org/apache/hadoop/ozone/genesis/Genesis.java   |   2 +-
 .../java/org/apache/hadoop/ozone/shell/Shell.java  |   2 +-
 .../hadoop/ozone/shell/s3/GetS3SecretHandler.java  |  21 +-
 .../ozone/debug/TestDBDefinitionFactory.java       |  13 +-
 .../tools}/src/test/resources/log4j.properties     |   2 +-
 pom.xml                                            |   2 +-
 tools/fault-injection-service/CMakeLists.txt       | 229 ++++++-------
 tools/fault-injection-service/README.md            |  37 +-
 244 files changed, 5555 insertions(+), 1448 deletions(-)

diff --git a/.github/workflows/post-commit.yml b/.github/workflows/post-commit.yml
index 7fdc808..b7b3869 100644
--- a/.github/workflows/post-commit.yml
+++ b/.github/workflows/post-commit.yml
@@ -256,6 +256,7 @@ jobs:
         continue-on-error: true
   coverage:
     runs-on: ubuntu-18.04
+    if: github.repository == 'apache/ozone' && github.event_name != 'pull_request'
     needs:
       - acceptance
       - integration
@@ -275,12 +276,10 @@ jobs:
         run: ./hadoop-ozone/dev-support/checks/coverage.sh
       - name: Setup java 11
         uses: actions/setup-java@v1
-        if: github.repository == 'apache/ozone' && github.event_name != 'pull_request'
         with:
           java-version: 11
       - name: Upload coverage to Sonar
         run: ./hadoop-ozone/dev-support/checks/sonar.sh
-        if: github.repository == 'apache/ozone' && github.event_name != 'pull_request'
         env:
           SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java
index fb8ba52..8703011 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java
@@ -559,6 +559,7 @@ public class XceiverClientGrpc extends XceiverClientSpi {
     return null;
   }
 
+  @Override
   public long getReplicatedMinCommitIndex() {
     return 0;
   }
diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
index eaf0503..31728c6 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
@@ -139,6 +139,7 @@ public class XceiverClientManager implements Closeable, XceiverClientFactory {
    * @return XceiverClientSpi connected to a container
    * @throws IOException if a XceiverClientSpi cannot be acquired
    */
+  @Override
   public XceiverClientSpi acquireClient(Pipeline pipeline)
       throws IOException {
     return acquireClient(pipeline, false);
@@ -154,6 +155,7 @@ public class XceiverClientManager implements Closeable, XceiverClientFactory {
    * @return XceiverClientSpi connected to a container
    * @throws IOException if a XceiverClientSpi cannot be acquired
    */
+  @Override
   public XceiverClientSpi acquireClientForReadData(Pipeline pipeline)
       throws IOException {
     return acquireClient(pipeline, true);
@@ -179,6 +181,7 @@ public class XceiverClientManager implements Closeable, XceiverClientFactory {
    * @param client client to release
    * @param invalidateClient if true, invalidates the client in cache
    */
+  @Override
   public void releaseClient(XceiverClientSpi client, boolean invalidateClient) {
     releaseClient(client, invalidateClient, false);
   }
@@ -189,6 +192,7 @@ public class XceiverClientManager implements Closeable, XceiverClientFactory {
    * @param client client to release
    * @param invalidateClient if true, invalidates the client in cache
    */
+  @Override
   public void releaseClientForReadData(XceiverClientSpi client,
       boolean invalidateClient) {
     releaseClient(client, invalidateClient, true);
diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
index a5f3091..d0e45a0 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
@@ -413,6 +413,13 @@ public class BlockInputStream extends InputStream
   public synchronized void close() {
     releaseClient();
     xceiverClientFactory = null;
+
+    final List<ChunkInputStream> inputStreams = this.chunkStreams;
+    if (inputStreams != null) {
+      for (ChunkInputStream is : inputStreams) {
+        is.close();
+      }
+    }
   }
 
   private void releaseClient() {
diff --git a/hadoop-hdds/client/src/test/resources/log4j.properties b/hadoop-hdds/client/src/test/resources/log4j.properties
index bb5cbe5..3987866 100644
--- a/hadoop-hdds/client/src/test/resources/log4j.properties
+++ b/hadoop-hdds/client/src/test/resources/log4j.properties
@@ -20,4 +20,4 @@ log4j.rootLogger=INFO,stdout
 log4j.threshold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) - %m%n
diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/types/datanode.types.tsx b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/DatanodeVersions.java
similarity index 62%
copy from hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/types/datanode.types.tsx
copy to hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/DatanodeVersions.java
index e9cb168..a8c5f1e 100644
--- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/types/datanode.types.tsx
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/DatanodeVersions.java
@@ -6,22 +6,30 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.hadoop.hdds;
 
-export const DatanodeStatusList = ['HEALTHY', 'STALE', 'DEAD', 'DECOMMISSIONING', 'DECOMMISSIONED'] as const;
-type DatanodeStatusTuple = typeof DatanodeStatusList;
-export type DatanodeStatus = DatanodeStatusTuple[number]; // 'HEALTHY' | 'STALE' | 'DEAD' | 'DECOMMISSIONING' | 'DECOMMISSIONED';
+/**
+ * Versioning for datanode.
+ */
+public final class DatanodeVersions {
+
+  public static final int DEFAULT_VERSION = 0;
+
+  public static final int SEPARATE_RATIS_PORTS_AVAILABLE = 1;
+
+  // this should always point to the latest version
+  public static final int CURRENT_VERSION = SEPARATE_RATIS_PORTS_AVAILABLE;
 
-export interface IStorageReport {
-  capacity: number;
-  used: number;
-  remaining: number;
+  private DatanodeVersions() {
+    // no instances
+  }
 }
diff --git a/hadoop-ozone/ozonefs-hadoop2/src/main/java/org/apache/hadoop/fs/ozone/Hadoop27OmTransportFactory.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/JavaUtils.java
similarity index 54%
copy from hadoop-ozone/ozonefs-hadoop2/src/main/java/org/apache/hadoop/fs/ozone/Hadoop27OmTransportFactory.java
copy to hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/JavaUtils.java
index 66794b2..63c29ba 100644
--- a/hadoop-ozone/ozonefs-hadoop2/src/main/java/org/apache/hadoop/fs/ozone/Hadoop27OmTransportFactory.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/JavaUtils.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,24 +15,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.hadoop.fs.ozone;
-
-import java.io.IOException;
-
-import org.apache.hadoop.hdds.conf.ConfigurationSource;
-import org.apache.hadoop.ozone.om.protocolPB.OmTransport;
-import org.apache.hadoop.ozone.om.protocolPB.OmTransportFactory;
-import org.apache.hadoop.security.UserGroupInformation;
+package org.apache.hadoop.hdds;
 
 /**
- * OM Transport factory to create Simple (NON-HA) OM transport client.
+ * Various reusable utility methods related to Java.
  */
-public class Hadoop27OmTransportFactory implements OmTransportFactory {
+public final class JavaUtils {
+  // "1.8"->8, "9"->9, "10"->10
+  private static final int JAVA_SPEC_VER = Math.max(8, Integer.parseInt(
+      System.getProperty("java.specification.version").split("\\.")[0]));
 
-  @Override
-  public OmTransport createOmTransport(ConfigurationSource source,
-      UserGroupInformation ugi, String omServiceId) throws IOException {
-    return new Hadoop27RpcTransport(source);
+  /**
+   * Query to see if major version of Java specification of the system
+   * is equal or greater than the parameter.
+   *
+   * @param version 8, 9, 10 etc.
+   * @return comparison with system property, always true for 8
+   */
+  public static boolean isJavaVersionAtLeast(int version) {
+    return JAVA_SPEC_VER >= version;
   }
 
+  /**
+   * Private constructor.
+   */
+  private JavaUtils() {
+  }
 }
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationType.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationType.java
index c63896e..11a8218 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationType.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationType.java
@@ -24,8 +24,8 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
  * The replication type to be used while writing key into ozone.
  */
 public enum ReplicationType {
-    RATIS,
-    STAND_ALONE,
+  RATIS,
+  STAND_ALONE,
   CHAINED;
 
   public static ReplicationType fromProto(
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java
index c8338b3..3791483 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java
@@ -24,7 +24,9 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.common.collect.ImmutableSet;
+import org.apache.hadoop.hdds.DatanodeVersions;
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
 import org.apache.hadoop.hdds.annotation.InterfaceStability;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name;
@@ -73,6 +75,8 @@ public class DatanodeDetails extends NodeImpl implements
   private String buildDate;
   private HddsProtos.NodeOperationalState persistedOpState;
   private long persistedOpStateExpiryEpochSec = 0;
+  private int initialVersion;
+  private int currentVersion;
 
   /**
    * Constructs DatanodeDetails instance. DatanodeDetails.Builder is used
@@ -96,7 +100,8 @@ public class DatanodeDetails extends NodeImpl implements
       String networkLocation, List<Port> ports, String certSerialId,
       String version, long setupTime, String revision, String buildDate,
       HddsProtos.NodeOperationalState persistedOpState,
-      long persistedOpStateExpiryEpochSec) {
+      long persistedOpStateExpiryEpochSec,
+      int initialVersion, int currentVersion) {
     super(hostName, networkLocation, NetConstants.NODE_COST_DEFAULT);
     this.uuid = uuid;
     this.uuidString = uuid.toString();
@@ -110,6 +115,8 @@ public class DatanodeDetails extends NodeImpl implements
     this.buildDate = buildDate;
     this.persistedOpState = persistedOpState;
     this.persistedOpStateExpiryEpochSec = persistedOpStateExpiryEpochSec;
+    this.initialVersion = initialVersion;
+    this.currentVersion = currentVersion;
   }
 
   public DatanodeDetails(DatanodeDetails datanodeDetails) {
@@ -129,6 +136,8 @@ public class DatanodeDetails extends NodeImpl implements
     this.persistedOpState = datanodeDetails.getPersistedOpState();
     this.persistedOpStateExpiryEpochSec =
         datanodeDetails.getPersistedOpStateExpiryEpochSec();
+    this.initialVersion = datanodeDetails.getInitialVersion();
+    this.currentVersion = datanodeDetails.getCurrentVersion();
   }
 
   /**
@@ -263,6 +272,10 @@ public class DatanodeDetails extends NodeImpl implements
         return port;
       }
     }
+    // if no separate admin/server port, return single Ratis one for compat
+    if (name == Name.RATIS_ADMIN || name == Name.RATIS_SERVER) {
+      return getPort(Name.RATIS);
+    }
     return null;
   }
 
@@ -357,6 +370,7 @@ public class DatanodeDetails extends NodeImpl implements
    * Returns a DatanodeDetails protobuf message from a datanode ID.
    * @return HddsProtos.DatanodeDetailsProto
    */
+  @JsonIgnore
   public HddsProtos.DatanodeDetailsProto getProtoBufMessage() {
     return toProto(CURRENT_VERSION);
   }
@@ -419,6 +433,7 @@ public class DatanodeDetails extends NodeImpl implements
    * Returns a ExtendedDatanodeDetails protobuf message from a datanode ID.
    * @return HddsProtos.ExtendedDatanodeDetailsProto
    */
+  @JsonIgnore
   public HddsProtos.ExtendedDatanodeDetailsProto getExtendedProtoBufMessage() {
     HddsProtos.ExtendedDatanodeDetailsProto.Builder extendedBuilder =
         HddsProtos.ExtendedDatanodeDetailsProto.newBuilder()
@@ -440,6 +455,28 @@ public class DatanodeDetails extends NodeImpl implements
     return extendedBuilder.build();
   }
 
+  /**
+   * @return the version this datanode was initially created with
+   */
+  public int getInitialVersion() {
+    return initialVersion;
+  }
+
+  public void setInitialVersion(int initialVersion) {
+    this.initialVersion = initialVersion;
+  }
+
+  /**
+   * @return the version this datanode was last started with
+   */
+  public int getCurrentVersion() {
+    return currentVersion;
+  }
+
+  public void setCurrentVersion(int currentVersion) {
+    this.currentVersion = currentVersion;
+  }
+
   @Override
   public String toString() {
     return uuid.toString() + "{" +
@@ -498,6 +535,8 @@ public class DatanodeDetails extends NodeImpl implements
     private String buildDate;
     private HddsProtos.NodeOperationalState persistedOpState;
     private long persistedOpStateExpiryEpochSec = 0;
+    private int initialVersion;
+    private int currentVersion = DatanodeVersions.CURRENT_VERSION;
 
     /**
      * Default private constructor. To create Builder instance use
@@ -683,6 +722,16 @@ public class DatanodeDetails extends NodeImpl implements
       return this;
     }
 
+    public Builder setInitialVersion(int v) {
+      this.initialVersion = v;
+      return this;
+    }
+
+    public Builder setCurrentVersion(int v) {
+      this.currentVersion = v;
+      return this;
+    }
+
     /**
      * Builds and returns DatanodeDetails instance.
      *
@@ -695,7 +744,8 @@ public class DatanodeDetails extends NodeImpl implements
       }
       DatanodeDetails dn = new DatanodeDetails(id, ipAddress, hostName,
           networkLocation, ports, certSerialId, version, setupTime, revision,
-          buildDate, persistedOpState, persistedOpStateExpiryEpochSec);
+          buildDate, persistedOpState, persistedOpStateExpiryEpochSec,
+          initialVersion, currentVersion);
       if (networkName != null) {
         dn.setNetworkName(networkName);
       }
@@ -724,7 +774,7 @@ public class DatanodeDetails extends NodeImpl implements
      * Ports that are supported in DataNode.
      */
     public enum Name {
-      STANDALONE, RATIS, REST, REPLICATION;
+      STANDALONE, RATIS, REST, REPLICATION, RATIS_ADMIN, RATIS_SERVER;
 
       public static final Set<Name> ALL_PORTS = ImmutableSet.copyOf(
           Name.values());
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
index c910dd5..06acb44 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
@@ -31,6 +31,7 @@ import java.util.stream.Collectors;
 import org.apache.hadoop.hdds.StringUtils;
 import org.apache.hadoop.hdds.conf.ConfigurationSource;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails.Port;
 import org.apache.hadoop.hdds.ratis.conf.RatisClientConfig;
 import org.apache.hadoop.hdds.ratis.retrypolicy.RetryPolicyCreator;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
@@ -40,9 +41,9 @@ import org.apache.hadoop.hdds.security.x509.SecurityConfig;
 import org.apache.ratis.RaftConfigKeys;
 import org.apache.ratis.client.RaftClient;
 import org.apache.ratis.client.RaftClientConfigKeys;
+import org.apache.ratis.conf.Parameters;
 import org.apache.ratis.conf.RaftProperties;
 import org.apache.ratis.grpc.GrpcConfigKeys;
-import org.apache.ratis.grpc.GrpcFactory;
 import org.apache.ratis.grpc.GrpcTlsConfig;
 import org.apache.ratis.proto.RaftProtos;
 import org.apache.ratis.protocol.RaftGroup;
@@ -94,9 +95,8 @@ public final class RatisHelper {
     return toDatanodeId(RaftPeerId.valueOf(peerId.getId()));
   }
 
-  private static String toRaftPeerAddressString(DatanodeDetails id) {
-    return id.getIpAddress() + ":" +
-        id.getPort(DatanodeDetails.Port.Name.RATIS).getValue();
+  private static String toRaftPeerAddress(DatanodeDetails id, Port.Name port) {
+    return id.getIpAddress() + ":" + id.getPort(port).getValue();
   }
 
   public static RaftPeerId toRaftPeerId(DatanodeDetails id) {
@@ -104,20 +104,23 @@ public final class RatisHelper {
   }
 
   public static RaftPeer toRaftPeer(DatanodeDetails id) {
-    return RaftPeer.newBuilder()
-        .setId(toRaftPeerId(id))
-        .setAddress(toRaftPeerAddressString(id))
-        .build();
+    return raftPeerBuilderFor(id).build();
   }
 
   public static RaftPeer toRaftPeer(DatanodeDetails id, int priority) {
-    return RaftPeer.newBuilder()
-        .setId(toRaftPeerId(id))
-        .setAddress(toRaftPeerAddressString(id))
+    return raftPeerBuilderFor(id)
         .setPriority(priority)
         .build();
   }
 
+  private static RaftPeer.Builder raftPeerBuilderFor(DatanodeDetails dn) {
+    return RaftPeer.newBuilder()
+        .setId(toRaftPeerId(dn))
+        .setAddress(toRaftPeerAddress(dn, Port.Name.RATIS_SERVER))
+        .setAdminAddress(toRaftPeerAddress(dn, Port.Name.RATIS_ADMIN))
+        .setClientAddress(toRaftPeerAddress(dn, Port.Name.RATIS));
+  }
+
   private static List<RaftPeer> toRaftPeers(Pipeline pipeline) {
     return toRaftPeers(pipeline.getNodes());
   }
@@ -224,7 +227,9 @@ public final class RatisHelper {
 
     // TODO: GRPC TLS only for now, netty/hadoop RPC TLS support later.
     if (tlsConfig != null && rpcType == SupportedRpcType.GRPC) {
-      builder.setParameters(GrpcFactory.newRaftParameters(tlsConfig));
+      Parameters parameters = new Parameters();
+      GrpcConfigKeys.Client.setTlsConf(parameters, tlsConfig);
+      builder.setParameters(parameters);
     }
     return builder.build();
   }
@@ -254,9 +259,10 @@ public final class RatisHelper {
   }
 
   private static boolean isGrpcClientConfig(String key) {
-    return key.startsWith(GrpcConfigKeys.PREFIX) && !key
-        .startsWith(GrpcConfigKeys.TLS.PREFIX) && !key
-        .startsWith(GrpcConfigKeys.Server.PREFIX);
+    return key.startsWith(GrpcConfigKeys.PREFIX) &&
+        !key.startsWith(GrpcConfigKeys.TLS.PREFIX) &&
+        !key.startsWith(GrpcConfigKeys.Admin.PREFIX) &&
+        !key.startsWith(GrpcConfigKeys.Server.PREFIX);
   }
   /**
    * Set all server properties matching with prefix
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java
index 1ffcda1..dbeb419 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java
@@ -250,6 +250,11 @@ public final class ScmConfigKeys {
   public static final int OZONE_SCM_HEARTBEAT_RPC_RETRY_COUNT_DEFAULT =
       15;
 
+  public static final String OZONE_SCM_HEARTBEAT_RPC_RETRY_INTERVAL =
+      "ozone.scm.heartbeat.rpc-retry-interval";
+  public static final String OZONE_SCM_HEARTBEAT_RPC_RETRY_INTERVAL_DEFAULT =
+      "1s";
+
   /**
    * Defines how frequently we will log the missing of heartbeat to a specific
    * SCM. In the default case we will write a warning message for each 10
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
index b8d73e8..21f7fa0 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
@@ -287,4 +287,17 @@ public interface ScmClient extends Closeable {
    * returns the list of ratis peer roles. Currently only include peer address.
    */
   List<String> getScmRatisRoles() throws IOException;
+
+  /**
+   * Get usage information of datanode by ipaddress or uuid.
+   *
+   * @param ipaddress datanode ipaddress String
+   * @param uuid datanode uuid String
+   * @return List of DatanodeUsageInfo. Each element contains info such as
+   * capacity, SCMused, and remaining space.
+   * @throws IOException
+   */
+  List<HddsProtos.DatanodeUsageInfo> getDatanodeUsageInfo(String ipaddress,
+                                                  String uuid)
+      throws IOException;
 }
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerInfo.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerInfo.java
index e621a4f..3d42a02 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerInfo.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerInfo.java
@@ -204,6 +204,7 @@ public class ContainerInfo implements Comparator<ContainerInfo>,
     lastUsed = Instant.ofEpochMilli(Time.now());
   }
 
+  @JsonIgnore
   public HddsProtos.ContainerInfoProto getProtobuf() {
     HddsProtos.ContainerInfoProto.Builder builder =
         HddsProtos.ContainerInfoProto.newBuilder();
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/InnerNodeImpl.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/InnerNodeImpl.java
index c567b5d..23bdd32 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/InnerNodeImpl.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/InnerNodeImpl.java
@@ -39,6 +39,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
   protected static class Factory implements InnerNode.Factory<InnerNodeImpl> {
     protected Factory() {}
 
+    @Override
     public InnerNodeImpl newInnerNode(String name, String location,
         InnerNode parent, int level, int cost) {
       return new InnerNodeImpl(name, location, parent, level, cost);
@@ -80,6 +81,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
    * relative level. If level is 1, means node itself. If level is 2, means its
    * direct children, and so on.
    **/
+  @Override
   public int getNumOfNodes(int level) {
     Preconditions.checkArgument(level > 0);
     int count = 0;
@@ -126,6 +128,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
    * @param node node to be added
    * @return true if the node is added, false if is only updated
    */
+  @Override
   public boolean add(Node node) {
     if (!isAncestor(node)) {
       throw new IllegalArgumentException(node.getNetworkName()
@@ -162,6 +165,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
    * Remove node <i>node</i> from the subtree of this node.
    * @param node node to be deleted
    */
+  @Override
   public void remove(Node node) {
     if (!isAncestor(node)) {
       throw new IllegalArgumentException(node.getNetworkName()
@@ -206,6 +210,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
    *
    * @return null if the node is not found
    */
+  @Override
   public Node getNode(String loc) {
     if (loc == null) {
       return null;
@@ -249,6 +254,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
    * @param leafIndex an indexed leaf of the node
    * @return the leaf node corresponding to the given index.
    */
+  @Override
   public Node getLeaf(int leafIndex) {
     Preconditions.checkArgument(leafIndex >= 0);
     // children are leaves
@@ -314,6 +320,7 @@ public class InnerNodeImpl extends NodeImpl implements InnerNode {
    *   means picking the 3th available node, which is n5.
    *
    */
+  @Override
   public Node getLeaf(int leafIndex, List<String> excludedScopes,
       Collection<Node> excludedNodes, int ancestorGen) {
     Preconditions.checkArgument(leafIndex >= 0 && ancestorGen >= 0);
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetworkTopologyImpl.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetworkTopologyImpl.java
index acbb64f..aac5ad1 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetworkTopologyImpl.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetworkTopologyImpl.java
@@ -86,6 +86,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @exception IllegalArgumentException if add a node to a leave or node to be
    * added is not a leaf
    */
+  @Override
   public void add(Node node) {
     Preconditions.checkArgument(node != null, "node cannot be null");
     if (node instanceof InnerNode) {
@@ -120,6 +121,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * existing datanode is removed from the system.
    * @param node node to be removed; cannot be null
    */
+  @Override
   public void remove(Node node) {
     Preconditions.checkArgument(node != null, "node cannot be null");
     if (node instanceof InnerNode) {
@@ -143,6 +145,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @param node a node
    * @return true if <i>node</i> is already in the tree; false otherwise
    */
+  @Override
   public boolean contains(Node node) {
     Preconditions.checkArgument(node != null, "node cannot be null");
     netlock.readLock().lock();
@@ -164,6 +167,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * Compare the specified ancestor generation of each node for equality.
    * @return true if their specified generation ancestor are equal
    */
+  @Override
   public boolean isSameAncestor(Node node1, Node node2, int ancestorGen) {
     if (node1 == null || node2 == null || ancestorGen <= 0) {
       return false;
@@ -180,6 +184,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * Compare the direct parent of each node for equality.
    * @return true if their parent are the same
    */
+  @Override
   public boolean isSameParent(Node node1, Node node2) {
     if (node1 == null || node2 == null) {
       return false;
@@ -201,6 +206,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @param ancestorGen  the ancestor generation
    * @return the ancestor. If no ancestor is found, then null is returned.
    */
+  @Override
   public Node getAncestor(Node node, int ancestorGen) {
     if (node == null) {
       return null;
@@ -219,6 +225,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @param loc a path string representing a node, can be leaf or inner node
    * @return a reference to the node, null if the node is not in the tree
    */
+  @Override
   public Node getNode(String loc) {
     loc = NetUtils.normalize(loc);
     netlock.readLock().lock();
@@ -239,6 +246,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @return the number of leaf nodes for InnerNode, 1 for leaf node, 0 if node
    * doesn't exist
    */
+  @Override
   public int getNumOfLeafNode(String loc) {
     netlock.readLock().lock();
     try {
@@ -256,6 +264,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * Return the max level of this tree, start from 1 for ROOT. For example,
    * topology like "/rack/node" has the max level '3'.
    */
+  @Override
   public int getMaxLevel() {
     return maxLevel;
   }
@@ -265,6 +274,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @param level topology level, start from 1, which means ROOT
    * @return the number of nodes on the level
    */
+  @Override
   public int getNumOfNodes(int level) {
     Preconditions.checkArgument(level > 0 && level <= maxLevel,
         "Invalid level");
@@ -283,6 +293,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    *              ones in <i>scope</i>; otherwise, choose one from <i>scope</i>.
    * @return the chosen node
    */
+  @Override
   public Node chooseRandom(String scope) {
     if (scope == null) {
       scope = ROOT;
@@ -305,6 +316,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    *                      starts with ~
    * @return the chosen node
    */
+  @Override
   public Node chooseRandom(String scope, List<String> excludedScopes) {
     return chooseRandom(scope, excludedScopes, null, null,
         ANCESTOR_GENERATION_DEFAULT);
@@ -322,6 +334,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    *
    * @return the chosen node
    */
+  @Override
   public Node chooseRandom(String scope, Collection<Node> excludedNodes) {
     if (scope == null) {
       scope = ROOT;
@@ -355,6 +368,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    *
    * @return the chosen node
    */
+  @Override
   public Node chooseRandom(String scope, Collection<Node> excludedNodes,
       int ancestorGen) {
     if (scope == null) {
@@ -388,6 +402,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    *                     excludedNodes if affinityNode is null
    * @return the chosen node
    */
+  @Override
   public Node chooseRandom(String scope, List<String> excludedScopes,
       Collection<Node> excludedNodes, Node affinityNode, int ancestorGen) {
     if (scope == null) {
@@ -457,6 +472,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    *   from subtree /dc1. LeafIndex 1, so we pick the 2nd available node n4.
    *
    */
+  @Override
   public Node getNode(int leafIndex, String scope, List<String> excludedScopes,
       Collection<Node> excludedNodes, Node affinityNode, int ancestorGen) {
     Preconditions.checkArgument(leafIndex >= 0);
@@ -582,6 +598,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * are the same or {@link Integer#MAX_VALUE} if node1 or node2 do not belong
    * to the cluster
    */
+  @Override
   public int getDistanceCost(Node node1, Node node2) {
     if ((node1 != null && node2 != null && node1.equals(node2)) ||
         (node1 == null && node2 == null))  {
@@ -637,6 +654,7 @@ public class NetworkTopologyImpl implements NetworkTopology{
    * @param nodes     Available replicas with the requested data
    * @param activeLen Number of active nodes at the front of the array
    */
+  @Override
   public List<? extends Node> sortByDistanceCost(Node reader,
       List<? extends Node> nodes, int activeLen) {
     /** Sort weights for the nodes array */
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeImpl.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeImpl.java
index 53b05ea..3a926fa 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeImpl.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NodeImpl.java
@@ -77,6 +77,7 @@ public class NodeImpl implements Node {
   /**
    * @return this node's name
    */
+  @Override
   public String getNetworkName() {
     return name;
   }
@@ -85,6 +86,7 @@ public class NodeImpl implements Node {
    * Set this node's name, can be hostname or Ipaddress.
    * @param networkName it's network name
    */
+  @Override
   public void setNetworkName(String networkName) {
     this.name = networkName;
     this.path = getPath();
@@ -93,6 +95,7 @@ public class NodeImpl implements Node {
   /**
    * @return this node's network location
    */
+  @Override
   public String getNetworkLocation() {
     return location;
   }
@@ -111,6 +114,7 @@ public class NodeImpl implements Node {
    * @return this node's full path in network topology. It's the concatenation
    * of location and name.
    */
+  @Override
   public String getNetworkFullPath() {
     return path;
   }
@@ -118,6 +122,7 @@ public class NodeImpl implements Node {
   /**
    * @return this node's parent
    */
+  @Override
   public InnerNode getParent() {
     return parent;
   }
@@ -126,6 +131,7 @@ public class NodeImpl implements Node {
    * @return this node's ancestor, generation 0 is itself, generation 1 is
    * node's parent, and so on.
    */
+  @Override
   public Node getAncestor(int generation) {
     Preconditions.checkArgument(generation >= 0);
     Node current = this;
@@ -141,6 +147,7 @@ public class NodeImpl implements Node {
    *
    * @param parent the parent
    */
+  @Override
   public void setParent(InnerNode parent) {
     this.parent = parent;
   }
@@ -149,6 +156,7 @@ public class NodeImpl implements Node {
    * @return this node's level in the tree.
    * E.g. the root of a tree returns 0 and its children return 1
    */
+  @Override
   public int getLevel() {
     return this.level;
   }
@@ -158,6 +166,7 @@ public class NodeImpl implements Node {
    *
    * @param level the level
    */
+  @Override
   public void setLevel(int level) {
     this.level = level;
   }
@@ -168,11 +177,13 @@ public class NodeImpl implements Node {
    * datacenter is 5.
    * Be default the cost of leaf datanode is 0, all other inner node is 1.
    */
+  @Override
   public int getCost() {
     return this.cost;
   }
 
   /** @return the leaf nodes number under this node. */
+  @Override
   public int getNumOfLeaves() {
     return 1;
   }
@@ -183,6 +194,7 @@ public class NodeImpl implements Node {
    * @param node a node
    * @return true if this node is an ancestor of <i>node</i>
    */
+  @Override
   public boolean isAncestor(Node node) {
     return this.getNetworkFullPath().equals(PATH_SEPARATOR_STR) ||
         node.getNetworkLocation().startsWith(this.getNetworkFullPath()) ||
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
index ed7d215..0c2167c 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.hdds.scm.pipeline;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 
 import java.util.UUID;
@@ -45,6 +46,7 @@ public final class PipelineID {
     return id;
   }
 
+  @JsonIgnore
   public HddsProtos.PipelineID getProtobuf() {
     HddsProtos.UUID uuid128 = HddsProtos.UUID.newBuilder()
         .setMostSigBits(id.getMostSignificantBits())
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocol.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocol.java
index b272829..48c1d9f 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocol.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocol.java
@@ -19,12 +19,13 @@ package org.apache.hadoop.hdds.scm.protocol;
 
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.ScmConfig;
 import org.apache.hadoop.hdds.scm.ScmInfo;
-import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
+import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.security.KerberosInfo;
 
 import java.io.Closeable;
 import java.io.IOException;
@@ -34,8 +35,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.hadoop.security.KerberosInfo;
-
 /**
  * ContainerLocationProtocol is used by an HDFS node to find the set of nodes
  * that currently host a container.
@@ -253,4 +252,16 @@ public interface StorageContainerLocationProtocol extends Closeable {
    */
   boolean getReplicationManagerStatus() throws IOException;
 
+  /**
+   * Get Datanode usage information by ip or uuid.
+   *
+   * @param ipaddress - datanode IP address String
+   * @param uuid - datanode UUID String
+   * @return List of DatanodeUsageInfo. Each element contains info such as
+   * capacity, SCMused, and remaining space.
+   * @throws IOException
+   */
+  List<HddsProtos.DatanodeUsageInfo> getDatanodeUsageInfo(String ipaddress,
+                                                          String uuid)
+      throws IOException;
 }
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundTask.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundTask.java
index d506210..e985671 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundTask.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundTask.java
@@ -24,6 +24,7 @@ import java.util.concurrent.Callable;
  */
 public interface BackgroundTask extends Callable<BackgroundTaskResult> {
 
+  @Override
   BackgroundTaskResult call() throws Exception;
 
   int getPriority();
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
index c5c4426..873d288 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
@@ -64,6 +64,18 @@ public final class OzoneConfigKeys {
   public static final String DFS_CONTAINER_RATIS_IPC_PORT =
       "dfs.container.ratis.ipc";
   public static final int DFS_CONTAINER_RATIS_IPC_PORT_DEFAULT = 9858;
+  /**
+   * Ratis Port where containers listen to admin requests.
+   */
+  public static final String DFS_CONTAINER_RATIS_ADMIN_PORT =
+      "dfs.container.ratis.admin.port";
+  public static final int DFS_CONTAINER_RATIS_ADMIN_PORT_DEFAULT = 9857;
+  /**
+   * Ratis Port where containers listen to server-to-server requests.
+   */
+  public static final String DFS_CONTAINER_RATIS_SERVER_PORT =
+      "dfs.container.ratis.server.port";
+  public static final int DFS_CONTAINER_RATIS_SERVER_PORT_DEFAULT = 9856;
 
   /**
    * When set to true, allocate a random free port for ozone container, so that
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java
index 9d82444..235c631 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java
@@ -232,6 +232,8 @@ public final class OzoneConsts {
   // instance gets stored.
   public static final String OM_CONTEXT_ATTRIBUTE = "ozone.om";
 
+  public static final String SCM_CONTEXT_ATTRIBUTE = "ozone.scm";
+
   private OzoneConsts() {
     // Never Constructed
   }
@@ -410,4 +412,7 @@ public final class OzoneConsts {
   // in non-HA style.
   public static final String SCM_DUMMY_NODEID = "scmNodeId";
   public static final String SCM_DUMMY_SERVICE_ID = "scmServiceId";
+
+  // CRL Sequence Id
+  public static final String CRL_SEQUENCE_ID_KEY = "CRL_SEQUENCE_ID";
 }
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java
index d86f7b1..db7a31e 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/Checksum.java
@@ -75,8 +75,10 @@ public class Checksum {
   /** The algorithms for {@link ChecksumType}. */
   enum Algorithm {
     NONE(() -> data -> ByteString.EMPTY),
-    CRC32(() -> newChecksumByteBufferFunction(PureJavaCrc32ByteBuffer::new)),
-    CRC32C(() -> newChecksumByteBufferFunction(PureJavaCrc32CByteBuffer::new)),
+    CRC32(() ->
+        newChecksumByteBufferFunction(ChecksumByteBufferFactory::crc32Impl)),
+    CRC32C(() ->
+        newChecksumByteBufferFunction(ChecksumByteBufferFactory::crc32CImpl)),
     SHA256(() -> newMessageDigestFunction("SHA-256")),
     MD5(() -> newMessageDigestFunction("MD5"));
 
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBufferFactory.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBufferFactory.java
new file mode 100644
index 0000000..a41af84
--- /dev/null
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBufferFactory.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.common;
+
+import org.apache.hadoop.hdds.JavaUtils;
+import org.apache.hadoop.util.PureJavaCrc32C;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.zip.CRC32;
+import java.util.zip.Checksum;
+
+/**
+ * Class containing factories for creating various checksum impls.
+ */
+public final class ChecksumByteBufferFactory {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(ChecksumByteBufferImpl.class);
+
+  private static volatile boolean useJava9Crc32C
+      = JavaUtils.isJavaVersionAtLeast(9);
+
+  public static class Java9Crc32CFactory {
+    private static final MethodHandle NEW_CRC32C_MH;
+
+    static {
+      MethodHandle newCRC32C = null;
+      try {
+        newCRC32C = MethodHandles.publicLookup()
+            .findConstructor(
+                Class.forName("java.util.zip.CRC32C"),
+                MethodType.methodType(void.class)
+            );
+      } catch (ReflectiveOperationException e) {
+        // Should not reach here.
+        throw new RuntimeException(e);
+      }
+      NEW_CRC32C_MH = newCRC32C;
+    }
+
+    public static java.util.zip.Checksum createChecksum() {
+      try {
+        // Should throw nothing
+        return (Checksum) NEW_CRC32C_MH.invoke();
+      } catch (Throwable t) {
+        throw (t instanceof RuntimeException) ? (RuntimeException) t
+            : new RuntimeException(t);
+      }
+    }
+  };
+
+  public static ChecksumByteBuffer crc32Impl() {
+    return new ChecksumByteBufferImpl(new CRC32());
+  }
+
+  public static ChecksumByteBuffer crc32CImpl() {
+    if (useJava9Crc32C) {
+      try {
+        return new ChecksumByteBufferImpl(Java9Crc32CFactory.createChecksum());
+      } catch (Throwable e) {
+        // should not happen
+        LOG.error("CRC32C creation failed, switching to PureJavaCrc32C", e);
+        useJava9Crc32C = false;
+      }
+    }
+    return new ChecksumByteBufferImpl(new PureJavaCrc32C());
+  }
+
+  /**
+   * Private Constructor.
+   */
+  private ChecksumByteBufferFactory() {
+  }
+}
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBufferImpl.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBufferImpl.java
new file mode 100644
index 0000000..db779b6
--- /dev/null
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChecksumByteBufferImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.common;
+
+import java.nio.ByteBuffer;
+import java.util.zip.Checksum;
+
+public class ChecksumByteBufferImpl implements ChecksumByteBuffer {
+
+  private Checksum checksum;
+
+  public ChecksumByteBufferImpl(Checksum impl) {
+    this.checksum = impl;
+  }
+
+  @Override
+  // TODO - when we eventually move to a minimum Java version >= 9 this method
+  //        should be refactored to simply call checksum.update(buffer), as the
+  //        Checksum interface has been enhanced to allow this since Java 9.
+  public void update(ByteBuffer buffer) {
+    if (buffer.hasArray()) {
+      checksum.update(buffer.array(), buffer.position() + buffer.arrayOffset(),
+          buffer.remaining());
+    } else {
+      byte[] b = new byte[buffer.remaining()];
+      buffer.get(b);
+      checksum.update(b, 0, b.length);
+    }
+  }
+
+  @Override
+  public void update(byte[] b, int off, int len) {
+    checksum.update(b, off, len);
+  }
+
+  @Override
+  public void update(int i) {
+    checksum.update(i);
+  }
+
+  @Override
+  public long getValue() {
+    return checksum.getValue();
+  }
+
+  @Override
+  public void reset() {
+    checksum.reset();
+  }
+
+}
\ No newline at end of file
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java
new file mode 100644
index 0000000..81061ac
--- /dev/null
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.common;
+
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.hadoop.util.NativeCRC32Wrapper;
+
+import java.nio.ByteBuffer;
+
+/**
+ * This is a partial implementation to be used only in benchmarks.
+ *
+ * The Hadoop Native checksum libraries do not allow for updating a checksum
+ * as the java.util.zip.Checksum dictates in its update(...) method.
+ *
+ * This class allows the Native Hadoop CRC32 implementations to be called to
+ * generate checksums, provided only a single call is made to the update(...)
+ * method.
+ *
+ */
+public class NativeCheckSumCRC32 implements java.util.zip.Checksum {
+
+  // 1 for crc32, 2 for crc32c - see NativeCRC32Wrapper
+  private int checksumType;
+  private int bytesPerSum;
+
+  private ByteBuffer checksum = ByteBuffer.allocate(4);
+  private boolean needsReset = false;
+
+  public NativeCheckSumCRC32(int checksumType, int bytesPerSum) {
+    this.checksumType = checksumType;
+    this.bytesPerSum = bytesPerSum;
+  }
+
+  @Override
+  public void update(int b) {
+    throw new NotImplementedException("Update method is not implemented");
+  }
+
+  /**
+   * Calculate the checksum. Note the checksum is not updatable. You should
+   * make a single call to this method and then call getValue() to retrive the
+   * value.
+   * @param b A byte array whose contents will be used to calculate a CRC32(C)
+   * @param off The offset in the byte array to start reading.
+   * @param len The number of bytes in the byte array to read.
+   */
+  @Override
+  public void update(byte[] b, int off, int len) {
+    if (needsReset) {
+      throw new IllegalArgumentException(
+          "This checksum implementation is not updatable");
+    }
+    NativeCRC32Wrapper.calculateChunkedSumsByteArray(bytesPerSum, checksumType,
+        checksum.array(), 0, b, off, len);
+    needsReset = true;
+  }
+
+  @Override
+  public long getValue() {
+    checksum.position(0);
+    return checksum.getInt();
+  }
+
+  @Override
+  public void reset() {
+    checksum.clear();
+    needsReset = false;
+  }
+}
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32ByteBuffer.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32ByteBuffer.java
index 0d1f630..001a645 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32ByteBuffer.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32ByteBuffer.java
@@ -21,7 +21,8 @@ package org.apache.hadoop.ozone.common;
  * Similar to {@link org.apache.hadoop.util.PureJavaCrc32}
  * except that this class implement {@link ChecksumByteBuffer}.
  */
-final class PureJavaCrc32ByteBuffer extends ChecksumByteBuffer.CrcIntTable {
+public final class PureJavaCrc32ByteBuffer extends
+    ChecksumByteBuffer.CrcIntTable {
   @Override
   int[] getTable() {
     return T;
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32CByteBuffer.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32CByteBuffer.java
index 1c44357..c101c30 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32CByteBuffer.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/PureJavaCrc32CByteBuffer.java
@@ -24,7 +24,8 @@ package org.apache.hadoop.ozone.common;
  * Similar to {@link org.apache.hadoop.util.PureJavaCrc32C}
  * except that this class implement {@link ChecksumByteBuffer}.
  */
-final class PureJavaCrc32CByteBuffer extends ChecksumByteBuffer.CrcIntTable {
+public final class PureJavaCrc32CByteBuffer extends
+    ChecksumByteBuffer.CrcIntTable {
   @Override
   int[] getTable() {
     return T;
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/NativeCRC32Wrapper.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/NativeCRC32Wrapper.java
new file mode 100644
index 0000000..d88cdbb
--- /dev/null
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/NativeCRC32Wrapper.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.util;
+
+import org.apache.hadoop.fs.ChecksumException;
+
+import java.nio.ByteBuffer;
+
+/**
+ * This class wraps the NativeCRC32 class in hadoop-common, because the class
+ * is package private there. The intention of making this class available
+ * in Ozone is to allow the native libraries to be benchmarked alongside other
+ * implementations. At the current time, the hadoop native CRC is not used
+ * anywhere in Ozone except for benchmarks.
+ */
+public final class NativeCRC32Wrapper {
+
+  public static final int CHECKSUM_CRC32 = NativeCrc32.CHECKSUM_CRC32;
+  public static final int CHECKSUM_CRC32C = NativeCrc32.CHECKSUM_CRC32C;
+
+  // Private constructor
+  private NativeCRC32Wrapper() {
+  }
+
+  public static boolean isAvailable() {
+    return NativeCrc32.isAvailable();
+  }
+
+  public static void verifyChunkedSums(int bytesPerSum, int checksumType,
+      ByteBuffer sums, ByteBuffer data, String fileName, long basePos)
+      throws ChecksumException {
+    NativeCrc32.verifyChunkedSums(bytesPerSum, checksumType, sums, data,
+        fileName, basePos);
+  }
+
+  @SuppressWarnings("checkstyle:parameternumber")
+  public static void verifyChunkedSumsByteArray(int bytesPerSum,
+      int checksumType, byte[] sums, int sumsOffset, byte[] data,
+      int dataOffset, int dataLength, String fileName, long basePos)
+      throws ChecksumException {
+    NativeCrc32.verifyChunkedSumsByteArray(bytesPerSum, checksumType, sums,
+        sumsOffset, data, dataOffset, dataLength, fileName, basePos);
+  }
+
+  public static void calculateChunkedSums(int bytesPerSum, int checksumType,
+                                          ByteBuffer sums, ByteBuffer data) {
+    NativeCrc32.calculateChunkedSums(bytesPerSum, checksumType, sums, data);
+  }
+
+  public static void calculateChunkedSumsByteArray(int bytesPerSum,
+      int checksumType, byte[] sums, int sumsOffset, byte[] data,
+      int dataOffset, int dataLength) {
+    NativeCrc32.calculateChunkedSumsByteArray(bytesPerSum, checksumType, sums,
+        sumsOffset, data, dataOffset, dataLength);
+  }
+
+}
\ No newline at end of file
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/package-info.java
similarity index 69%
copy from hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
copy to hadoop-hdds/common/src/main/java/org/apache/hadoop/util/package-info.java
index 8ca5d18..3d1aba5 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/package-info.java
@@ -5,23 +5,19 @@
  * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
+ * with the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
-package org.apache.hadoop.hdds.utils.db;
 
 /**
- * Class represents a batch operation, collects multiple db operation.
+ * This package contains class that wrap private classes in hadoop-common
+ * util.
  */
-public interface BatchOperation extends AutoCloseable {
-
-  void close();
-}
+package org.apache.hadoop.util;
diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml b/hadoop-hdds/common/src/main/resources/ozone-default.xml
index d608720..fa0fa99 100644
--- a/hadoop-hdds/common/src/main/resources/ozone-default.xml
+++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml
@@ -167,8 +167,20 @@
   <property>
     <name>dfs.container.ratis.ipc</name>
     <value>9858</value>
+    <tag>OZONE, CONTAINER, PIPELINE, RATIS</tag>
+    <description>The ipc port number of container for clients.</description>
+  </property>
+  <property>
+    <name>dfs.container.ratis.admin.port</name>
+    <value>9857</value>
     <tag>OZONE, CONTAINER, PIPELINE, RATIS, MANAGEMENT</tag>
-    <description>The ipc port number of container.</description>
+    <description>The ipc port number of container for admin requests.</description>
+  </property>
+  <property>
+    <name>dfs.container.ratis.server.port</name>
+    <value>9856</value>
+    <tag>OZONE, CONTAINER, PIPELINE, RATIS, MANAGEMENT</tag>
+    <description>The ipc port number of container for server-server communication.</description>
   </property>
   <property>
     <name>dfs.container.ratis.ipc.random.port</name>
@@ -957,7 +969,17 @@
     <tag>OZONE, MANAGEMENT</tag>
     <description>
       Retry count for the RPC from Datanode to SCM. The rpc-retry-interval
-      is 1s. Make sure rpc-retry-count * (rpc-timeout + rpc-retry-interval)
+      is 1s by default. Make sure rpc-retry-count * (rpc-timeout +
+      rpc-retry-interval) is less than hdds.heartbeat.interval.
+    </description>
+  </property>
+  <property>
+    <name>ozone.scm.heartbeat.rpc-retry-interval</name>
+    <value>1s</value>
+    <tag>OZONE, MANAGEMENT</tag>
+    <description>
+      Retry interval for the RPC from Datanode to SCM.
+      Make sure rpc-retry-count * (rpc-timeout + rpc-retry-interval)
       is less than hdds.heartbeat.interval.
     </description>
   </property>
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumByteBuffer.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumByteBuffer.java
index 2f46637..4aac0b4 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumByteBuffer.java
+++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumByteBuffer.java
@@ -33,14 +33,14 @@ public class TestChecksumByteBuffer {
   @Test
   public void testPureJavaCrc32ByteBuffer() {
     final Checksum expected = new PureJavaCrc32();
-    final ChecksumByteBuffer testee = new PureJavaCrc32ByteBuffer();
+    final ChecksumByteBuffer testee = ChecksumByteBufferFactory.crc32Impl();
     new VerifyChecksumByteBuffer(expected, testee).testCorrectness();
   }
 
   @Test
   public void testPureJavaCrc32CByteBuffer() {
     final Checksum expected = new PureJavaCrc32C();
-    final ChecksumByteBuffer testee = new PureJavaCrc32CByteBuffer();
+    final ChecksumByteBuffer testee = ChecksumByteBufferFactory.crc32CImpl();
     new VerifyChecksumByteBuffer(expected, testee).testCorrectness();
   }
 
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumImplsComputeSameValues.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumImplsComputeSameValues.java
new file mode 100644
index 0000000..a098a26
--- /dev/null
+++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChecksumImplsComputeSameValues.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.common;
+
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.hadoop.util.NativeCRC32Wrapper;
+import org.apache.hadoop.util.PureJavaCrc32;
+import org.apache.hadoop.util.PureJavaCrc32C;
+import org.junit.Test;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.CRC32;
+
+import static junit.framework.TestCase.assertEquals;
+
+public class TestChecksumImplsComputeSameValues {
+
+  private int dataSize = 1024 * 1024 * 64;
+  private ByteBuffer data = ByteBuffer.allocate(dataSize);
+  private int[] bytesPerChecksum = {512, 1024, 2048, 4096, 32768, 1048576};
+
+  @Test
+  public void testCRC32ImplsMatch() {
+    data.clear();
+    data.put(RandomUtils.nextBytes(data.remaining()));
+    for (int bpc : bytesPerChecksum) {
+      List<ChecksumByteBuffer> impls = new ArrayList<>();
+      impls.add(new PureJavaCrc32ByteBuffer());
+      impls.add(new ChecksumByteBufferImpl(new PureJavaCrc32()));
+      impls.add(new ChecksumByteBufferImpl(new CRC32()));
+      if (NativeCRC32Wrapper.isAvailable()) {
+        impls.add(new ChecksumByteBufferImpl(new NativeCheckSumCRC32(1, bpc)));
+      }
+      assertEquals(true, validateImpls(data, impls, bpc));
+    }
+  }
+
+  @Test
+  public void testCRC32CImplsMatch() {
+    data.clear();
+    data.put(RandomUtils.nextBytes(data.remaining()));
+    for (int bpc : bytesPerChecksum) {
+      List<ChecksumByteBuffer> impls = new ArrayList<>();
+      impls.add(new PureJavaCrc32CByteBuffer());
+      impls.add(new ChecksumByteBufferImpl(new PureJavaCrc32C()));
+      try {
+        impls.add(new ChecksumByteBufferImpl(
+            ChecksumByteBufferFactory.Java9Crc32CFactory.createChecksum()));
+      } catch (Throwable e) {
+        // NOOP
+      }
+      // impls.add(new ChecksumByteBufferImpl(new CRC32C())));
+      if (NativeCRC32Wrapper.isAvailable()) {
+        impls.add(new ChecksumByteBufferImpl(new NativeCheckSumCRC32(2, bpc)));
+      }
+      assertEquals(true, validateImpls(data, impls, bpc));
+    }
+  }
+
+  private boolean validateImpls(ByteBuffer buf, List<ChecksumByteBuffer> impls,
+      int bpc) {
+    for (int i = 0; i < buf.capacity(); i += bpc) {
+      buf.position(i);
+      buf.limit(i + bpc);
+      impls.get(0).update(buf);
+      int res = (int) impls.get(0).getValue();
+      impls.get(0).reset();
+      for (int j = 1; j < impls.size(); j++) {
+        ChecksumByteBuffer csum = impls.get(j);
+        buf.position(i);
+        buf.limit(i + bpc);
+        csum.update(buf);
+        if ((int) csum.getValue() != res) {
+          return false;
+        }
+        csum.reset();
+      }
+    }
+    return true;
+  }
+
+}
diff --git a/hadoop-hdds/common/src/test/resources/log4j.properties b/hadoop-hdds/common/src/test/resources/log4j.properties
index bb5cbe5..3987866 100644
--- a/hadoop-hdds/common/src/test/resources/log4j.properties
+++ b/hadoop-hdds/common/src/test/resources/log4j.properties
@@ -20,4 +20,4 @@ log4j.rootLogger=INFO,stdout
 log4j.threshold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) - %m%n
diff --git a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/StorageUnit.java b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/StorageUnit.java
index 6678aa4..0d14fab 100644
--- a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/StorageUnit.java
+++ b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/StorageUnit.java
@@ -522,6 +522,7 @@ public enum StorageUnit {
 
   public abstract double fromBytes(double value);
 
+  @Override
   public String toString() {
     return getLongName();
   }
diff --git a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/TimeDurationUtil.java b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/TimeDurationUtil.java
index 2bbdecf..12c4953 100644
--- a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/TimeDurationUtil.java
+++ b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/TimeDurationUtil.java
@@ -65,64 +65,78 @@ public final class TimeDurationUtil {
 
   enum ParsedTimeDuration {
     NS {
+      @Override
       TimeUnit unit() {
         return TimeUnit.NANOSECONDS;
       }
 
+      @Override
       String suffix() {
         return "ns";
       }
     },
     US {
+      @Override
       TimeUnit unit() {
         return TimeUnit.MICROSECONDS;
       }
 
+      @Override
       String suffix() {
         return "us";
       }
     },
     MS {
+      @Override
       TimeUnit unit() {
         return TimeUnit.MILLISECONDS;
       }
 
+      @Override
       String suffix() {
         return "ms";
       }
     },
     S {
+      @Override
       TimeUnit unit() {
         return TimeUnit.SECONDS;
       }
 
+      @Override
       String suffix() {
         return "s";
       }
     },
     M {
+      @Override
       TimeUnit unit() {
         return TimeUnit.MINUTES;
       }
 
+      @Override
       String suffix() {
         return "m";
       }
     },
     H {
+      @Override
       TimeUnit unit() {
         return TimeUnit.HOURS;
       }
 
+      @Override
       String suffix() {
         return "h";
       }
     },
     D {
+      @Override
       TimeUnit unit() {
         return TimeUnit.DAYS;
       }
 
+      @Override
       String suffix() {
         return "d";
       }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java
index b5f2a3f..8a1ecf5 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java
@@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.hdds.DFSConfigKeysLegacy;
+import org.apache.hadoop.hdds.DatanodeVersions;
 import org.apache.hadoop.hdds.HddsUtils;
 import org.apache.hadoop.hdds.StringUtils;
 import org.apache.hadoop.hdds.cli.GenericCli;
@@ -209,6 +210,7 @@ public class HddsDatanodeService extends GenericCli implements ServicePlugin {
       datanodeDetails.setRevision(
           HddsVersionInfo.HDDS_VERSION_INFO.getRevision());
       datanodeDetails.setBuildDate(HddsVersionInfo.HDDS_VERSION_INFO.getDate());
+      datanodeDetails.setCurrentVersion(DatanodeVersions.CURRENT_VERSION);
       TracingUtil.initTracing(
           "HddsDatanodeService." + datanodeDetails.getUuidString()
               .substring(0, 8), conf);
@@ -434,7 +436,11 @@ public class HddsDatanodeService extends GenericCli implements ServicePlugin {
     } else {
       // There is no datanode.id file, this might be the first time datanode
       // is started.
-      return DatanodeDetails.newBuilder().setUuid(UUID.randomUUID()).build();
+      DatanodeDetails details = DatanodeDetails.newBuilder()
+          .setUuid(UUID.randomUUID()).build();
+      details.setInitialVersion(DatanodeVersions.CURRENT_VERSION);
+      details.setCurrentVersion(DatanodeVersions.CURRENT_VERSION);
+      return details;
     }
   }
 
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/DatanodeIdYaml.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/DatanodeIdYaml.java
index 3b14641..52f5b3a 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/DatanodeIdYaml.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/DatanodeIdYaml.java
@@ -100,6 +100,10 @@ public final class DatanodeIdYaml {
               portEntry.getValue()));
         }
       }
+
+      builder.setInitialVersion(datanodeDetailsYaml.getInitialVersion())
+          .setCurrentVersion(datanodeDetailsYaml.getCurrentVersion());
+
       datanodeDetails = builder.build();
     }
 
@@ -117,16 +121,19 @@ public final class DatanodeIdYaml {
     private String persistedOpState;
     private long persistedOpStateExpiryEpochSec = 0;
     private Map<String, Integer> portDetails;
+    private int initialVersion;
+    private int currentVersion;
 
     public DatanodeDetailsYaml() {
       // Needed for snake-yaml introspection.
     }
 
+    @SuppressWarnings({"parameternumber", "java:S107"}) // required for yaml
     private DatanodeDetailsYaml(String uuid, String ipAddress,
-                                String hostName, String certSerialId,
-                                String persistedOpState,
-                                long persistedOpStateExpiryEpochSec,
-                                Map<String, Integer> portDetails) {
+        String hostName, String certSerialId,
+        String persistedOpState, long persistedOpStateExpiryEpochSec,
+        Map<String, Integer> portDetails,
+        int initialVersion, int currentVersion) {
       this.uuid = uuid;
       this.ipAddress = ipAddress;
       this.hostName = hostName;
@@ -134,6 +141,8 @@ public final class DatanodeIdYaml {
       this.persistedOpState = persistedOpState;
       this.persistedOpStateExpiryEpochSec = persistedOpStateExpiryEpochSec;
       this.portDetails = portDetails;
+      this.initialVersion = initialVersion;
+      this.currentVersion = currentVersion;
     }
 
     public String getUuid() {
@@ -191,6 +200,22 @@ public final class DatanodeIdYaml {
     public void setPortDetails(Map<String, Integer> portDetails) {
       this.portDetails = portDetails;
     }
+
+    public int getInitialVersion() {
+      return initialVersion;
+    }
+
+    public void setInitialVersion(int version) {
+      this.initialVersion = version;
+    }
+
+    public int getCurrentVersion() {
+      return currentVersion;
+    }
+
+    public void setCurrentVersion(int version) {
+      this.currentVersion = version;
+    }
   }
 
   private static DatanodeDetailsYaml getDatanodeDetailsYaml(
@@ -207,6 +232,7 @@ public final class DatanodeIdYaml {
     if (datanodeDetails.getPersistedOpState() != null) {
       persistedOpString = datanodeDetails.getPersistedOpState().name();
     }
+
     return new DatanodeDetailsYaml(
         datanodeDetails.getUuid().toString(),
         datanodeDetails.getIpAddress(),
@@ -214,6 +240,8 @@ public final class DatanodeIdYaml {
         datanodeDetails.getCertSerialId(),
         persistedOpString,
         datanodeDetails.getPersistedOpStateExpiryEpochSec(),
-        portDetails);
+        portDetails,
+        datanodeDetails.getInitialVersion(),
+        datanodeDetails.getCurrentVersion());
   }
 }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerDataYaml.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerDataYaml.java
index 757d7e8..244750a 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerDataYaml.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerDataYaml.java
@@ -245,6 +245,7 @@ public final class ContainerDataYaml {
     }
 
     private class ConstructKeyValueContainerData extends AbstractConstruct {
+      @Override
       public Object construct(Node node) {
         MappingNode mnode = (MappingNode) node;
         Map<Object, Object> nodes = constructMapping(mnode);
@@ -289,6 +290,7 @@ public final class ContainerDataYaml {
     // number if it fits in integer, otherwise returns long. So, slightly
     // modified the code to return long in all cases.
     private class ConstructLong extends AbstractConstruct {
+      @Override
       public Object construct(Node node) {
         String value = constructScalar((ScalarNode) node).toString()
             .replaceAll("_", "");
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/StorageLocationReport.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/StorageLocationReport.java
index 2ad7f0d..8599b49 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/StorageLocationReport.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/StorageLocationReport.java
@@ -55,26 +55,32 @@ public final class StorageLocationReport implements
     this.storageLocation = storageLocation;
   }
 
+  @Override
   public String getId() {
     return id;
   }
 
+  @Override
   public boolean isFailed() {
     return failed;
   }
 
+  @Override
   public long getCapacity() {
     return capacity;
   }
 
+  @Override
   public long getScmUsed() {
     return scmUsed;
   }
 
+  @Override
   public long getRemaining() {
     return remaining;
   }
 
+  @Override
   public String getStorageLocation() {
     return storageLocation;
   }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
index 55047ea..975ce95 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
@@ -130,8 +130,7 @@ public class DatanodeStateMachine implements Closeable {
     ContainerReplicator replicator =
         new DownloadAndImportReplicator(container.getContainerSet(),
             container.getController(),
-            new SimpleContainerDownloader(conf,
-                dnCertClient != null ? dnCertClient.getCACertificate() : null),
+            new SimpleContainerDownloader(conf, dnCertClient),
             new TarContainerPacker());
 
     replicatorMetrics = new MeasuredReplicator(replicator);
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java
index 13f953f..31d7bbc 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java
@@ -115,6 +115,7 @@ public class EndpointStateMachine
    *
    * @return - getState.
    */
+  @Override
   public EndPointStates getState() {
     return state;
   }
@@ -171,6 +172,7 @@ public class EndpointStateMachine
    *
    * @return int
    */
+  @Override
   public long getMissedCount() {
     return this.missedCount.get();
   }
@@ -208,6 +210,7 @@ public class EndpointStateMachine
    *
    * @return - String
    */
+  @Override
   public String toString() {
     return address.toString();
   }
@@ -327,6 +330,7 @@ public class EndpointStateMachine
     }
   }
 
+  @Override
   public long getLastSuccessfulHeartbeat() {
     return lastSuccessfulHeartbeat == null ?
         0 :
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java
index c7dd9c6..ffca599 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java
@@ -47,6 +47,7 @@ import org.apache.hadoop.security.UserGroupInformation;
 import static java.util.Collections.unmodifiableList;
 import static org.apache.hadoop.hdds.utils.HddsServerUtil.getScmRpcTimeOutInMilliseconds;
 import static org.apache.hadoop.hdds.utils.HddsServerUtil.getScmRpcRetryCount;
+import static org.apache.hadoop.hdds.utils.HddsServerUtil.getScmRpcRetryInterval;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -151,8 +152,8 @@ public class SCMConnectionManager
 
       RetryPolicy retryPolicy =
           RetryPolicies.retryUpToMaximumCountWithFixedSleep(
-              getScmRpcRetryCount(conf),
-              1000, TimeUnit.MILLISECONDS);
+              getScmRpcRetryCount(conf), getScmRpcRetryInterval(conf),
+              TimeUnit.MILLISECONDS);
 
       StorageContainerDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(
           StorageContainerDatanodeProtocolPB.class, version,
@@ -196,8 +197,8 @@ public class SCMConnectionManager
 
       RetryPolicy retryPolicy =
           RetryPolicies.retryUpToMaximumCountWithFixedSleep(
-              getScmRpcRetryCount(conf),
-              1000, TimeUnit.MILLISECONDS);
+              getScmRpcRetryCount(conf), getScmRpcRetryInterval(conf),
+              TimeUnit.MILLISECONDS);
       ReconDatanodeProtocolPB rpcProxy = RPC.getProtocolProxy(
           ReconDatanodeProtocolPB.class, version,
           address, UserGroupInformation.getCurrentUser(), hadoopConfig,
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java
index 571cbd6..0202ecf 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java
@@ -426,6 +426,24 @@ public class StateContext {
   }
 
   /**
+   * Helper function for addPipelineActionIfAbsent that check if inputs are the
+   * same close pipeline action.
+   *
+   * Important Note: Make sure to double check for correctness before using this
+   * helper function for other purposes!
+   *
+   * @return true if a1 and a2 are the same close pipeline action,
+   *         false otherwise
+   */
+  boolean isSameClosePipelineAction(PipelineAction a1, PipelineAction a2) {
+    return a1.getAction() == a2.getAction()
+        && a1.hasClosePipeline()
+        && a2.hasClosePipeline()
+        && a1.getClosePipeline().getPipelineID()
+        .equals(a2.getClosePipeline().getPipelineID());
+  }
+
+  /**
    * Add PipelineAction to PipelineAction queue if it's not present.
    *
    * @param pipelineAction PipelineAction to be added
@@ -441,18 +459,12 @@ public class StateContext {
        * multiple times here.
        */
       for (InetSocketAddress endpoint : endpoints) {
-        Queue<PipelineAction> actionsForEndpoint =
-            this.pipelineActions.get(endpoint);
-        for (PipelineAction pipelineActionIter : actionsForEndpoint) {
-          if (pipelineActionIter.getAction() == pipelineAction.getAction()
-              && pipelineActionIter.hasClosePipeline() && pipelineAction
-              .hasClosePipeline()
-              && pipelineActionIter.getClosePipeline().getPipelineID()
-              .equals(pipelineAction.getClosePipeline().getPipelineID())) {
-            break;
-          }
+        final Queue<PipelineAction> actionsForEndpoint =
+            pipelineActions.get(endpoint);
+        if (actionsForEndpoint.stream().noneMatch(
+            action -> isSameClosePipelineAction(action, pipelineAction))) {
+          actionsForEndpoint.add(pipelineAction);
         }
-        actionsForEndpoint.add(pipelineAction);
       }
     }
   }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
index f2c4e7e..72859e1 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.ozone.container.common.transport.server.ratis;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -45,6 +46,7 @@ import org.apache.hadoop.hdds.conf.DatanodeRatisServerConfig;
 import org.apache.hadoop.hdds.conf.StorageUnit;
 import org.apache.hadoop.hdds.HddsConfigKeys;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails.Port;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.MetadataStorageReportProto;
@@ -77,9 +79,9 @@ import io.opentracing.Scope;
 import io.opentracing.Span;
 import io.opentracing.util.GlobalTracer;
 import org.apache.ratis.RaftConfigKeys;
+import org.apache.ratis.conf.Parameters;
 import org.apache.ratis.conf.RaftProperties;
 import org.apache.ratis.grpc.GrpcConfigKeys;
-import org.apache.ratis.grpc.GrpcFactory;
 import org.apache.ratis.grpc.GrpcTlsConfig;
 import org.apache.ratis.netty.NettyConfigKeys;
 import org.apache.ratis.proto.RaftProtos;
@@ -100,12 +102,14 @@ import org.apache.ratis.rpc.RpcType;
 import org.apache.ratis.rpc.SupportedRpcType;
 import org.apache.ratis.server.RaftServer;
 import org.apache.ratis.server.RaftServerConfigKeys;
+import org.apache.ratis.server.RaftServerRpc;
 import org.apache.ratis.server.protocol.TermIndex;
 import org.apache.ratis.util.SizeInBytes;
 import org.apache.ratis.util.TimeDuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.hdds.DatanodeVersions.SEPARATE_RATIS_PORTS_AVAILABLE;
 
 /**
  * Creates a ratis server endpoint that acts as the communication layer for
@@ -123,7 +127,9 @@ public final class XceiverServerRatis implements XceiverServerSpi {
     return CALL_ID_COUNTER.getAndIncrement() & Long.MAX_VALUE;
   }
 
-  private int port;
+  private int serverPort;
+  private int adminPort;
+  private int clientPort;
   private final RaftServer server;
   private final List<ThreadPoolExecutor> chunkExecutors;
   private final ContainerDispatcher dispatcher;
@@ -149,14 +155,14 @@ public final class XceiverServerRatis implements XceiverServerSpi {
    */
   private EnumMap<StorageType, List<String>> ratisVolumeMap;
 
-  private XceiverServerRatis(DatanodeDetails dd, int port,
+  private XceiverServerRatis(DatanodeDetails dd,
       ContainerDispatcher dispatcher, ContainerController containerController,
-      StateContext context, GrpcTlsConfig tlsConfig, ConfigurationSource conf)
+      StateContext context, ConfigurationSource conf, Parameters parameters)
       throws IOException {
     this.conf = conf;
     Objects.requireNonNull(dd, "id == null");
     datanodeDetails = dd;
-    this.port = port;
+    assignPorts();
     RaftProperties serverProperties = newRaftProperties();
     this.context = context;
     this.dispatcher = dispatcher;
@@ -173,10 +179,8 @@ public final class XceiverServerRatis implements XceiverServerSpi {
     RaftServer.Builder builder =
         RaftServer.newBuilder().setServerId(raftPeerId)
             .setProperties(serverProperties)
-            .setStateMachineRegistry(this::getStateMachine);
-    if (tlsConfig != null) {
-      builder.setParameters(GrpcFactory.newRaftParameters(tlsConfig));
-    }
+            .setStateMachineRegistry(this::getStateMachine)
+            .setParameters(parameters);
     this.server = builder.build();
     this.requestTimeout = conf.getTimeDuration(
         HddsConfigKeys.HDDS_DATANODE_RATIS_SERVER_REQUEST_TIMEOUT,
@@ -185,6 +189,31 @@ public final class XceiverServerRatis implements XceiverServerSpi {
     initializeRatisVolumeMap();
   }
 
+  private void assignPorts() {
+    clientPort = determinePort(
+        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_PORT,
+        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_PORT_DEFAULT);
+
+    if (datanodeDetails.getInitialVersion() >= SEPARATE_RATIS_PORTS_AVAILABLE) {
+      adminPort = determinePort(
+          OzoneConfigKeys.DFS_CONTAINER_RATIS_ADMIN_PORT,
+          OzoneConfigKeys.DFS_CONTAINER_RATIS_ADMIN_PORT_DEFAULT);
+      serverPort = determinePort(
+          OzoneConfigKeys.DFS_CONTAINER_RATIS_SERVER_PORT,
+          OzoneConfigKeys.DFS_CONTAINER_RATIS_SERVER_PORT_DEFAULT);
+    } else {
+      adminPort = clientPort;
+      serverPort = clientPort;
+    }
+  }
+
+  private int determinePort(String key, int defaultValue) {
+    boolean randomPort = conf.getBoolean(
+        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT,
+        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT_DEFAULT);
+    return randomPort ? 0 : conf.getInt(key, defaultValue);
+  }
+
   private ContainerStateMachine getStateMachine(RaftGroupId gid) {
     return new ContainerStateMachine(gid, dispatcher, containerController,
         chunkExecutors, this, conf);
@@ -262,9 +291,11 @@ public final class XceiverServerRatis implements XceiverServerSpi {
 
     // Set the ratis port number
     if (rpc == SupportedRpcType.GRPC) {
-      GrpcConfigKeys.Server.setPort(properties, port);
+      GrpcConfigKeys.Admin.setPort(properties, adminPort);
+      GrpcConfigKeys.Client.setPort(properties, clientPort);
+      GrpcConfigKeys.Server.setPort(properties, serverPort);
     } else if (rpc == SupportedRpcType.NETTY) {
-      NettyConfigKeys.Server.setPort(properties, port);
+      NettyConfigKeys.Server.setPort(properties, serverPort);
     }
 
     long snapshotThreshold =
@@ -416,71 +447,68 @@ public final class XceiverServerRatis implements XceiverServerSpi {
       DatanodeDetails datanodeDetails, ConfigurationSource ozoneConf,
       ContainerDispatcher dispatcher, ContainerController containerController,
       CertificateClient caClient, StateContext context) throws IOException {
-    int localPort = ozoneConf.getInt(
-        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_PORT,
-        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_PORT_DEFAULT);
+    Parameters parameters = createTlsParameters(
+        new SecurityConfig(ozoneConf), caClient);
 
-    // Get an available port on current node and
-    // use that as the container port
-    if (ozoneConf.getBoolean(OzoneConfigKeys
-            .DFS_CONTAINER_RATIS_IPC_RANDOM_PORT,
-        OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT_DEFAULT)) {
-      localPort = 0;
-    }
-    GrpcTlsConfig tlsConfig = createTlsServerConfigForDN(
-          new SecurityConfig(ozoneConf), caClient);
-
-    return new XceiverServerRatis(datanodeDetails, localPort, dispatcher,
-        containerController, context, tlsConfig, ozoneConf);
+    return new XceiverServerRatis(datanodeDetails, dispatcher,
+        containerController, context, ozoneConf, parameters);
   }
 
   // For gRPC server running DN container service with gPRC TLS
-  // No mTLS as the channel is shared for for external client, which
-  // does not have SCM CA issued certificates.
   // In summary:
   // authenticate from server to client is via TLS.
   // authenticate from client to server is via block token (or container token).
   // DN Ratis server act as both SSL client and server and we must pass TLS
   // configuration for both.
-  static GrpcTlsConfig createTlsServerConfigForDN(SecurityConfig conf,
+  private static Parameters createTlsParameters(SecurityConfig conf,
       CertificateClient caClient) {
+    Parameters parameters = new Parameters();
+
     if (conf.isSecurityEnabled() && conf.isGrpcTlsEnabled()) {
-      return new GrpcTlsConfig(
+      GrpcTlsConfig serverConfig = new GrpcTlsConfig(
+          caClient.getPrivateKey(), caClient.getCertificate(),
+          caClient.getCACertificate(), true);
+      GrpcConfigKeys.Server.setTlsConf(parameters, serverConfig);
+      GrpcConfigKeys.Admin.setTlsConf(parameters, serverConfig);
+
+      GrpcTlsConfig clientConfig = new GrpcTlsConfig(
           caClient.getPrivateKey(), caClient.getCertificate(),
           caClient.getCACertificate(), false);
+      GrpcConfigKeys.Client.setTlsConf(parameters, clientConfig);
     }
-    return null;
+
+    return parameters;
   }
 
   @Override
   public void start() throws IOException {
     if (!isStarted) {
-      LOG.info("Starting {} {} at port {}", getClass().getSimpleName(),
-          server.getId(), getIPCPort());
+      LOG.info("Starting {} {}", getClass().getSimpleName(), server.getId());
       for (ThreadPoolExecutor executor : chunkExecutors) {
         executor.prestartAllCoreThreads();
       }
       server.start();
 
-      int realPort = server.getServerRpc()
-          .getInetSocketAddress()
-          .getPort();
-
-      if (port == 0) {
-        LOG.info("{} {} is started using port {}", getClass().getSimpleName(),
-            server.getId(), realPort);
-        port = realPort;
-      }
-
-      //register the real port to the datanode details.
-      datanodeDetails.setPort(DatanodeDetails
-          .newPort(DatanodeDetails.Port.Name.RATIS,
-              realPort));
+      RaftServerRpc serverRpc = server.getServerRpc();
+      clientPort = getRealPort(serverRpc.getClientServerAddress(),
+          Port.Name.RATIS);
+      adminPort = getRealPort(serverRpc.getAdminServerAddress(),
+          Port.Name.RATIS_ADMIN);
+      serverPort = getRealPort(serverRpc.getInetSocketAddress(),
+          Port.Name.RATIS_SERVER);
 
       isStarted = true;
     }
   }
 
+  private int getRealPort(InetSocketAddress address, Port.Name name) {
+    int realPort = address.getPort();
+    datanodeDetails.setPort(DatanodeDetails.newPort(name, realPort));
+    LOG.info("{} {} is started using port {} for {}",
+        getClass().getSimpleName(), server.getId(), realPort, name);
+    return realPort;
+  }
+
   @Override
   public void stop() {
     if (isStarted) {
@@ -500,7 +528,7 @@ public final class XceiverServerRatis implements XceiverServerSpi {
 
   @Override
   public int getIPCPort() {
-    return port;
+    return clientPort;
   }
 
   /**
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/HddsVolumeUtil.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/HddsVolumeUtil.java
index 41b8788..9d3810e 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/HddsVolumeUtil.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/HddsVolumeUtil.java
@@ -153,8 +153,10 @@ public final class HddsVolumeUtil {
     return lv;
   }
 
-  private static String getProperty(Properties props, String propName, File
-      versionFile)
+  public static String getProperty(
+      Properties props, String propName, File
+      versionFile
+  )
       throws InconsistentStorageStateException {
     String value = props.getProperty(propName);
     if (StringUtils.isBlank(value)) {
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ReferenceCountedDB.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ReferenceCountedDB.java
index 87e4bff..5fe61a8 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ReferenceCountedDB.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ReferenceCountedDB.java
@@ -91,6 +91,7 @@ public class ReferenceCountedDB implements Closeable {
     return store;
   }
 
+  @Override
   public void close() {
     decrementReference();
   }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
index 4b46abb..6760a27 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
@@ -553,6 +553,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
   /**
    * Acquire read lock.
    */
+  @Override
   public void readLock() {
     this.lock.readLock().lock();
 
@@ -561,6 +562,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
   /**
    * Release read lock.
    */
+  @Override
   public void readUnlock() {
     this.lock.readLock().unlock();
   }
@@ -568,6 +570,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
   /**
    * Check if the current thread holds read lock.
    */
+  @Override
   public boolean hasReadLock() {
     return this.lock.readLock().tryLock();
   }
@@ -575,6 +578,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
   /**
    * Acquire write lock.
    */
+  @Override
   public void writeLock() {
     // TODO: The lock for KeyValueContainer object should not be exposed
     // publicly.
@@ -584,6 +588,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
   /**
    * Release write lock.
    */
+  @Override
   public void writeUnlock() {
     this.lock.writeLock().unlock();
 
@@ -592,6 +597,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
   /**
    * Check if the current thread holds write lock.
    */
+  @Override
   public boolean hasWriteLock() {
     return this.lock.writeLock().isHeldByCurrentThread();
   }
@@ -706,6 +712,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
         .getContainerID() + OzoneConsts.DN_CONTAINER_DB);
   }
 
+  @Override
   public boolean scanMetaData() {
     long containerId = containerData.getContainerID();
     KeyValueContainerCheck checker =
@@ -720,6 +727,7 @@ public class KeyValueContainer implements Container<KeyValueContainerData> {
         || containerData.getState() == ContainerDataProto.State.QUASI_CLOSED;
   }
 
+  @Override
   public boolean scanData(DataTransferThrottler throttler, Canceler canceler) {
     if (!shouldScanData()) {
       throw new IllegalStateException("The checksum verification can not be" +
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainerData.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainerData.java
index 5c20e6e..9f93e50 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainerData.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainerData.java
@@ -168,6 +168,7 @@ public class KeyValueContainerData extends ContainerData {
    * Returns the path to base dir of the container.
    * @return Path to base dir
    */
+  @Override
   public String getContainerPath() {
     return new File(metadataPath).getParent();
   }
@@ -175,6 +176,7 @@ public class KeyValueContainerData extends ContainerData {
   /**
    * Returns the blockCommitSequenceId.
    */
+  @Override
   public long getBlockCommitSequenceId() {
     return blockCommitSequenceId;
   }
@@ -248,6 +250,7 @@ public class KeyValueContainerData extends ContainerData {
    *
    * @return Protocol Buffer Message
    */
+  @Override
   public ContainerDataProto getProtoBufMessage() {
     ContainerDataProto.Builder builder = ContainerDataProto.newBuilder();
     builder.setContainerID(this.getContainerID());
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/BlockManagerImpl.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/BlockManagerImpl.java
index 474092e..066a0fd 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/BlockManagerImpl.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/BlockManagerImpl.java
@@ -78,6 +78,7 @@ public class BlockManagerImpl implements BlockManager {
    * @return length of the block.
    * @throws IOException
    */
+  @Override
   public long putBlock(Container container, BlockData data) throws IOException {
     return putBlock(container, data, true);
   }
@@ -91,6 +92,7 @@ public class BlockManagerImpl implements BlockManager {
    * @return length of the block.
    * @throws IOException
    */
+  @Override
   public long putBlock(Container container, BlockData data,
       boolean incrKeyCount) throws IOException {
     Preconditions.checkNotNull(data, "BlockData cannot be null for put " +
@@ -128,8 +130,10 @@ public class BlockManagerImpl implements BlockManager {
               .initBatchOperation()) {
         db.getStore().getBlockDataTable().putWithBatch(
             batch, Long.toString(data.getLocalID()), data);
-        db.getStore().getMetadataTable().putWithBatch(
-            batch, OzoneConsts.BLOCK_COMMIT_SEQUENCE_ID, bcsId);
+        if (bcsId != 0) {
+          db.getStore().getMetadataTable().putWithBatch(
+              batch, OzoneConsts.BLOCK_COMMIT_SEQUENCE_ID, bcsId);
+        }
 
         // Set Bytes used, this bytes used will be updated for every write and
         // only get committed for every put block. In this way, when datanode
@@ -151,7 +155,9 @@ public class BlockManagerImpl implements BlockManager {
         db.getStore().getBatchHandler().commitBatchOperation(batch);
       }
 
-      container.updateBlockCommitSequenceId(bcsId);
+      if (bcsId != 0) {
+        container.updateBlockCommitSequenceId(bcsId);
+      }
       // Increment block count finally here for in-memory.
       if (incrKeyCount) {
         container.getContainerData().incrKeyCount();
@@ -236,6 +242,7 @@ public class BlockManagerImpl implements BlockManager {
    * @param blockID - ID of the block.
    * @throws StorageContainerException
    */
+  @Override
   public void deleteBlock(Container container, BlockID blockID) throws
       IOException {
     Preconditions.checkNotNull(blockID, "block ID cannot be null.");
@@ -318,6 +325,7 @@ public class BlockManagerImpl implements BlockManager {
   /**
    * Shutdown KeyValueContainerManager.
    */
+  @Override
   public void shutdown() {
     BlockUtils.shutdownCache(ContainerCache.getInstance(config));
   }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerChunkStrategy.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerChunkStrategy.java
index ad58935..159b0b2 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerChunkStrategy.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerChunkStrategy.java
@@ -216,6 +216,8 @@ public class FilePerChunkStrategy implements ChunkManager {
     possibleFiles.add(finalChunkFile);
     if (dispatcherContext != null && dispatcherContext.isReadFromTmpFile()) {
       possibleFiles.add(getTmpChunkFile(finalChunkFile, dispatcherContext));
+      // HDDS-2372. Read finalChunkFile after tmpChunkFile to solve race
+      // condition between read and commit.
       possibleFiles.add(finalChunkFile);
     }
 
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaOneDBDefinition.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaOneDBDefinition.java
index 7d5e053..a0d500e 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaOneDBDefinition.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaOneDBDefinition.java
@@ -89,6 +89,7 @@ public class DatanodeSchemaOneDBDefinition
     return DELETED_BLOCKS;
   }
 
+  @Override
   public DBColumnFamilyDefinition[] getColumnFamilies() {
     return new DBColumnFamilyDefinition[] {getBlockDataColumnFamily(),
         getMetadataColumnFamily(), getDeletedBlocksColumnFamily() };
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaTwoDBDefinition.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaTwoDBDefinition.java
index fb66e3d..b72bad1 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaTwoDBDefinition.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaTwoDBDefinition.java
@@ -70,7 +70,7 @@ public class DatanodeSchemaTwoDBDefinition extends
           StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction.class,
           new DeletedBlocksTransactionCodec());
 
-  protected DatanodeSchemaTwoDBDefinition(String dbPath) {
+  public DatanodeSchemaTwoDBDefinition(String dbPath) {
     super(dbPath);
   }
 
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java
index 0b3af00..1744cc0 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java
@@ -75,8 +75,10 @@ public class ContainerReader implements Runnable {
   private final File hddsVolumeDir;
   private final MutableVolumeSet volumeSet;
 
-  ContainerReader(MutableVolumeSet volSet, HddsVolume volume, ContainerSet cset,
-      ConfigurationSource conf) {
+  public ContainerReader(
+      MutableVolumeSet volSet, HddsVolume volume, ContainerSet cset,
+      ConfigurationSource conf
+  ) {
     Preconditions.checkNotNull(volume);
     this.hddsVolume = volume;
     this.hddsVolumeDir = hddsVolume.getHddsRootDir();
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/GrpcReplicationClient.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/GrpcReplicationClient.java
index 53dac9d..271ccff 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/GrpcReplicationClient.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/GrpcReplicationClient.java
@@ -18,14 +18,12 @@
 
 package org.apache.hadoop.ozone.container.replication;
 
-import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UncheckedIOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.security.cert.X509Certificate;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 
@@ -34,6 +32,7 @@ import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.CopyContai
 import org.apache.hadoop.hdds.protocol.datanode.proto.IntraDatanodeProtocolServiceGrpc;
 import org.apache.hadoop.hdds.protocol.datanode.proto.IntraDatanodeProtocolServiceGrpc.IntraDatanodeProtocolServiceStub;
 import org.apache.hadoop.hdds.security.x509.SecurityConfig;
+import org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient;
 import org.apache.hadoop.ozone.OzoneConsts;
 
 import com.google.common.base.Preconditions;
@@ -62,7 +61,7 @@ public class GrpcReplicationClient implements AutoCloseable{
 
   public GrpcReplicationClient(
       String host, int port, Path workingDir,
-      SecurityConfig secConfig, X509Certificate caCert
+      SecurityConfig secConfig, CertificateClient certClient
   ) throws IOException {
     NettyChannelBuilder channelBuilder =
         NettyChannelBuilder.forAddress(host, port)
@@ -73,14 +72,13 @@ public class GrpcReplicationClient implements AutoCloseable{
       channelBuilder.useTransportSecurity();
 
       SslContextBuilder sslContextBuilder = GrpcSslContexts.forClient();
-      if (caCert != null) {
-        sslContextBuilder.trustManager(caCert);
+      if (certClient != null) {
+        sslContextBuilder
+            .trustManager(certClient.getCACertificate())
+            .clientAuth(ClientAuth.REQUIRE)
+            .keyManager(certClient.getPrivateKey(),
+                certClient.getCertificate());
       }
-
-      sslContextBuilder.clientAuth(ClientAuth.REQUIRE);
-      sslContextBuilder.keyManager(
-          new File(secConfig.getCertificateFileName()),
-          new File(secConfig.getPrivateKeyFileName()));
       if (secConfig.useTestCert()) {
         channelBuilder.overrideAuthority("localhost");
       }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
index 8de34cc..c2415ba 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SimpleContainerDownloader.java
@@ -21,7 +21,6 @@ package org.apache.hadoop.ozone.container.replication;
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -31,6 +30,7 @@ import org.apache.hadoop.hdds.conf.ConfigurationSource;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name;
 import org.apache.hadoop.hdds.security.x509.SecurityConfig;
+import org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient;
 import org.apache.hadoop.ozone.OzoneConfigKeys;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -51,11 +51,11 @@ public class SimpleContainerDownloader implements ContainerDownloader {
 
   private final Path workingDirectory;
   private final SecurityConfig securityConfig;
-  private final X509Certificate caCert;
+  private final CertificateClient certClient;
 
   public SimpleContainerDownloader(
       ConfigurationSource conf,
-      X509Certificate caCert
+      CertificateClient certClient
   ) {
 
     String workDirString =
@@ -68,7 +68,7 @@ public class SimpleContainerDownloader implements ContainerDownloader {
       workingDirectory = Paths.get(workDirString);
     }
     securityConfig = new SecurityConfig(conf);
-    this.caCert = caCert;
+    this.certClient = certClient;
   }
 
   @Override
@@ -133,7 +133,7 @@ public class SimpleContainerDownloader implements ContainerDownloader {
     GrpcReplicationClient grpcReplicationClient =
         new GrpcReplicationClient(datanode.getIpAddress(),
             datanode.getPort(Name.REPLICATION).getValue(),
-            workingDirectory, securityConfig, caCert);
+            workingDirectory, securityConfig, certClient);
     result = grpcReplicationClient.download(containerId)
         .thenApply(r -> {
           try {
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CommandForDatanode.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CommandForDatanode.java
index 66bf623..893aa89 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CommandForDatanode.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CommandForDatanode.java
@@ -46,6 +46,7 @@ public class CommandForDatanode<T extends GeneratedMessage> implements
     return command;
   }
 
+  @Override
   public long getId() {
     return command.getId();
   }
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java
index 6115f16..b7e26c0 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java
@@ -59,6 +59,7 @@ public abstract class SCMCommand<T extends GeneratedMessage> implements
    * Gets the commandId of this object.
    * @return uuid.
    */
+  @Override
   public long getId() {
     return id;
   }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/TestStateContext.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/TestStateContext.java
index e9c39d3..67f5073 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/TestStateContext.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/TestStateContext.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.ozone.container.common.statemachine;
 
 import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
+import static org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ClosePipelineInfo;
 import static org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerAction.Action.CLOSE;
 import static org.apache.hadoop.test.GenericTestUtils.waitFor;
 import static org.junit.Assert.assertEquals;
@@ -49,6 +50,7 @@ import com.google.protobuf.Descriptors.Descriptor;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerAction;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineAction;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine.DatanodeStates;
 import org.apache.hadoop.ozone.container.common.states.DatanodeState;
 import org.apache.hadoop.test.LambdaTestUtils;
@@ -392,13 +394,29 @@ public class TestStateContext {
     stateContext.addEndpoint(scm1);
     stateContext.addEndpoint(scm2);
 
+    final ClosePipelineInfo closePipelineInfo = ClosePipelineInfo.newBuilder()
+        .setPipelineID(PipelineID.randomId().getProtobuf())
+        .setReason(ClosePipelineInfo.Reason.PIPELINE_FAILED)
+        .setDetailedReason("Test").build();
+    final PipelineAction pipelineAction = PipelineAction.newBuilder()
+        .setClosePipeline(closePipelineInfo)
+        .setAction(PipelineAction.Action.CLOSE)
+        .build();
+
     // Add PipelineAction. Should be added to all endpoints.
-    stateContext.addPipelineActionIfAbsent(
-        PipelineAction.newBuilder().setAction(
-            PipelineAction.Action.CLOSE).build());
+    stateContext.addPipelineActionIfAbsent(pipelineAction);
+
+    pipelineActions = stateContext.getPendingPipelineAction(scm2, 10);
+    assertEquals(1, pipelineActions.size());
+    // The pipeline action is dequeued from scm2 now, but still in scm1
 
+    // The same pipeline action will not be added if it already exists
+    stateContext.addPipelineActionIfAbsent(pipelineAction);
     pipelineActions = stateContext.getPendingPipelineAction(scm1, 10);
     assertEquals(1, pipelineActions.size());
+    // The pipeline action should have been be added back to the scm2
+    pipelineActions = stateContext.getPendingPipelineAction(scm2, 10);
+    assertEquals(1, pipelineActions.size());
 
     // Add ContainerAction. Should be added to all endpoints.
     stateContext.addContainerAction(ContainerAction.newBuilder()
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/ChunkLayoutTestInfo.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/ChunkLayoutTestInfo.java
index edd3368..55f1f60 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/ChunkLayoutTestInfo.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/ChunkLayoutTestInfo.java
@@ -62,6 +62,7 @@ public enum ChunkLayoutTestInfo {
   },
 
   FILE_PER_CHUNK {
+    @Override
     public ChunkManager createChunkManager(boolean sync, BlockManager manager) {
       return new FilePerChunkStrategy(sync, manager);
     }
@@ -78,6 +79,7 @@ public enum ChunkLayoutTestInfo {
   },
 
   FILE_PER_BLOCK {
+    @Override
     public ChunkManager createChunkManager(boolean sync, BlockManager manager) {
       return new FilePerBlockStrategy(sync);
     }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java
index 3bba85b..51ba01c 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java
@@ -70,8 +70,10 @@ public class TestBlockManagerImpl {
   private KeyValueContainerData keyValueContainerData;
   private KeyValueContainer keyValueContainer;
   private BlockData blockData;
+  private BlockData blockData1;
   private BlockManagerImpl blockManager;
   private BlockID blockID;
+  private BlockID blockID1;
 
   private final ChunkLayOutVersion layout;
 
@@ -120,12 +122,53 @@ public class TestBlockManagerImpl {
     chunkList.add(info.getProtoBufMessage());
     blockData.setChunks(chunkList);
 
+    // Creating BlockData
+    blockID1 = new BlockID(1L, 2L);
+    blockData1 = new BlockData(blockID1);
+    blockData1.addMetadata(OzoneConsts.VOLUME, OzoneConsts.OZONE);
+    blockData1.addMetadata(OzoneConsts.OWNER,
+        OzoneConsts.OZONE_SIMPLE_HDFS_USER);
+    List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+    ChunkInfo info1 = new ChunkInfo(String.format("%d.data.%d", blockID1
+        .getLocalID(), 0), 0, 1024);
+    chunkList1.add(info1.getProtoBufMessage());
+    blockData1.setChunks(chunkList1);
+    blockData1.setBlockCommitSequenceId(1);
+
     // Create KeyValueContainerManager
     blockManager = new BlockManagerImpl(config);
 
   }
 
   @Test
+  public void testPutBlock() throws Exception {
+    assertEquals(0, keyValueContainer.getContainerData().getKeyCount());
+    //Put Block with bcsId != 0
+    blockManager.putBlock(keyValueContainer, blockData1);
+
+    BlockData fromGetBlockData;
+    //Check Container's bcsId
+    fromGetBlockData = blockManager.getBlock(keyValueContainer,
+        blockData1.getBlockID());
+    assertEquals(1, keyValueContainer.getContainerData().getKeyCount());
+    assertEquals(1,
+        keyValueContainer.getContainerData().getBlockCommitSequenceId());
+    assertEquals(1, fromGetBlockData.getBlockCommitSequenceId());
+
+    //Put Block with bcsId == 0
+    blockManager.putBlock(keyValueContainer, blockData);
+
+    //Check Container's bcsId
+    fromGetBlockData = blockManager.getBlock(keyValueContainer,
+        blockData.getBlockID());
+    assertEquals(2, keyValueContainer.getContainerData().getKeyCount());
+    assertEquals(0, fromGetBlockData.getBlockCommitSequenceId());
+    assertEquals(1,
+        keyValueContainer.getContainerData().getBlockCommitSequenceId());
+
+  }
+
+  @Test
   public void testPutAndGetBlock() throws Exception {
     assertEquals(0, keyValueContainer.getContainerData().getKeyCount());
     //Put Block
diff --git a/hadoop-hdds/container-service/src/test/resources/log4j.properties b/hadoop-hdds/container-service/src/test/resources/log4j.properties
index bb5cbe5..3987866 100644
--- a/hadoop-hdds/container-service/src/test/resources/log4j.properties
+++ b/hadoop-hdds/container-service/src/test/resources/log4j.properties
@@ -20,4 +20,4 @@ log4j.rootLogger=INFO,stdout
 log4j.threshold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) - %m%n
diff --git a/hadoop-hdds/docs/content/interface/Cli.md b/hadoop-hdds/docs/content/interface/Cli.md
index d65d573..cbdc499 100644
--- a/hadoop-hdds/docs/content/interface/Cli.md
+++ b/hadoop-hdds/docs/content/interface/Cli.md
@@ -146,7 +146,7 @@ Command examples:
 
 ```shell
 $ ozone sh bucket create /vol1/bucket1
-```shell
+```
 
 ```shell
 $ ozone sh bucket info /vol1/bucket1
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
index 467731e..f4381e0 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
@@ -16,55 +16,52 @@
  */
 package org.apache.hadoop.hdds.scm.protocolPB;
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-
+import com.google.common.base.Preconditions;
+import com.google.protobuf.RpcController;
+import com.google.protobuf.ServiceException;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.GetScmInfoResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SafeModeRuleStatusProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ActivatePipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ClosePipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ContainerResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DatanodeUsageInfoRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DatanodeUsageInfoResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DeactivatePipelineRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DecommissionNodesRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ForceExitSafeModeRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ForceExitSafeModeResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineBatchRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetPipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetPipelineResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.InSafeModeRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ListPipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ListPipelineResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.NodeQueryRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.NodeQueryResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMCloseContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.PipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.PipelineResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ReplicationManagerStatusRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ReplicationManagerStatusResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMCloseContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMDeleteContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMListContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMListContainerResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SafeModeRuleStatusProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationRequest;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationRequest.Builder;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationResponse;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartReplicationManagerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StopReplicationManagerRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DecommissionNodesRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type;
 import org.apache.hadoop.hdds.scm.ScmInfo;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
@@ -78,9 +75,13 @@ import org.apache.hadoop.ipc.ProtobufHelper;
 import org.apache.hadoop.ipc.ProtocolTranslator;
 import org.apache.hadoop.ipc.RPC;
 
-import com.google.common.base.Preconditions;
-import com.google.protobuf.RpcController;
-import com.google.protobuf.ServiceException;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
 
 import static org.apache.hadoop.ozone.ClientVersions.CURRENT_VERSION;
 
@@ -185,6 +186,7 @@ public final class StorageContainerLocationProtocolClientSideTranslatorPB
         response.getContainerWithPipeline());
   }
 
+  @Override
   public ContainerInfo getContainer(long containerID) throws IOException {
     Preconditions.checkState(containerID >= 0,
         "Container ID cannot be negative");
@@ -204,6 +206,7 @@ public final class StorageContainerLocationProtocolClientSideTranslatorPB
   /**
    * {@inheritDoc}
    */
+  @Override
   public ContainerWithPipeline getContainerWithPipeline(long containerID)
       throws IOException {
     Preconditions.checkState(containerID >= 0,
@@ -226,6 +229,7 @@ public final class StorageContainerLocationProtocolClientSideTranslatorPB
   /**
    * {@inheritDoc}
    */
+  @Override
   public List<ContainerWithPipeline> getContainerWithPipelineBatch(
       List<Long> containerIDs) throws IOException {
     for (Long containerID: containerIDs) {
@@ -625,6 +629,32 @@ public final class StorageContainerLocationProtocolClientSideTranslatorPB
 
   }
 
+  /**
+   * Builds request for datanode usage information and receives response.
+   *
+   * @param ipaddress - Address String
+   * @param uuid - UUID String
+   * @return List of DatanodeUsageInfo. Each element contains info such as
+   * capacity, SCMUsed, and remaining space.
+   * @throws IOException
+   */
+  @Override
+  public List<HddsProtos.DatanodeUsageInfo> getDatanodeUsageInfo(
+      String ipaddress, String uuid) throws IOException {
+
+    DatanodeUsageInfoRequestProto request =
+        DatanodeUsageInfoRequestProto.newBuilder()
+            .setIpaddress(ipaddress)
+            .setUuid(uuid)
+            .build();
+
+    DatanodeUsageInfoResponseProto response =
+        submitRequest(Type.DatanodeUsageInfo,
+            builder -> builder.setDatanodeUsageInfoRequest(request))
+            .getDatanodeUsageInfoResponse();
+    return response.getInfoList();
+  }
+
   @Override
   public Object getUnderlyingProxyObject() {
     return rpcProxy;
diff --git a/hadoop-ozone/ozonefs-hadoop2/src/main/java/org/apache/hadoop/fs/ozone/Hadoop27OmTransportFactory.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CRLApprover.java
similarity index 51%
copy from hadoop-ozone/ozonefs-hadoop2/src/main/java/org/apache/hadoop/fs/ozone/Hadoop27OmTransportFactory.java
copy to hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CRLApprover.java
index 66794b2..8632743 100644
--- a/hadoop-ozone/ozonefs-hadoop2/src/main/java/org/apache/hadoop/fs/ozone/Hadoop27OmTransportFactory.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CRLApprover.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -6,33 +6,38 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
  */
-package org.apache.hadoop.fs.ozone;
 
-import java.io.IOException;
+package org.apache.hadoop.hdds.security.x509.certificate.authority;
+
+import org.bouncycastle.cert.X509v2CRLBuilder;
+import org.bouncycastle.operator.OperatorCreationException;
 
-import org.apache.hadoop.hdds.conf.ConfigurationSource;
-import org.apache.hadoop.ozone.om.protocolPB.OmTransport;
-import org.apache.hadoop.ozone.om.protocolPB.OmTransportFactory;
-import org.apache.hadoop.security.UserGroupInformation;
+import java.security.cert.CRLException;
+import java.security.cert.X509CRL;
 
 /**
- * OM Transport factory to create Simple (NON-HA) OM transport client.
+ * CRL Approver interface is used to sign CRLs.
  */
-public class Hadoop27OmTransportFactory implements OmTransportFactory {
+public interface CRLApprover {
 
-  @Override
-  public OmTransport createOmTransport(ConfigurationSource source,
-      UserGroupInformation ugi, String omServiceId) throws IOException {
-    return new Hadoop27RpcTransport(source);
-  }
+  /**
+   * Signs a CRL.
+   * @param builder - CRL builder instance with CRL info to be signed.
+   * @return Signed CRL.
+   * @throws CRLException - On Error
+   * @throws OperatorCreationException - on Error.
+   */
+  X509CRL sign(X509v2CRLBuilder builder)
+      throws CRLException, OperatorCreationException;
 
 }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateServer.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateServer.java
index 80ad04d..57ad0f1 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateServer.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateServer.java
@@ -23,13 +23,17 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType;
 import org.apache.hadoop.hdds.security.exception.SCMSecurityException;
 import org.apache.hadoop.hdds.security.x509.SecurityConfig;
 import org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateApprover.ApprovalType;
+import org.bouncycastle.asn1.x509.CRLReason;
 import org.bouncycastle.cert.X509CertificateHolder;
 import org.bouncycastle.pkcs.PKCS10CertificationRequest;
 
 import java.io.IOException;
+import java.math.BigInteger;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
+import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.Future;
 
 /**
@@ -46,7 +50,7 @@ public interface CertificateServer {
    * @throws SCMSecurityException - Throws if the init fails.
    */
   void init(SecurityConfig securityConfig, CAType type)
-      throws SCMSecurityException;
+      throws IOException;
 
   /**
    * Returns the CA Certificate for this CA.
@@ -103,26 +107,25 @@ public interface CertificateServer {
   /**
    * Revokes a Certificate issued by this CertificateServer.
    *
-   * @param certificate - Certificate to revoke
-   * @param approver - Approval process to follow.
-   * @return Future that tells us what happened.
-   * @throws SCMSecurityException - on Error.
-   */
-  Future<Boolean> revokeCertificate(X509Certificate certificate,
-      ApprovalType approver) throws SCMSecurityException;
-
-  /**
-   * TODO : CRL, OCSP etc. Later. This is the start of a CertificateServer
-   * framework.
+   * @param serialIDs       - List of serial IDs of Certificates to be revoked.
+   * @param reason          - Reason for revocation.
+   * @param securityConfig  - Security Configuration.
+   * @param revocationTime  - Revocation time for the certificates.
+   * @return Future that gives a list of certificates that were revoked.
    */
+  Future<Optional<Long>> revokeCertificates(
+      List<BigInteger> serialIDs,
+      CRLReason reason,
+      Date revocationTime,
+      SecurityConfig securityConfig);
 
   /**
    * List certificates.
    * @param type            - node type: OM/SCM/DN
    * @param startSerialId   - start certificate serial id
    * @param count           - max number of certificates returned in a batch
-   * @return
-   * @throws IOException
+   * @return List of X509 Certificates.
+   * @throws IOException - On Failure
    */
   List<X509Certificate> listCertificate(NodeType type,
       long startSerialId, int count, boolean isRevoked) throws IOException;
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateStore.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateStore.java
index 885d8e3..c9aac75 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateStore.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateStore.java
@@ -20,11 +20,15 @@
 package org.apache.hadoop.hdds.security.x509.certificate.authority;
 
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.bouncycastle.asn1.x509.CRLReason;
+import org.bouncycastle.cert.X509CertificateHolder;
 
 import java.io.IOException;
 import java.math.BigInteger;
 import java.security.cert.X509Certificate;
+import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * This interface allows the DefaultCA to be portable and use different DB
@@ -56,12 +60,26 @@ public interface CertificateStore {
       X509Certificate certificate) throws IOException;
 
   /**
-   * Moves a certificate in a transactional manner from valid certificate to
-   * revoked certificate state.
-   * @param serialID - Serial ID of the certificate.
-   * @throws IOException
+   * Adds the certificates to be revoked to a new CRL and moves all the
+   * certificates in a transactional manner from valid certificate to
+   * revoked certificate state. Returns an empty {@code Optional} instance if
+   * the certificates were invalid / not found / already revoked and no CRL
+   * was generated. Otherwise, returns the newly generated CRL sequence ID.
+   * @param serialIDs - List of Serial IDs of Certificates to be revoked.
+   * @param caCertificateHolder - X509 Certificate Holder of the CA.
+   * @param reason - CRLReason for revocation.
+   * @param revocationTime - Revocation Time for the certificates.
+   * @param approver - CRL approver to sign the CRL.
+   * @return An empty {@code Optional} instance if no CRL was generated.
+   * Otherwise, returns the newly generated CRL sequence ID.
+   * @throws IOException - on failure.
    */
-  void revokeCertificate(BigInteger serialID) throws IOException;
+  Optional<Long> revokeCertificates(List<BigInteger> serialIDs,
+                                    X509CertificateHolder caCertificateHolder,
+                                    CRLReason reason,
+                                    Date revocationTime,
+                                    CRLApprover approver)
+      throws IOException;
 
   /**
    * Deletes an expired certificate from the store. Please note: We don't
@@ -74,9 +92,9 @@ public interface CertificateStore {
   /**
    * Retrieves a Certificate based on the Serial number of that certificate.
    * @param serialID - ID of the certificate.
-   * @param certType
+   * @param certType - Whether its Valid or Revoked certificate.
    * @return X509Certificate
-   * @throws IOException
+   * @throws IOException - on failure.
    */
   X509Certificate getCertificateByID(BigInteger serialID, CertType certType)
       throws IOException;
@@ -88,7 +106,7 @@ public interface CertificateStore {
    * @param count - max number of certs returned.
    * @param certType cert type (valid/revoked).
    * @return list of X509 certificates.
-   * @throws IOException
+   * @throws IOException - on failure.
    */
   List<X509Certificate> listCertificate(HddsProtos.NodeType role,
       BigInteger startSerialID, int count, CertType certType)
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultApprover.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultApprover.java
index 0098fa5..7ea28b6 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultApprover.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultApprover.java
@@ -80,6 +80,7 @@ public class DefaultApprover extends BaseApprover {
    * @throws OperatorCreationException - on Error.
    */
   @SuppressWarnings("ParameterNumber")
+  @Override
   public  X509CertificateHolder sign(
       SecurityConfig config,
       PrivateKey caPrivate,
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCAServer.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCAServer.java
index 80c2d90..d7f9213 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCAServer.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCAServer.java
@@ -21,6 +21,7 @@ package org.apache.hadoop.hdds.security.x509.certificate.authority;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.validator.routines.DomainValidator;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType;
 import org.apache.hadoop.hdds.security.exception.SCMSecurityException;
@@ -32,6 +33,7 @@ import org.apache.hadoop.hdds.security.x509.certificates.utils.SelfSignedCertifi
 import org.apache.hadoop.hdds.security.x509.keys.HDDSKeyGenerator;
 import org.apache.hadoop.hdds.security.x509.keys.KeyCodec;
 import org.apache.hadoop.ozone.OzoneSecurityUtil;
+import org.bouncycastle.asn1.x509.CRLReason;
 import org.bouncycastle.cert.X509CertificateHolder;
 import org.bouncycastle.operator.OperatorCreationException;
 import org.bouncycastle.pkcs.PKCS10CertificationRequest;
@@ -52,12 +54,14 @@ import java.security.spec.InvalidKeySpecException;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Future;
 import java.util.function.Consumer;
 
-import static org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.*;
+import static org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.getCertificationRequest;
 import static org.apache.hadoop.hdds.security.x509.exceptions.CertificateException.ErrorCode.CSR_ERROR;
 
 /**
@@ -121,6 +125,7 @@ public class DefaultCAServer implements CertificateServer {
    */
   private PKIProfile profile;
   private CertificateApprover approver;
+  private CRLApprover crlApprover;
   private CertificateStore store;
 
   /**
@@ -140,7 +145,7 @@ public class DefaultCAServer implements CertificateServer {
 
   @Override
   public void init(SecurityConfig securityConfig, CAType type)
-      throws SCMSecurityException {
+      throws IOException {
     caKeysPath = securityConfig.getKeyLocation(componentName);
     caRootX509Path = securityConfig.getCertificateLocation(componentName);
     this.config = securityConfig;
@@ -150,7 +155,7 @@ public class DefaultCAServer implements CertificateServer {
     profile = new DefaultProfile();
     this.approver = new DefaultApprover(profile, this.config);
 
-    /* In future we will spilt this code to have different kind of CAs.
+    /* In future we will split this code to have different kind of CAs.
      * Right now, we have only self-signed CertificateServer.
      */
 
@@ -159,6 +164,8 @@ public class DefaultCAServer implements CertificateServer {
       Consumer<SecurityConfig> caInitializer =
           processVerificationStatus(status);
       caInitializer.accept(securityConfig);
+      crlApprover = new DefaultCRLApprover(securityConfig,
+          getCAKeys().getPrivate());
       return;
     }
 
@@ -283,20 +290,25 @@ public class DefaultCAServer implements CertificateServer {
   }
 
   @Override
-  public Future<Boolean> revokeCertificate(X509Certificate certificate,
-      CertificateApprover.ApprovalType approverType)
-      throws SCMSecurityException {
-    CompletableFuture<Boolean> revoked = new CompletableFuture<>();
-    if (certificate == null) {
+  public Future<Optional<Long>> revokeCertificates(
+      List<BigInteger> certificates,
+      CRLReason reason,
+      Date revocationTime,
+      SecurityConfig securityConfig) {
+    CompletableFuture<Optional<Long>> revoked = new CompletableFuture<>();
+    if (CollectionUtils.isEmpty(certificates)) {
       revoked.completeExceptionally(new SCMSecurityException(
-          "Certificate cannot be null"));
+          "Certificates cannot be null or empty"));
       return revoked;
     }
     try {
-      store.revokeCertificate(certificate.getSerialNumber());
+      revoked.complete(
+          store.revokeCertificates(certificates,
+              getCACertificate(), reason, revocationTime, crlApprover)
+      );
     } catch (IOException ex) {
       LOG.error("Revoking the certificate failed.", ex.getCause());
-      throw new SCMSecurityException(ex);
+      revoked.completeExceptionally(new SCMSecurityException(ex));
     }
     return revoked;
   }
@@ -358,11 +370,14 @@ public class DefaultCAServer implements CertificateServer {
     boolean keyStatus = checkIfKeysExist();
     boolean certStatus = checkIfCertificatesExist();
 
+    // Check if both certStatus and keyStatus is set to true and return success.
     if ((certStatus == keyStatus) && (certStatus)) {
       return VerificationStatus.SUCCESS;
     }
 
-    if ((certStatus == keyStatus) && (!certStatus)) {
+    // At this point both certStatus and keyStatus should be false if they
+    // are equal
+    if ((certStatus == keyStatus)) {
       return VerificationStatus.INITIALIZE;
     }
 
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCRLApprover.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCRLApprover.java
new file mode 100644
index 0000000..683905a
--- /dev/null
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/DefaultCRLApprover.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.hadoop.hdds.security.x509.certificate.authority;
+
+import org.apache.hadoop.hdds.security.x509.SecurityConfig;
+import org.apache.hadoop.hdds.security.x509.certificate.utils.CRLCodec;
+import org.bouncycastle.cert.X509CRLHolder;
+import org.bouncycastle.cert.X509v2CRLBuilder;
+import org.bouncycastle.operator.OperatorCreationException;
+import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+
+import java.security.PrivateKey;
+import java.security.cert.CRLException;
+import java.security.cert.X509CRL;
+
+/**
+ * Default CRL Approver used by the DefaultCA.
+ */
+public class DefaultCRLApprover implements CRLApprover {
+
+  private SecurityConfig config;
+  private PrivateKey caPrivate;
+
+  public DefaultCRLApprover(SecurityConfig config, PrivateKey caPrivate) {
+    this.config = config;
+    this.caPrivate = caPrivate;
+  }
+
+  @Override
+  public X509CRL sign(X509v2CRLBuilder builder)
+      throws CRLException, OperatorCreationException {
+    JcaContentSignerBuilder contentSignerBuilder =
+        new JcaContentSignerBuilder(config.getSignatureAlgo());
+
+    contentSignerBuilder.setProvider(config.getProvider());
+    X509CRLHolder crlHolder =
+        builder.build(contentSignerBuilder.build(caPrivate));
+
+    return CRLCodec.getX509CRL(crlHolder);
+  }
+}
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DNCertificateClient.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DNCertificateClient.java
index e95a4a7..40c5b0a 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DNCertificateClient.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DNCertificateClient.java
@@ -60,6 +60,7 @@ public class DNCertificateClient extends DefaultCertificateClient {
         .setDigitalSignature(true);
   }
 
+  @Override
   public Logger getLogger() {
     return LOG;
   }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/OMCertificateClient.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/OMCertificateClient.java
index cb3ce75..2e1b204 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/OMCertificateClient.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/OMCertificateClient.java
@@ -50,6 +50,7 @@ public class OMCertificateClient extends DefaultCertificateClient {
     super(securityConfig, LOG, null, COMPONENT_NAME);
   }
 
+  @Override
   protected InitResponse handleCase(InitCase init) throws
       CertificateException {
     switch (init) {
@@ -119,6 +120,7 @@ public class OMCertificateClient extends DefaultCertificateClient {
   }
 
 
+  @Override
   public Logger getLogger() {
     return LOG;
   }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificates/utils/CertificateSignRequest.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificates/utils/CertificateSignRequest.java
index bee64e1..b26ad2c 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificates/utils/CertificateSignRequest.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificates/utils/CertificateSignRequest.java
@@ -190,7 +190,7 @@ public final class CertificateSignRequest {
       return this;
     }
 
-    // Support SAN extenion with DNS and RFC822 Name
+    // Support SAN extension with DNS and RFC822 Name
     // other name type will be added as needed.
     public CertificateSignRequest.Builder addDnsName(String dnsName) {
       Preconditions.checkNotNull(dnsName, "dnsName cannot be null");
@@ -198,6 +198,18 @@ public final class CertificateSignRequest {
       return this;
     }
 
+    public boolean hasDnsName() {
+      if (altNames == null || altNames.isEmpty()) {
+        return false;
+      }
+      for (GeneralName name : altNames) {
+        if (name.getTagNo() == GeneralName.dNSName) {
+          return true;
+        }
+      }
+      return false;
+    }
+
     // IP address is subject to change which is optional for now.
     public CertificateSignRequest.Builder addIpAddress(String ip) {
       Preconditions.checkNotNull(ip, "Ip address cannot be null");
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/crl/CRLInfo.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/crl/CRLInfo.java
new file mode 100644
index 0000000..f137adc
--- /dev/null
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/crl/CRLInfo.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.security.x509.crl;
+
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.exception.SCMSecurityException;
+import org.apache.hadoop.hdds.security.x509.certificate.utils.CRLCodec;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.IOException;
+import java.security.cert.CRLException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509CRL;
+import java.util.Comparator;
+import java.util.Objects;
+
+/**
+ * Class that wraps Certificate Revocation List Info.
+ */
+public class CRLInfo implements Comparator<CRLInfo>,
+    Comparable<CRLInfo> {
+
+  private X509CRL x509CRL;
+  private long creationTimestamp;
+
+  private CRLInfo(X509CRL x509CRL, long creationTimestamp) {
+    this.x509CRL = x509CRL;
+    this.creationTimestamp = creationTimestamp;
+  }
+
+  /**
+   * Constructor for CRLInfo. Needed for serialization findbugs.
+   */
+  public CRLInfo() {
+  }
+
+  public static CRLInfo fromProtobuf(HddsProtos.CRLInfoProto info)
+      throws IOException, CRLException, CertificateException {
+    CRLInfo.Builder builder = new CRLInfo.Builder();
+    return builder
+        .setX509CRL(CRLCodec.getX509CRL(info.getX509CRL()))
+        .setCreationTimestamp(info.getCreationTimestamp())
+        .build();
+  }
+
+  public HddsProtos.CRLInfoProto getProtobuf() throws SCMSecurityException {
+    HddsProtos.CRLInfoProto.Builder builder =
+        HddsProtos.CRLInfoProto.newBuilder();
+
+    return builder.setX509CRL(CRLCodec.getPEMEncodedString(getX509CRL()))
+        .setCreationTimestamp(getCreationTimestamp())
+        .build();
+  }
+
+  public X509CRL getX509CRL() {
+    return x509CRL;
+  }
+
+  public long getCreationTimestamp() {
+    return creationTimestamp;
+  }
+
+  /**
+   * Compares this object with the specified object for order.  Returns a
+   * negative integer, zero, or a positive integer as this object is less
+   * than, equal to, or greater than the specified object.
+   *
+   * @param o the object to be compared.
+   * @return a negative integer, zero, or a positive integer as this object
+   * is less than, equal to, or greater than the specified object.
+   * @throws NullPointerException if the specified object is null
+   * @throws ClassCastException   if the specified object's type prevents it
+   *                              from being compared to this object.
+   */
+  @Override
+  public int compareTo(@NotNull CRLInfo o) {
+    return this.compare(this, o);
+  }
+
+  /**
+   * Compares its two arguments for order.  Returns a negative integer,
+   * zero, or a positive integer as the first argument is less than, equal
+   * to, or greater than the second.<p>
+   * <p>
+   *
+   * @param o1 the first object to be compared.
+   * @param o2 the second object to be compared.
+   * @return a negative integer, zero, or a positive integer as the
+   * first argument is less than, equal to, or greater than the
+   * second.
+   * @throws NullPointerException if an argument is null and this
+   *                              comparator does not permit null arguments
+   * @throws ClassCastException   if the arguments' types prevent them from
+   *                              being compared by this comparator.
+   */
+  @Override
+  public int compare(CRLInfo o1, CRLInfo o2) {
+    return Long.compare(o1.getCreationTimestamp(), o2.getCreationTimestamp());
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+
+    CRLInfo that = (CRLInfo) o;
+
+    return this.getX509CRL().equals(that.x509CRL) &&
+        this.creationTimestamp == that.creationTimestamp;
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(getX509CRL(), getCreationTimestamp());
+  }
+
+  @Override
+  public String toString() {
+    return "CRLInfo{" +
+        "x509CRL=" + x509CRL.toString() +
+        ", creationTimestamp=" + creationTimestamp +
+        '}';
+  }
+
+  /**
+   * Builder class for CRLInfo.
+   */
+  @SuppressWarnings("checkstyle:hiddenfield")
+  public static class Builder {
+    private X509CRL x509CRL;
+    private long creationTimestamp;
+
+    public Builder setX509CRL(X509CRL x509CRL) {
+      this.x509CRL = x509CRL;
+      return this;
+    }
+
+    public Builder setCreationTimestamp(long creationTimestamp) {
+      this.creationTimestamp = creationTimestamp;
+      return this;
+    }
+
+    public CRLInfo build() {
+      return new CRLInfo(x509CRL, creationTimestamp);
+    }
+  }
+}
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/crl/package-info.java
similarity index 69%
copy from hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
copy to hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/crl/package-info.java
index 8ca5d18..9f768a3 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/crl/package-info.java
@@ -5,23 +5,19 @@
  * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
-package org.apache.hadoop.hdds.utils.db;
 
 /**
- * Class represents a batch operation, collects multiple db operation.
+ * This package contains the common routines used for maintaining Certificate
+ * Revocation Lists.
  */
-public interface BatchOperation extends AutoCloseable {
-
-  void close();
-}
+package org.apache.hadoop.hdds.security.x509.crl;
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointMetrics.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointMetrics.java
new file mode 100644
index 0000000..87dc882
--- /dev/null
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointMetrics.java
@@ -0,0 +1,95 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdds.utils;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metric;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.MutableCounterLong;
+import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
+
+
+/**
+ * This interface is for maintaining DB checkpoint statistics.
+ */
+@InterfaceAudience.Private
+@Metrics(about="DB checkpoint Metrics", context="dfs")
+public class DBCheckpointMetrics {
+  private static final String SOURCE_NAME =
+      DBCheckpointMetrics.class.getSimpleName();
+
+  // Metrics to track checkpoint statistics from last run.
+  private @Metric MutableGaugeLong lastCheckpointCreationTimeTaken;
+  private @Metric MutableGaugeLong lastCheckpointStreamingTimeTaken;
+  private @Metric MutableCounterLong numCheckpoints;
+  private @Metric MutableCounterLong numCheckpointFails;
+
+  public DBCheckpointMetrics() {
+  }
+
+  public static DBCheckpointMetrics create(String parent) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE_NAME,
+        parent,
+        new DBCheckpointMetrics());
+  }
+
+  @VisibleForTesting
+  public void setLastCheckpointCreationTimeTaken(long val) {
+    this.lastCheckpointCreationTimeTaken.set(val);
+  }
+
+  @VisibleForTesting
+  public void setLastCheckpointStreamingTimeTaken(long val) {
+    this.lastCheckpointStreamingTimeTaken.set(val);
+  }
+
+  @VisibleForTesting
+  public void incNumCheckpoints() {
+    numCheckpoints.incr();
+  }
+
+  @VisibleForTesting
+  public void incNumCheckpointFails() {
+    numCheckpointFails.incr();
+  }
+
+  @VisibleForTesting
+  public long getLastCheckpointCreationTimeTaken() {
+    return lastCheckpointCreationTimeTaken.value();
+  }
+
+  @VisibleForTesting
+  public long getNumCheckpoints() {
+    return numCheckpoints.value();
+  }
+
+  @VisibleForTesting
+  public long getNumCheckpointFails() {
+    return numCheckpointFails.value();
+  }
+
+  @VisibleForTesting
+  public long getLastCheckpointStreamingTimeTaken() {
+    return lastCheckpointStreamingTimeTaken.value();
+  }
+}
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointServlet.java
similarity index 68%
copy from hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java
copy to hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointServlet.java
index dcb5392..f1ab608 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointServlet.java
@@ -6,17 +6,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-package org.apache.hadoop.ozone.om;
+package org.apache.hadoop.hdds.utils;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -34,11 +33,8 @@ import java.util.Collection;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
 import org.apache.hadoop.hdds.utils.db.DBStore;
-import org.apache.hadoop.hdfs.util.DataTransferThrottler;
-import org.apache.hadoop.ozone.OzoneConsts;
 
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ArchiveOutputStream;
@@ -56,74 +52,48 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * 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 user name to
- * `ozone.administrator`, e.g. `scm`
+ * Provides the current checkpoint Snapshot of the OM/SCM DB. (tar.gz)
  */
-public class OMDBCheckpointServlet extends HttpServlet {
+public class DBCheckpointServlet extends HttpServlet {
 
   private static final Logger LOG =
-      LoggerFactory.getLogger(OMDBCheckpointServlet.class);
+      LoggerFactory.getLogger(DBCheckpointServlet.class);
   private static final long serialVersionUID = 1L;
 
-  private transient OzoneManager om;
-  private transient DBStore omDbStore;
-  private transient OMMetrics omMetrics;
-  private transient DataTransferThrottler throttler = null;
+  private transient DBStore dbStore;
+  private transient DBCheckpointMetrics dbMetrics;
 
-  @Override
-  public void init() throws ServletException {
+  private boolean aclEnabled;
+  private Collection<String> ozAdmins;
 
-    om = (OzoneManager) getServletContext()
-        .getAttribute(OzoneConsts.OM_CONTEXT_ATTRIBUTE);
+  public void initialize(DBStore store, DBCheckpointMetrics metrics,
+      boolean omAclEnabled, Collection<String> ozoneAdmins)
+      throws ServletException {
 
-    if (om == null) {
-      LOG.error("Unable to initialize OMDBCheckpointServlet. OM is null");
-      return;
+    dbStore = store;
+    dbMetrics = metrics;
+    if (dbStore == null) {
+      LOG.error(
+          "Unable to set metadata snapshot request. DB Store is null");
     }
 
-    omDbStore = om.getMetadataManager().getStore();
-    omMetrics = om.getMetrics();
-
-    OzoneConfiguration configuration = om.getConfiguration();
-    long transferBandwidth = configuration.getLongBytes(
-        OMConfigKeys.OZONE_DB_CHECKPOINT_TRANSFER_RATE_KEY,
-        OMConfigKeys.OZONE_DB_CHECKPOINT_TRANSFER_RATE_DEFAULT);
-
-    if (transferBandwidth > 0) {
-      throttler = new DataTransferThrottler(transferBandwidth);
-    }
+    this.aclEnabled = omAclEnabled;
+    this.ozAdmins = ozoneAdmins;
   }
 
   private boolean hasPermission(String username) {
     // Check ACL for dbCheckpoint only when global Ozone ACL is enabled
-    if (om.getAclsEnabled()) {
+    if (aclEnabled) {
       // Only Ozone admins are allowed
-      try {
-        Collection<String> admins = om.getOzoneAdmins(om.getConfiguration());
-        if (admins.contains(OZONE_ADMINISTRATORS_WILDCARD) ||
-            admins.contains(username)) {
-          return true;
-        }
-      } catch (IOException e) {
-        LOG.warn("Error checking permission: {}", e.getMessage());
-      }
-      return false;
+      return ozAdmins.contains(OZONE_ADMINISTRATORS_WILDCARD)
+          || ozAdmins.contains(username);
     } else {
       return true;
     }
   }
 
   /**
-   * Process a GET request for the Ozone Manager DB checkpoint snapshot.
+   * Process a GET request for the DB checkpoint snapshot.
    *
    * @param request  The servlet request we are processing
    * @param response The servlet response we are creating
@@ -131,8 +101,8 @@ public class OMDBCheckpointServlet extends HttpServlet {
   @Override
   public void doGet(HttpServletRequest request, HttpServletResponse response) {
 
-    LOG.info("Received request to obtain OM DB checkpoint snapshot");
-    if (omDbStore == null) {
+    LOG.info("Received request to obtain DB checkpoint snapshot");
+    if (dbStore == null) {
       LOG.error(
           "Unable to process metadata snapshot request. DB Store is null");
       response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -140,12 +110,12 @@ public class OMDBCheckpointServlet extends HttpServlet {
     }
 
     // Check ACL for dbCheckpoint only when global Ozone ACL is enable
-    if (om.getAclsEnabled()) {
+    if (aclEnabled) {
       final java.security.Principal userPrincipal = request.getUserPrincipal();
       if (userPrincipal == null) {
         final String remoteUser = request.getRemoteUser();
         LOG.error("Permission denied: Unauthorized access to /dbCheckpoint,"
-            + " no user principal found. Current login user is {}.",
+                + " no user principal found. Current login user is {}.",
             remoteUser != null ? "'" + remoteUser + "'" : "UNKNOWN");
         response.setStatus(HttpServletResponse.SC_FORBIDDEN);
         return;
@@ -153,10 +123,11 @@ public class OMDBCheckpointServlet extends HttpServlet {
         final String userPrincipalName = userPrincipal.getName();
         if (!hasPermission(userPrincipalName)) {
           LOG.error("Permission denied: User principal '{}' does not have"
-              + " access to /dbCheckpoint.\nThis can happen when Ozone Manager"
-              + " is started with a different user.\nPlease append '{}' to OM"
-              + " 'ozone.administrators' config and restart OM to grant current"
-              + " user access to this endpoint.",
+                  + " access to /dbCheckpoint.\nThis can happen when Ozone"
+                  + " Manager is started with a different user.\n"
+                  + " Please append '{}' to OM 'ozone.administrators'"
+                  + " config and restart OM to grant current"
+                  + " user access to this endpoint.",
               userPrincipalName, userPrincipalName);
           response.setStatus(HttpServletResponse.SC_FORBIDDEN);
           return;
@@ -176,14 +147,14 @@ public class OMDBCheckpointServlet extends HttpServlet {
         flush = Boolean.valueOf(flushParam);
       }
 
-      checkpoint = omDbStore.getCheckpoint(flush);
+      checkpoint = dbStore.getCheckpoint(flush);
       if (checkpoint == null || checkpoint.getCheckpointLocation() == null) {
         LOG.error("Unable to process metadata snapshot request. " +
             "Checkpoint request returned null.");
         response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         return;
       }
-      omMetrics.setLastCheckpointCreationTimeTaken(
+      dbMetrics.setLastCheckpointCreationTimeTaken(
           checkpoint.checkpointCreationTimeTaken());
 
       Path file = checkpoint.getCheckpointLocation().getFileName();
@@ -196,20 +167,20 @@ public class OMDBCheckpointServlet extends HttpServlet {
                file.toString() + ".tgz\"");
 
       Instant start = Instant.now();
-      writeOmDBCheckpointToStream(checkpoint,
+      writeDBCheckpointToStream(checkpoint,
           response.getOutputStream());
       Instant end = Instant.now();
 
       long duration = Duration.between(start, end).toMillis();
       LOG.info("Time taken to write the checkpoint to response output " +
           "stream: {} milliseconds", duration);
-      omMetrics.setLastCheckpointStreamingTimeTaken(duration);
-      omMetrics.incNumCheckpoints();
+      dbMetrics.setLastCheckpointStreamingTimeTaken(duration);
+      dbMetrics.incNumCheckpoints();
     } catch (Exception e) {
       LOG.error(
           "Unable to process metadata snapshot request. ", e);
       response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-      omMetrics.incNumCheckpointFails();
+      dbMetrics.incNumCheckpointFails();
     } finally {
       if (checkpoint != null) {
         try {
@@ -223,13 +194,13 @@ public class OMDBCheckpointServlet extends HttpServlet {
   }
 
   /**
-   * Write OM DB Checkpoint to an output stream as a compressed file (tgz).
+   * Write DB Checkpoint to an output stream as a compressed file (tgz).
    *
    * @param checkpoint  checkpoint file
    * @param destination desination output stream.
    * @throws IOException
    */
-  public static void writeOmDBCheckpointToStream(DBCheckpoint checkpoint,
+  public static void writeDBCheckpointToStream(DBCheckpoint checkpoint,
       OutputStream destination)
       throws IOException {
 
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HddsServerUtil.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HddsServerUtil.java
index ed5631b..9e6ef22 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HddsServerUtil.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HddsServerUtil.java
@@ -81,9 +81,13 @@ import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HEARTBEAT_RPC_T
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HEARTBEAT_RPC_TIMEOUT_DEFAULT;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HEARTBEAT_RPC_RETRY_COUNT;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HEARTBEAT_RPC_RETRY_COUNT_DEFAULT;
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HEARTBEAT_RPC_RETRY_INTERVAL;
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HEARTBEAT_RPC_RETRY_INTERVAL_DEFAULT;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL_DEFAULT;
 import static org.apache.hadoop.hdds.server.ServerUtils.sanitizeUserArgs;
+
+import org.rocksdb.RocksDBException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -354,6 +358,18 @@ public final class HddsServerUtil {
   }
 
   /**
+   * Fixed datanode rpc retry interval, which is used by datanode to connect
+   * the SCM.
+   *
+   * @param conf - Ozone Config
+   * @return - Rpc retry interval.
+   */
+  public static long getScmRpcRetryInterval(ConfigurationSource conf) {
+    return conf.getTimeDuration(OZONE_SCM_HEARTBEAT_RPC_RETRY_INTERVAL,
+        OZONE_SCM_HEARTBEAT_RPC_RETRY_INTERVAL_DEFAULT, TimeUnit.MILLISECONDS);
+  }
+
+  /**
    * Log Warn interval.
    *
    * @param conf - Ozone Config
@@ -548,4 +564,20 @@ public final class HddsServerUtil {
     }
     archiveOutputStream.closeArchiveEntry();
   }
+
+  /**
+   * Converts RocksDB exception to IOE.
+   * @param msg  - Message to add to exception.
+   * @param e - Original Exception.
+   * @return  IOE.
+   */
+  public static IOException toIOException(String msg, RocksDBException e) {
+    String statusCode = e.getStatus() == null ? "N/A" :
+        e.getStatus().getCodeString();
+    String errMessage = e.getMessage() == null ? "Unknown error" :
+        e.getMessage();
+    String output = msg + "; status : " + statusCode
+        + "; message : " + errMessage;
+    return new IOException(output, e);
+  }
 }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStore.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStore.java
index b399b49..97c267f 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStore.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStore.java
@@ -45,6 +45,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.hadoop.hdds.utils.HddsServerUtil.toIOException;
+
 /**
  * RocksDB implementation of ozone metadata store.
  */
@@ -97,16 +99,6 @@ public class RocksDBStore implements MetadataStore {
     }
   }
 
-  public static IOException toIOException(String msg, RocksDBException e) {
-    String statusCode = e.getStatus() == null ? "N/A" :
-        e.getStatus().getCodeString();
-    String errMessage = e.getMessage() == null ? "Unknown error" :
-        e.getMessage();
-    String output = msg + "; status : " + statusCode
-        + "; message : " + errMessage;
-    return new IOException(output, e);
-  }
-
   @Override
   public void put(byte[] key, byte[] value) throws IOException {
     try {
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
index 8ca5d18..849f226 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/BatchOperation.java
@@ -23,5 +23,6 @@ package org.apache.hadoop.hdds.utils.db;
  */
 public interface BatchOperation extends AutoCloseable {
 
+  @Override
   void close();
 }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/ByteArrayKeyValue.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/ByteArrayKeyValue.java
index 7c60291..48db1a2 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/ByteArrayKeyValue.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/ByteArrayKeyValue.java
@@ -48,6 +48,7 @@ public final class ByteArrayKeyValue implements KeyValue<byte[], byte[]> {
    *
    * @return byte[]
    */
+  @Override
   public byte[] getKey() {
     byte[] result = new byte[key.length];
     System.arraycopy(key, 0, result, 0, key.length);
@@ -59,6 +60,7 @@ public final class ByteArrayKeyValue implements KeyValue<byte[], byte[]> {
    *
    * @return byte[]
    */
+  @Override
   public byte[] getValue() {
     byte[] result = new byte[value.length];
     System.arraycopy(value, 0, result, 0, value.length);
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBConfigFromFile.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBConfigFromFile.java
index 5508010..50ac54f 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBConfigFromFile.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBConfigFromFile.java
@@ -35,6 +35,8 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
 
+import static org.apache.hadoop.hdds.utils.HddsServerUtil.toIOException;
+
 /**
  * A Class that controls the standard config options of RocksDB.
  * <p>
@@ -134,7 +136,7 @@ public final class DBConfigFromFile {
               env, options, cfDescs, true);
 
         } catch (RocksDBException rdEx) {
-          RDBTable.toIOException("Unable to find/open Options file.", rdEx);
+          toIOException("Unable to find/open Options file.", rdEx);
         }
       }
     }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCheckpointManager.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCheckpointManager.java
index f70d63a..1879364 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCheckpointManager.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCheckpointManager.java
@@ -38,7 +38,7 @@ public class RDBCheckpointManager {
 
   private final Checkpoint checkpoint;
   private final RocksDB db;
-  public static final String RDB_CHECKPOINT_DIR_PREFIX = "rdb_checkpoint_";
+  public static final String RDB_CHECKPOINT_DIR_PREFIX = "checkpoint_";
   private static final Logger LOG =
       LoggerFactory.getLogger(RDBCheckpointManager.class);
   private String checkpointNamePrefix = "";
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBMetrics.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBMetrics.java
index d5d1f36..e4140c4 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBMetrics.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBMetrics.java
@@ -101,7 +101,7 @@ public class RDBMetrics {
     return numDBKeyMayExistMisses.value();
   }
 
-  public static void unRegister() {
+  public static synchronized void unRegister() {
     instance = null;
     MetricsSystem ms = DefaultMetricsSystem.instance();
     ms.unregisterSource(SOURCE_NAME);
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
index 252363c..c67238d 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
@@ -50,6 +50,8 @@ import org.rocksdb.WriteOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.hdds.utils.HddsServerUtil.toIOException;
+
 /**
  * RocksDB Store that supports creating Tables in DB.
  */
@@ -148,7 +150,7 @@ public class RDBStore implements DBStore {
       }
 
       //Initialize checkpoint manager
-      checkPointManager = new RDBCheckpointManager(db, "rdb");
+      checkPointManager = new RDBCheckpointManager(db, dbLocation.getName());
       rdbMetrics = RDBMetrics.create();
 
     } catch (RocksDBException e) {
@@ -189,16 +191,6 @@ public class RDBStore implements DBStore {
     return columnFamiliesInDb;
   }
 
-  public static IOException toIOException(String msg, RocksDBException e) {
-    String statusCode = e.getStatus() == null ? "N/A" :
-        e.getStatus().getCodeString();
-    String errMessage = e.getMessage() == null ? "Unknown error" :
-        e.getMessage();
-    String output = msg + "; status : " + statusCode
-        + "; message : " + errMessage;
-    return new IOException(output, e);
-  }
-
   @Override
   public void compactDB() throws IOException {
     if (db != null) {
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
index 878a1f2..3e28170 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
@@ -39,6 +39,8 @@ import org.apache.hadoop.hdds.utils.MetadataKeyFilters;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.hdds.utils.HddsServerUtil.toIOException;
+
 /**
  * RocksDB implementation of ozone metadata store. This class should be only
  * used as part of TypedTable as it's underlying implementation to access the
@@ -72,22 +74,6 @@ class RDBTable implements Table<byte[], byte[]> {
   }
 
   /**
-   * Converts RocksDB exception to IOE.
-   * @param msg  - Message to add to exception.
-   * @param e - Original Exception.
-   * @return  IOE.
-   */
-  public static IOException toIOException(String msg, RocksDBException e) {
-    String statusCode = e.getStatus() == null ? "N/A" :
-        e.getStatus().getCodeString();
-    String errMessage = e.getMessage() == null ? "Unknown error" :
-        e.getMessage();
-    String output = msg + "; status : " + statusCode
-        + "; message : " + errMessage;
-    return new IOException(output, e);
-  }
-
-  /**
    * Returns the Column family Handle.
    *
    * @return ColumnFamilyHandle.
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java
index b7eb096..0f26306 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java
@@ -308,6 +308,7 @@ public class TypedTable<KEY, VALUE> implements Table<KEY, VALUE> {
     return cache.get(cacheKey);
   }
 
+  @Override
   public Iterator<Map.Entry<CacheKey<KEY>, CacheValue<VALUE>>> cacheIterator() {
     return cache.iterator();
   }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/EpochEntry.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/EpochEntry.java
index 00ffc1d..d87e90d 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/EpochEntry.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/EpochEntry.java
@@ -61,6 +61,7 @@ public class EpochEntry<CACHEKEY> implements Comparable<CACHEKEY> {
     return Objects.hash(epoch, cachekey);
   }
 
+  @Override
   public int compareTo(Object o) {
     if(this.epoch == ((EpochEntry<?>)o).epoch) {
       return 0;
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/FullTableCache.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/FullTableCache.java
index 2754b59..9378393 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/FullTableCache.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/FullTableCache.java
@@ -110,6 +110,7 @@ public class FullTableCache<CACHEKEY extends CacheKey,
     }
   }
 
+  @Override
   public void cleanup(List<Long> epochs) {
     executorService.execute(() -> evictCache(epochs));
   }
@@ -125,6 +126,7 @@ public class FullTableCache<CACHEKEY extends CacheKey,
   }
 
   @VisibleForTesting
+  @Override
   public void evictCache(List<Long> epochs) {
     EpochEntry<CACHEKEY> currentEntry;
     CACHEKEY cachekey;
@@ -165,6 +167,7 @@ public class FullTableCache<CACHEKEY extends CacheKey,
     }
   }
 
+  @Override
   public CacheResult<CACHEVALUE> lookup(CACHEKEY cachekey) {
 
     CACHEVALUE cachevalue = cache.get(cachekey);
@@ -183,6 +186,7 @@ public class FullTableCache<CACHEKEY extends CacheKey,
   }
 
   @VisibleForTesting
+  @Override
   public Set<EpochEntry<CACHEKEY>> getEpochEntrySet() {
     return epochEntries;
   }
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/PartialTableCache.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/PartialTableCache.java
index 0bf03c5..8db9e0c 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/PartialTableCache.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/PartialTableCache.java
@@ -95,6 +95,7 @@ public class PartialTableCache<CACHEKEY extends CacheKey,
     epochEntries.add(new EpochEntry<>(value.getEpoch(), cacheKey));
   }
 
+  @Override
   public void cleanup(List<Long> epochs) {
     executorService.execute(() -> evictCache(epochs));
   }
@@ -110,6 +111,7 @@ public class PartialTableCache<CACHEKEY extends CacheKey,
   }
 
   @VisibleForTesting
+  @Override
   public void evictCache(List<Long> epochs) {
     EpochEntry<CACHEKEY> currentEntry;
     CACHEKEY cachekey;
@@ -147,6 +149,7 @@ public class PartialTableCache<CACHEKEY extends CacheKey,
     }
   }
 
+  @Override
   public CacheResult<CACHEVALUE> lookup(CACHEKEY cachekey) {
 
     CACHEVALUE cachevalue = cache.get(cachekey);
@@ -163,6 +166,7 @@ public class PartialTableCache<CACHEKEY extends CacheKey,
     }
   }
 
+  @Override
   @VisibleForTesting
   public Set<EpochEntry<CACHEKEY>> getEpochEntrySet() {
     return epochEntries;
diff --git a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/MockCAStore.java b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/MockCAStore.java
index b5af29e..da5fe0c 100644
--- a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/MockCAStore.java
+++ b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/MockCAStore.java
@@ -20,12 +20,15 @@
 package org.apache.hadoop.hdds.security.x509.certificate.authority;
 
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-
+import org.bouncycastle.asn1.x509.CRLReason;
+import org.bouncycastle.cert.X509CertificateHolder;
 import java.io.IOException;
 import java.math.BigInteger;
 import java.security.cert.X509Certificate;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 
 /**
  *
@@ -46,8 +49,13 @@ public class MockCAStore implements CertificateStore {
   }
 
   @Override
-  public void revokeCertificate(BigInteger serialID) throws IOException {
-
+  public Optional<Long> revokeCertificates(
+      List<BigInteger> serialIDs,
+      X509CertificateHolder caCertificateHolder,
+      CRLReason reason,
+      Date revocationTime,
+      CRLApprover approver) throws IOException {
+    return Optional.empty();
   }
 
   @Override
diff --git a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/TestDefaultCAServer.java b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/TestDefaultCAServer.java
index 23eeaa5..79ff3a5 100644
--- a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/TestDefaultCAServer.java
+++ b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/authority/TestDefaultCAServer.java
@@ -26,7 +26,10 @@ import org.apache.hadoop.hdds.security.x509.SecurityConfig;
 import org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest;
 import org.apache.hadoop.hdds.security.x509.keys.HDDSKeyGenerator;
 import org.apache.hadoop.test.LambdaTestUtils;
+
+import org.bouncycastle.asn1.x509.CRLReason;
 import org.bouncycastle.cert.X509CertificateHolder;
+import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
 import org.bouncycastle.pkcs.PKCS10CertificationRequest;
 import org.junit.Before;
 import org.junit.Rule;
@@ -34,18 +37,28 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import java.io.IOException;
+import java.math.BigInteger;
 import java.security.KeyPair;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.function.Consumer;
 
+import static junit.framework.TestCase.assertTrue;
 import static org.apache.hadoop.hdds.HddsConfigKeys.OZONE_METADATA_DIRS;
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType.OM;
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType.SCM;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 /**
  * Tests the Default CA Server.
@@ -216,6 +229,58 @@ public class TestDefaultCAServer {
   }
 
   @Test
+  public void testRevokeCertificates() throws Exception {
+    String scmId =  RandomStringUtils.randomAlphabetic(4);
+    String clusterId =  RandomStringUtils.randomAlphabetic(4);
+    Date now = new Date();
+
+    CertificateServer testCA = new DefaultCAServer("testCA",
+        clusterId, scmId, caStore);
+    testCA.init(new SecurityConfig(conf),
+        CertificateServer.CAType.SELF_SIGNED_CA);
+
+    KeyPair keyPair =
+        new HDDSKeyGenerator(conf).generateKey();
+    PKCS10CertificationRequest csr = new CertificateSignRequest.Builder()
+        .addDnsName("hadoop.apache.org")
+        .addIpAddress("8.8.8.8")
+        .setCA(false)
+        .setSubject("testCA")
+        .setConfiguration(conf)
+        .setKey(keyPair)
+        .build();
+
+    // Let us convert this to a string to mimic the common use case.
+    String csrString = CertificateSignRequest.getEncodedString(csr);
+
+    Future<X509CertificateHolder> holder = testCA.requestCertificate(csrString,
+        CertificateApprover.ApprovalType.TESTING_AUTOMATIC, OM);
+
+    X509Certificate certificate =
+        new JcaX509CertificateConverter().getCertificate(holder.get());
+    List<BigInteger> serialIDs = new ArrayList<>();
+    serialIDs.add(certificate.getSerialNumber());
+    Future<Optional<Long>> revoked = testCA.revokeCertificates(serialIDs,
+        CRLReason.lookup(CRLReason.keyCompromise), now,
+        new SecurityConfig(conf));
+
+    // Revoking a valid certificate complete successfully without errors.
+    assertTrue(revoked.isDone());
+
+    // Revoking empty list of certificates should throw an error.
+    LambdaTestUtils.intercept(ExecutionException.class, "Certificates " +
+        "cannot be null",
+        () -> {
+          Future<Optional<Long>> result =
+              testCA.revokeCertificates(Collections.emptyList(),
+              CRLReason.lookup(CRLReason.keyCompromise), now,
+                  new SecurityConfig(conf));
+          result.isDone();
+          result.get();
+        });
+  }
+
+  @Test
   public void testRequestCertificateWithInvalidSubjectFailure()
       throws Exception {
     KeyPair keyPair =
diff --git a/hadoop-hdds/client/src/test/resources/log4j.properties b/hadoop-hdds/framework/src/test/resources/log4j.properties
similarity index 91%
copy from hadoop-hdds/client/src/test/resources/log4j.properties
copy to hadoop-hdds/framework/src/test/resources/log4j.properties
index bb5cbe5..3987866 100644
--- a/hadoop-hdds/client/src/test/resources/log4j.properties
+++ b/hadoop-hdds/framework/src/test/resources/log4j.properties
@@ -20,4 +20,4 @@ log4j.rootLogger=INFO,stdout
 log4j.threshold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) - %m%n
diff --git a/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto b/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
index 18589d7..cf693ea 100644
--- a/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
+++ b/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
@@ -66,6 +66,7 @@ message ScmContainerLocationRequest {
   optional DecommissionNodesRequestProto decommissionNodesRequest = 27;
   optional RecommissionNodesRequestProto recommissionNodesRequest = 28;
   optional StartMaintenanceNodesRequestProto startMaintenanceNodesRequest = 29;
+  optional DatanodeUsageInfoRequestProto DatanodeUsageInfoRequest = 30;
 }
 
 message ScmContainerLocationResponse {
@@ -103,6 +104,7 @@ message ScmContainerLocationResponse {
   optional DecommissionNodesResponseProto decommissionNodesResponse = 27;
   optional RecommissionNodesResponseProto recommissionNodesResponse = 28;
   optional StartMaintenanceNodesResponseProto startMaintenanceNodesResponse = 29;
+  optional DatanodeUsageInfoResponseProto DatanodeUsageInfoResponse = 30;
   enum Status {
     OK = 1;
     CONTAINER_ALREADY_EXISTS = 2;
@@ -137,6 +139,7 @@ enum Type {
   DecommissionNodes = 22;
   RecommissionNodes = 23;
   StartMaintenanceNodes = 24;
+  DatanodeUsageInfo = 25;
 }
 
 /**
@@ -253,6 +256,18 @@ message NodeQueryResponseProto {
 }
 
 /*
+  Usage info request message containing ip and uuid.
+*/
+message DatanodeUsageInfoRequestProto {
+  optional string ipaddress = 1;
+  optional string uuid = 2;
+}
+
+message DatanodeUsageInfoResponseProto {
+  repeated DatanodeUsageInfo info = 1;
+}
+
+/*
   Decommission a list of hosts
 */
 message DecommissionNodesRequestProto {
@@ -300,7 +315,7 @@ message PipelineRequestProto {
   optional string traceID = 5;
 }
 
-message  PipelineResponseProto {
+message PipelineResponseProto {
   enum Error {
     success = 1;
     errorPipelineAlreadyExists = 2;
diff --git a/hadoop-hdds/interface-client/src/main/proto/hdds.proto b/hadoop-hdds/interface-client/src/main/proto/hdds.proto
index 9b540ad..79012ee 100644
--- a/hadoop-hdds/interface-client/src/main/proto/hdds.proto
+++ b/hadoop-hdds/interface-client/src/main/proto/hdds.proto
@@ -166,6 +166,12 @@ message NodePool {
     repeated Node nodes = 1;
 }
 
+message DatanodeUsageInfo {
+    optional int64 capacity = 1;
+    optional int64 used = 2;
+    optional int64 remaining = 3;
+}
+
 /**
  * LifeCycleState for SCM object creation state machine:
  *    ->Allocated: allocated on SCM but client has not started creating it yet.
@@ -309,3 +315,11 @@ message BlockID {
     required ContainerBlockID containerBlockID = 1;
     optional uint64 blockCommitSequenceId = 2 [default = 0];
 }
+
+/**
+ * Information for Certificate Revocation List.
+ */
+message CRLInfoProto {
+    required string x509CRL = 1;
+    required uint64 creationTimestamp = 2;
+}
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
index d4190b8..8f2dd3f 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
@@ -125,6 +125,7 @@ public class BlockManagerImpl implements BlockManager, BlockmanagerMXBean {
    *
    * @throws IOException
    */
+  @Override
   public void start() throws IOException {
     this.blockDeletingService.start();
   }
@@ -134,6 +135,7 @@ public class BlockManagerImpl implements BlockManager, BlockmanagerMXBean {
    *
    * @throws IOException
    */
+  @Override
   public void stop() throws IOException {
     this.blockDeletingService.shutdown();
     this.close();
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
index c46a4fd..14013b6 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
@@ -198,6 +198,7 @@ public class SCMContainerManager implements ContainerManager {
    * @param state {@link LifeCycleState}
    * @return Count
    */
+  @Override
   public Integer getContainerCountByState(LifeCycleState state) {
     return containerStateManager.getContainerCountByState(state);
   }
@@ -388,13 +389,15 @@ public class SCMContainerManager implements ContainerManager {
     }
   }
 
-    /**
-     * Update deleteTransactionId according to deleteTransactionMap.
-     *
-     * @param deleteTransactionMap Maps the containerId to latest delete
-     *                             transaction id for the container.
-     * @throws IOException
-     */
+
+  /**
+   * Update deleteTransactionId according to deleteTransactionMap.
+   *
+   * @param deleteTransactionMap Maps the containerId to latest delete
+   *                             transaction id for the container.
+   * @throws IOException
+   */
+  @Override
   public void updateDeleteTransactionId(Map<Long, Long> deleteTransactionMap)
       throws IOException {
 
@@ -446,12 +449,14 @@ public class SCMContainerManager implements ContainerManager {
    * @param pipeline     - Pipeline to which the container should belong.
    * @return ContainerInfo, null if there is no match found.
    */
+  @Override
   public ContainerInfo getMatchingContainer(final long sizeRequired,
       String owner, Pipeline pipeline) {
     return getMatchingContainer(sizeRequired, owner, pipeline,
         Collections.emptySet());
   }
 
+  @Override
   @SuppressWarnings("squid:S2445")
   public ContainerInfo getMatchingContainer(final long sizeRequired,
                                             String owner, Pipeline pipeline,
@@ -562,6 +567,7 @@ public class SCMContainerManager implements ContainerManager {
    * @param containerID
    * @return Set<DatanodeDetails>
    */
+  @Override
   public Set<ContainerReplica> getContainerReplicas(
       final ContainerID containerID) throws ContainerNotFoundException {
     return containerStateManager.getContainerReplicas(containerID);
@@ -573,6 +579,7 @@ public class SCMContainerManager implements ContainerManager {
    * @param containerID
    * @param replica
    */
+  @Override
   public void updateContainerReplica(final ContainerID containerID,
       final ContainerReplica replica) throws ContainerNotFoundException {
     containerStateManager.updateContainerReplica(containerID, replica);
@@ -585,6 +592,7 @@ public class SCMContainerManager implements ContainerManager {
    * @param replica
    * @return True of dataNode is removed successfully else false.
    */
+  @Override
   public void removeContainerReplica(final ContainerID containerID,
       final ContainerReplica replica)
       throws ContainerNotFoundException, ContainerReplicaNotFoundException {
@@ -616,6 +624,7 @@ public class SCMContainerManager implements ContainerManager {
     }
   }
 
+  @Override
   public void notifyContainerReportProcessing(boolean isFullReport,
       boolean success) {
     if (isFullReport) {
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
index e4dd9aa..5194829 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/metrics/SCMMetrics.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hdds.scm.container.placement.metrics;
 
+import org.apache.hadoop.hdds.utils.DBCheckpointMetrics;
 import org.apache.hadoop.metrics2.MetricsSystem;
 import org.apache.hadoop.metrics2.annotation.Metric;
 import org.apache.hadoop.metrics2.annotation.Metrics;
@@ -52,7 +53,14 @@ public class SCMMetrics {
   @Metric private MutableCounterLong containerReportReadCount;
   @Metric private MutableCounterLong containerReportWriteCount;
 
+  private DBCheckpointMetrics dbCheckpointMetrics;
+
+  public DBCheckpointMetrics getDBCheckpointMetrics() {
+    return dbCheckpointMetrics;
+  }
+
   public SCMMetrics() {
+    dbCheckpointMetrics = DBCheckpointMetrics.create("SCM Metrics");
   }
 
   public static SCMMetrics create() {
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
index 61cff09..d5a638a 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
@@ -230,7 +230,10 @@ public class ContainerAttribute<T> {
       throws SCMException {
     Preconditions.checkNotNull(currentKey);
     Preconditions.checkNotNull(newKey);
-
+    // Return if container attribute not changed
+    if (currentKey == newKey) {
+      return;
+    }
     boolean removed = false;
     try {
       removed = remove(currentKey, value);
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java
index d8befcf..a76c851 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java
@@ -240,7 +240,12 @@ public class ContainerStateMap {
     if (!contains(containerID)) {
       return;
     }
-
+    // Return if updating state not changed
+    if (currentState == newState) {
+      LOG.debug("CurrentState and NewState are the same, return from " +
+          "updateState directly.");
+      return;
+    }
     // TODO: Simplify this logic.
     final ContainerInfo currentInfo = containerMap.get(containerID);
     try {
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/CRLInfoCodec.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/CRLInfoCodec.java
new file mode 100644
index 0000000..0280d7b
--- /dev/null
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/CRLInfoCodec.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.hadoop.hdds.scm.metadata;
+
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
+import org.apache.hadoop.hdds.utils.db.Codec;
+
+import java.io.IOException;
+import java.security.cert.CRLException;
+import java.security.cert.CertificateException;
+
+/**
+ * Codec to serialize / deserialize CRLInfo.
+ */
+public class CRLInfoCodec implements Codec<CRLInfo> {
+
+  @Override
+  public byte[] toPersistedFormat(CRLInfo crlInfo) throws IOException {
+    return crlInfo.getProtobuf().toByteArray();
+  }
+
+  @Override
+  public CRLInfo fromPersistedFormat(byte[] rawData) throws IOException {
+
+    Preconditions.checkNotNull(rawData,
+        "Null byte array can't be converted to real object.");
+    try {
+      return CRLInfo.fromProtobuf(
+          HddsProtos.CRLInfoProto.PARSER.parseFrom(rawData));
+    } catch (CertificateException|CRLException e) {
+      throw new IllegalArgumentException(
+          "Can't encode the the raw data from the byte array", e);
+    }
+  }
+
+  @Override
+  public CRLInfo copyObject(CRLInfo object) {
+    throw new UnsupportedOperationException();
+  }
+}
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
index df3d527..e22248b 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import org.apache.hadoop.hdds.utils.TransactionInfo;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.hdds.utils.TransactionInfoCodec;
@@ -85,7 +86,7 @@ public class SCMDBDefinition implements DBDefinition {
 
   public static final DBColumnFamilyDefinition<ContainerID, ContainerInfo>
       CONTAINERS =
-      new DBColumnFamilyDefinition<ContainerID, ContainerInfo>(
+      new DBColumnFamilyDefinition<>(
           "containers",
           ContainerID.class,
           new ContainerIDCodec(),
@@ -101,6 +102,23 @@ public class SCMDBDefinition implements DBDefinition {
           TransactionInfo.class,
           new TransactionInfoCodec());
 
+  public static final DBColumnFamilyDefinition<Long, CRLInfo> CRLS =
+      new DBColumnFamilyDefinition<>(
+          "crls",
+          Long.class,
+          new LongCodec(),
+          CRLInfo.class,
+          new CRLInfoCodec());
+
+  public static final DBColumnFamilyDefinition<String, Long>
+      CRL_SEQUENCE_ID =
+      new DBColumnFamilyDefinition<>(
+          "crlSequenceId",
+          String.class,
+          new StringCodec(),
+          Long.class,
+          new LongCodec());
+
   @Override
   public String getName() {
     return "scm.db";
@@ -114,6 +132,7 @@ public class SCMDBDefinition implements DBDefinition {
   @Override
   public DBColumnFamilyDefinition[] getColumnFamilies() {
     return new DBColumnFamilyDefinition[] {DELETED_BLOCKS, VALID_CERTS,
-        VALID_SCM_CERTS, REVOKED_CERTS, PIPELINES, CONTAINERS, TRANSACTIONINFO};
+        VALID_SCM_CERTS, REVOKED_CERTS, PIPELINES, CONTAINERS, TRANSACTIONINFO,
+        CRLS, CRL_SEQUENCE_ID};
   }
 }
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStore.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStore.java
index 9e99f89..75b3c3b 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStore.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStore.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.hdds.utils.DBStoreHAManager;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateStore;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.hdds.utils.db.BatchOperationHandler;
 import org.apache.hadoop.hdds.utils.db.DBStore;
 import org.apache.hadoop.hdds.utils.db.Table;
@@ -94,6 +95,21 @@ public interface SCMMetadataStore extends DBStoreHAManager {
   Table<BigInteger, X509Certificate> getRevokedCertsTable();
 
   /**
+   * A table that maintains X509 Certificate Revocation Lists and its metadata.
+   *
+   * @return Table.
+   */
+  Table<Long, CRLInfo> getCRLInfoTable();
+
+  /**
+   * A table that maintains the last CRL SequenceId. This helps to make sure
+   * that the CRL Sequence Ids are monotonically increasing.
+   *
+   * @return Table.
+   */
+  Table<String, Long> getCRLSequenceIdTable();
+
+  /**
    * Returns the list of Certificates of a specific type.
    *
    * @param certType - CertType.
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStoreImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStoreImpl.java
index d21ffd2..903d2b0 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStoreImpl.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMMetadataStoreImpl.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.hdds.utils.TransactionInfo;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateStore;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.hdds.utils.db.BatchOperationHandler;
 import org.apache.hadoop.hdds.utils.db.DBStore;
 import org.apache.hadoop.hdds.utils.db.DBStoreBuilder;
@@ -36,6 +37,8 @@ import org.apache.hadoop.hdds.utils.db.Table;
 import org.apache.hadoop.hdds.utils.db.TableIterator;
 
 import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.CONTAINERS;
+import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.CRLS;
+import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.CRL_SEQUENCE_ID;
 import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.DELETED_BLOCKS;
 import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.PIPELINES;
 import static org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition.REVOKED_CERTS;
@@ -66,6 +69,10 @@ public class SCMMetadataStoreImpl implements SCMMetadataStore {
 
   private Table<String, TransactionInfo> transactionInfoTable;
 
+  private Table<Long, CRLInfo> crlInfoTable;
+
+  private Table<String, Long> crlSequenceIdTable;
+
   private static final Logger LOG =
       LoggerFactory.getLogger(SCMMetadataStoreImpl.class);
   private DBStore store;
@@ -119,6 +126,10 @@ public class SCMMetadataStoreImpl implements SCMMetadataStore {
       transactionInfoTable = TRANSACTIONINFO.getTable(store);
 
       checkTableStatus(transactionInfoTable, TRANSACTIONINFO.getName());
+
+      crlInfoTable = CRLS.getTable(store);
+
+      crlSequenceIdTable = CRL_SEQUENCE_ID.getTable(store);
     }
   }
 
@@ -156,6 +167,27 @@ public class SCMMetadataStoreImpl implements SCMMetadataStore {
     return revokedCertsTable;
   }
 
+  /**
+   * A table that maintains X509 Certificate Revocation Lists and its metadata.
+   *
+   * @return Table.
+   */
+  @Override
+  public Table<Long, CRLInfo> getCRLInfoTable() {
+    return crlInfoTable;
+  }
+
+  /**
+   * A table that maintains the last CRL SequenceId. This helps to make sure
+   * that the CRL Sequence Ids are monotonically increasing.
+   *
+   * @return Table.
+   */
+  @Override
+  public Table<String, Long> getCRLSequenceIdTable() {
+    return crlSequenceIdTable;
+  }
+
   @Override
   public TableIterator getAllCerts(CertificateStore.CertType certType) {
     if(certType == CertificateStore.CertType.VALID_CERTS) {
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeDecommissionManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeDecommissionManager.java
index 3e7df07..52f627e 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeDecommissionManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeDecommissionManager.java
@@ -108,8 +108,8 @@ public class NodeDecommissionManager {
       try {
         addr = InetAddress.getByName(host.getHostname());
       } catch (UnknownHostException e) {
-        throw new InvalidHostStringException("Unable to resolve the host "
-            +host.getRawHostname(), e);
+        throw new InvalidHostStringException("Unable to resolve host "
+            + host.getRawHostname(), e);
       }
       String dnsName;
       if (useHostnames) {
@@ -119,15 +119,17 @@ public class NodeDecommissionManager {
       }
       List<DatanodeDetails> found = nodeManager.getNodesByAddress(dnsName);
       if (found.size() == 0) {
-        throw new InvalidHostStringException("The string " +
-            host.getRawHostname()+" resolved to "+dnsName +
-            " is not found in SCM");
+        throw new InvalidHostStringException("Host " + host.getRawHostname()
+            + " (" + dnsName + ") is not running any datanodes registered"
+            + " with SCM."
+            + " Please check the host name.");
       } else if (found.size() == 1) {
         if (host.getPort() != -1 &&
             !validateDNPortMatch(host.getPort(), found.get(0))) {
-          throw new InvalidHostStringException("The string "+
-              host.getRawHostname()+" matched a single datanode, but the "+
-              "given port is not used by that Datanode");
+          throw new InvalidHostStringException("Host " + host.getRawHostname()
+              + " is running a datanode registered with SCM,"
+              + " but the port number doesn't match."
+              + " Please check the port number.");
         }
         results.add(found.get(0));
       } else if (found.size() > 1) {
@@ -139,9 +141,10 @@ public class NodeDecommissionManager {
           }
         }
         if (match == null) {
-          throw new InvalidHostStringException("The string " +
-              host.getRawHostname()+ "matched multiple Datanodes, but no "+
-              "datanode port matched the given port");
+          throw new InvalidHostStringException("Host " + host.getRawHostname()
+              + " is running multiple datanodes registered with SCM,"
+              + " but no port numbers match."
+              + " Please check the port number.");
         }
         results.add(match);
       }
@@ -281,8 +284,8 @@ public class NodeDecommissionManager {
         // NodeNotFoundException here expect if the node is remove in the
         // very short window between validation and starting decom. Therefore
         // log a warning and ignore the exception
-        LOG.warn("The host {} was not found in SCM. Ignoring the request to "+
-            "recommission it", dn.getHostName());
+        LOG.warn("Host {} was not found in SCM. Ignoring the request to "+
+            "recommission it.", dn.getHostName());
       }
     }
   }
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
index d8b7056..80211cd 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
@@ -159,6 +159,10 @@ public class SCMNodeManager implements NodeManager {
     }
   }
 
+  protected NodeStateManager getNodeStateManager() {
+    return nodeStateManager;
+  }
+
   /**
    * Returns all datanode that are in the given state. This function works by
    * taking a snapshot of the current collection and then returning the list
@@ -403,6 +407,12 @@ public class SCMNodeManager implements NodeManager {
     return commandQueue.getCommand(datanodeDetails.getUuid());
   }
 
+  boolean opStateDiffers(DatanodeDetails dnDetails, NodeStatus nodeStatus) {
+    return nodeStatus.getOperationalState() != dnDetails.getPersistedOpState()
+        || nodeStatus.getOpStateExpiryEpochSeconds()
+        != dnDetails.getPersistedOpStateExpiryEpochSec();
+  }
+
   /**
    * If the operational state or expiry reported in the datanode heartbeat do
    * not match those store in SCM, queue a command to update the state persisted
@@ -414,12 +424,10 @@ public class SCMNodeManager implements NodeManager {
    * @param reportedDn The DatanodeDetails taken from the node heartbeat.
    * @throws NodeNotFoundException
    */
-  private void updateDatanodeOpState(DatanodeDetails reportedDn)
+  protected void updateDatanodeOpState(DatanodeDetails reportedDn)
       throws NodeNotFoundException {
     NodeStatus scmStatus = getNodeStatus(reportedDn);
-    if (scmStatus.getOperationalState() != reportedDn.getPersistedOpState()
-        || scmStatus.getOpStateExpiryEpochSeconds()
-        != reportedDn.getPersistedOpStateExpiryEpochSec()) {
+    if (opStateDiffers(reportedDn, scmStatus)) {
       LOG.info("Scheduling a command to update the operationalState " +
           "persisted on {} as the reported value does not " +
           "match the value stored in SCM ({}, {})",
@@ -813,7 +821,7 @@ public class SCMNodeManager implements NodeManager {
    */
   @Override
   public void onMessage(CommandForDatanode commandForDatanode,
-      EventPublisher ignored) {
+                        EventPublisher ignored) {
     addDatanodeCommand(commandForDatanode.getDatanodeId(),
         commandForDatanode.getCommand());
   }
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
index 5e20eb1..0af6101 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
@@ -389,6 +389,12 @@ class PipelineStateMap {
     Preconditions.checkNotNull(state, "Pipeline LifeCycleState cannot be null");
 
     final Pipeline pipeline = getPipeline(pipelineID);
+    // Return the old pipeline if updating same state
+    if (pipeline.getPipelineState() == state) {
+      LOG.debug("CurrentState and NewState are the same, return from " +
+          "updatePipelineState directly.");
+      return pipeline;
+    }
     Pipeline updatedPipeline = pipelineMap.compute(pipelineID,
         (id, p) -> Pipeline.newBuilder(pipeline).setState(state).build());
     PipelineQuery query = new PipelineQuery(pipeline);
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
index e485a28..64101a5 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
@@ -198,6 +198,7 @@ public class RatisPipelineProvider extends PipelineProvider {
    * @param pipeline            - Pipeline to be destroyed
    * @throws NotLeaderException - Send datanode command while not leader
    */
+  @Override
   public void close(Pipeline pipeline) throws NotLeaderException {
     final ClosePipelineCommand closeCommand =
         new ClosePipelineCommand(pipeline.getId());
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
index 44a6448..faa7bda 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
@@ -363,6 +363,7 @@ public class SCMPipelineManager implements
     }
   }
 
+  @Override
   public List<Pipeline> getPipelines(ReplicationType type,
       Pipeline.PipelineState state) {
     lock.readLock().lock();
@@ -724,6 +725,7 @@ public class SCMPipelineManager implements
    * @param  pipeline
    * @return healthy volume count
    */
+  @Override
   public int minHealthyVolumeNum(Pipeline pipeline) {
     return nodeManager.minHealthyVolumeNum(pipeline.getNodes());
   }
@@ -734,6 +736,7 @@ public class SCMPipelineManager implements
    * @param  pipeline
    * @return healthy volume count
    */
+  @Override
   public int minPipelineLimit(Pipeline pipeline) {
     return nodeManager.minPipelineLimit(pipeline.getNodes());
   }
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
index 0562bc7..da9ec2f 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
@@ -17,11 +17,10 @@
  */
 package org.apache.hadoop.hdds.scm.protocol;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.base.Strings;
+import com.google.protobuf.ProtocolMessageEnum;
+import com.google.protobuf.RpcController;
+import com.google.protobuf.ServiceException;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
@@ -32,8 +31,11 @@ import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolPro
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ClosePipelineResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ContainerResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DatanodeUsageInfoResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DeactivatePipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DeactivatePipelineResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DecommissionNodesRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DecommissionNodesResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ForceExitSafeModeRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ForceExitSafeModeResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerRequestProto;
@@ -44,12 +46,16 @@ import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolPro
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetPipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetPipelineResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.InSafeModeRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.InSafeModeResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ListPipelineRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ListPipelineResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.NodeQueryResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.PipelineResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ReplicationManagerStatusRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ReplicationManagerStatusResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMCloseContainerRequestProto;
@@ -58,22 +64,16 @@ import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolPro
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMDeleteContainerResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMListContainerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SCMListContainerResponseProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SafeModeRuleStatusProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationRequest;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationResponse;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationResponse.Status;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesRequestProto;
+import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartReplicationManagerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartReplicationManagerResponseProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StopReplicationManagerRequestProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StopReplicationManagerResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DecommissionNodesRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.DecommissionNodesResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.RecommissionNodesResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetSafeModeRuleStatusesResponseProto;
-import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.SafeModeRuleStatusProto;
 import org.apache.hadoop.hdds.scm.ScmInfo;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
@@ -82,17 +82,18 @@ import org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolPB;
 import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.server.OzoneProtocolMessageDispatcher;
 import org.apache.hadoop.hdds.utils.ProtocolMessageMetrics;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
-import com.google.protobuf.ProtocolMessageEnum;
-import com.google.protobuf.RpcController;
-import com.google.protobuf.ServiceException;
 import static org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.PipelineResponseProto.Error.errorPipelineAlreadyExists;
 import static org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.PipelineResponseProto.Error.success;
 import static org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol.ADMIN_COMMAND_TYPE;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * This class is the server-side translator that forwards requests received on
  * {@link StorageContainerLocationProtocolPB} to the
@@ -314,7 +315,14 @@ public final class StorageContainerLocationProtocolServerSideTranslatorPB
             .setStatus(Status.OK)
             .setStartMaintenanceNodesResponse(startMaintenanceNodes(
                 request.getStartMaintenanceNodesRequest()))
-          .build();
+            .build();
+      case DatanodeUsageInfo:
+        return ScmContainerLocationResponse.newBuilder()
+            .setCmdType(request.getCmdType())
+            .setStatus(Status.OK)
+            .setDatanodeUsageInfoResponse(getDatanodeUsageInfo(
+                request.getDatanodeUsageInfoRequest()))
+            .build();
       default:
         throw new IllegalArgumentException(
             "Unknown command type: " + request.getCmdType());
@@ -569,4 +577,27 @@ public final class StorageContainerLocationProtocolServerSideTranslatorPB
         .build();
   }
 
+  public DatanodeUsageInfoResponseProto getDatanodeUsageInfo(
+      StorageContainerLocationProtocolProtos.DatanodeUsageInfoRequestProto
+      request) throws IOException {
+    String ipaddress = null;
+    String uuid = null;
+    if (request.hasIpaddress()) {
+      ipaddress = request.getIpaddress();
+    }
+    if (request.hasUuid()) {
+      uuid = request.getUuid();
+    }
+    if (Strings.isNullOrEmpty(ipaddress) && Strings.isNullOrEmpty(uuid)) {
+      throw new IOException("No ip or uuid specified");
+    }
+
+    List<HddsProtos.DatanodeUsageInfo> infoList;
+    infoList = impl.getDatanodeUsageInfo(ipaddress,
+        uuid);
+    return DatanodeUsageInfoResponseProto.newBuilder()
+        .addAllInfo(infoList)
+        .build();
+  }
+
 }
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SCMSafeModeManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SCMSafeModeManager.java
index e4e069a..206e40b 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SCMSafeModeManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SCMSafeModeManager.java
@@ -253,6 +253,7 @@ public class SCMSafeModeManager implements SafeModeManager {
     emitSafeModeStatus();
   }
 
+  @Override
   public boolean getInSafeMode() {
     if (!isSafeModeEnabled) {
       return false;
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
index 3d1cf51..bc703dd 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
@@ -21,21 +21,35 @@ package org.apache.hadoop.hdds.scm.server;
 
 import java.io.IOException;
 import java.math.BigInteger;
+import java.security.cert.CRLException;
+import java.security.cert.X509CRL;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
+
 import java.util.List;
+import java.util.Date;
+import java.util.Optional;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStore;
 import org.apache.hadoop.hdds.security.exception.SCMSecurityException;
+import org.apache.hadoop.hdds.security.x509.certificate.authority.CRLApprover;
 import org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateStore;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.hdds.utils.db.BatchOperation;
 import org.apache.hadoop.hdds.utils.db.Table;
+import org.bouncycastle.asn1.x509.CRLReason;
+import org.bouncycastle.cert.X509CertificateHolder;
+import org.bouncycastle.cert.X509v2CRLBuilder;
+import org.bouncycastle.operator.OperatorCreationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.ozone.OzoneConsts.CRL_SEQUENCE_ID_KEY;
+
 /**
  * A Certificate Store class that persists certificates issued by SCM CA.
  */
@@ -44,11 +58,12 @@ public class SCMCertStore implements CertificateStore {
       LoggerFactory.getLogger(SCMCertStore.class);
   private final SCMMetadataStore scmMetadataStore;
   private final Lock lock;
+  private AtomicLong crlSequenceId;
 
-  public SCMCertStore(SCMMetadataStore dbStore) {
+  public SCMCertStore(SCMMetadataStore dbStore, long sequenceId) {
     this.scmMetadataStore = dbStore;
     lock = new ReentrantLock();
-
+    crlSequenceId = new AtomicLong(sequenceId);
   }
 
   @Override
@@ -91,39 +106,75 @@ public class SCMCertStore implements CertificateStore {
   }
 
   @Override
-  public void revokeCertificate(BigInteger serialID) throws IOException {
+  public Optional<Long> revokeCertificates(
+      List<BigInteger> serialIDs,
+      X509CertificateHolder caCertificateHolder,
+      CRLReason reason,
+      Date revocationTime,
+      CRLApprover crlApprover)
+      throws IOException {
+    Date now = new Date();
+    X509v2CRLBuilder builder =
+        new X509v2CRLBuilder(caCertificateHolder.getIssuer(), now);
+    List<X509Certificate> certsToRevoke = new ArrayList<>();
+    X509CRL crl;
+    Optional<Long> sequenceId = Optional.empty();
     lock.lock();
     try {
-      X509Certificate cert = getCertificateByID(serialID, CertType.VALID_CERTS);
-      if (cert == null) {
-        LOG.error("trying to revoke a certificate that is not valid. Serial: " +
-            "{}", serialID.toString());
-        throw new SCMSecurityException("Trying to revoke an invalid " +
-            "certificate.");
-      }
-      // TODO : Check if we are trying to revoke an expired certificate.
-
-      if (getCertificateByID(serialID, CertType.REVOKED_CERTS) != null) {
-        LOG.error("Trying to revoke a certificate that is already revoked.");
-        throw new SCMSecurityException("Trying to revoke an already revoked " +
-            "certificate.");
+      for (BigInteger serialID: serialIDs) {
+        X509Certificate cert =
+            getCertificateByID(serialID, CertType.VALID_CERTS);
+        if (cert == null && LOG.isWarnEnabled()) {
+          LOG.warn("Trying to revoke a certificate that is not valid. " +
+              "Serial ID: {}", serialID.toString());
+        } else if (getCertificateByID(serialID, CertType.REVOKED_CERTS)
+            != null) {
+          LOG.warn("Trying to revoke a certificate that is already revoked.");
+        } else {
+          builder.addCRLEntry(serialID, revocationTime,
+              reason.getValue().intValue());
+          certsToRevoke.add(cert);
+        }
       }
-
-      // let is do this in a transaction.
-      try (BatchOperation batch =
-               scmMetadataStore.getStore().initBatchOperation();) {
-        scmMetadataStore.getRevokedCertsTable()
-            .putWithBatch(batch, serialID, cert);
-        if (scmMetadataStore.getValidSCMCertsTable().get(serialID) != null) {
-          scmMetadataStore.getValidSCMCertsTable().deleteWithBatch(batch,
-              serialID);
+      if (!certsToRevoke.isEmpty()) {
+        try {
+          crl = crlApprover.sign(builder);
+        } catch (OperatorCreationException | CRLException e) {
+          throw new SCMSecurityException("Unable to create Certificate " +
+              "Revocation List.", e);
+        }
+        // let us do this in a transaction.
+        try (BatchOperation batch =
+                 scmMetadataStore.getStore().initBatchOperation()) {
+          // Move the certificates from Valid Certs table to Revoked Certs Table
+          // only if the revocation time has passed.
+          if (now.after(revocationTime) || now.equals(revocationTime)) {
+            for (X509Certificate cert : certsToRevoke) {
+              scmMetadataStore.getRevokedCertsTable()
+                  .putWithBatch(batch, cert.getSerialNumber(), cert);
+              scmMetadataStore.getValidCertsTable()
+                  .deleteWithBatch(batch, cert.getSerialNumber());
+            }
+          }
+          long id = crlSequenceId.incrementAndGet();
+          CRLInfo crlInfo = new CRLInfo.Builder()
+              .setX509CRL(crl)
+              .setCreationTimestamp(now.getTime())
+              .build();
+          scmMetadataStore.getCRLInfoTable().putWithBatch(
+              batch, id, crlInfo);
+
+          // Update the CRL Sequence Id Table with the last sequence id.
+          scmMetadataStore.getCRLSequenceIdTable().putWithBatch(batch,
+              CRL_SEQUENCE_ID_KEY, id);
+          scmMetadataStore.getStore().commitBatchOperation(batch);
+          sequenceId = Optional.of(id);
         }
-        scmMetadataStore.getValidCertsTable().deleteWithBatch(batch, serialID);
-        scmMetadataStore.getStore().commitBatchOperation(batch);
       }
     } finally {
       lock.unlock();
     }
+    return sequenceId;
   }
 
   @Override
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
index 8d904f9..7d789f6 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
@@ -24,16 +24,7 @@ package org.apache.hadoop.hdds.scm.server;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Maps;
 import com.google.protobuf.BlockingService;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.stream.Collectors;
-
+import com.google.protobuf.ProtocolMessageEnum;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
@@ -50,6 +41,7 @@ import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
 import org.apache.hadoop.hdds.scm.container.ContainerReplica;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
+import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeStat;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
@@ -70,16 +62,26 @@ import org.apache.hadoop.ozone.audit.AuditLoggerType;
 import org.apache.hadoop.ozone.audit.AuditMessage;
 import org.apache.hadoop.ozone.audit.Auditor;
 import org.apache.hadoop.ozone.audit.SCMAction;
+import org.apache.ratis.thirdparty.com.google.common.base.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
 
-import com.google.protobuf.ProtocolMessageEnum;
 import static org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StorageContainerLocationProtocolService.newReflectiveBlockingService;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HANDLER_COUNT_DEFAULT;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HANDLER_COUNT_KEY;
 import static org.apache.hadoop.hdds.scm.server.StorageContainerManager.startRpcServer;
 import static org.apache.hadoop.hdds.server.ServerUtils.getRemoteUserName;
 import static org.apache.hadoop.hdds.server.ServerUtils.updateRPCListenAddress;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * The RPC server that listens to requests from clients.
@@ -611,6 +613,73 @@ public class SCMClientProtocolServer implements
   }
 
   /**
+   * Get Datanode usage info (such as capacity, used) by ip or uuid.
+   *
+   * @param ipaddress - Datanode Address String
+   * @param uuid - Datanode UUID String
+   * @return List of DatanodeUsageInfo. Each element contains usage info such
+   * as capacity, SCMUsed, and remaining space.
+   * @throws IOException
+   */
+  @Override
+  public List<HddsProtos.DatanodeUsageInfo> getDatanodeUsageInfo(
+      String ipaddress, String uuid) throws IOException {
+
+    // check admin authorisation
+    String remoteUser = getRpcRemoteUsername();
+    try {
+      getScm().checkAdminAccess(remoteUser);
+    } catch (IOException e) {
+      LOG.error("Authorisation failed", e);
+      throw e;
+    }
+
+    // get datanodes by ip or uuid
+    List<DatanodeDetails> nodes = new ArrayList<>();
+    if (!Strings.isNullOrEmpty(uuid)) {
+      nodes.add(scm.getScmNodeManager().getNodeByUuid(uuid));
+    } else if (!Strings.isNullOrEmpty(ipaddress)) {
+      nodes = scm.getScmNodeManager().getNodesByAddress(ipaddress);
+    } else {
+      throw new IOException(
+          "Could not get datanode with the specified parameters."
+      );
+    }
+
+    // get datanode usage info
+    List<HddsProtos.DatanodeUsageInfo> infoList = new ArrayList<>();
+    for (DatanodeDetails node : nodes) {
+      infoList.add(getUsageInfoFromDatanodeDetails(node));
+    }
+
+    return infoList;
+  }
+
+  /**
+   * Get usage details for a specific DatanodeDetails node.
+   *
+   * @param node - DatanodeDetails
+   * @return Usage info such as capacity, SCMUsed, and remaining space.
+   * @throws IOException
+   */
+  private HddsProtos.DatanodeUsageInfo getUsageInfoFromDatanodeDetails(
+      DatanodeDetails node) throws IOException {
+    SCMNodeStat stat = scm.getScmNodeManager().getNodeStat(node).get();
+
+    long capacity = stat.getCapacity().get();
+    long used = stat.getScmUsed().get();
+    long remaining = stat.getRemaining().get();
+
+    HddsProtos.DatanodeUsageInfo info = HddsProtos.DatanodeUsageInfo
+        .newBuilder()
+        .setCapacity(capacity)
+        .setUsed(used)
+        .setRemaining(remaining)
+        .build();
+    return info;
+  }
+
+  /**
    * Queries a list of Node that match a set of statuses.
    *
    * <p>For example, if the nodeStatuses is HEALTHY and RAFT_MEMBER, then
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDBCheckpointServlet.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDBCheckpointServlet.java
new file mode 100644
index 0000000..7614161
--- /dev/null
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDBCheckpointServlet.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdds.scm.server;
+
+import javax.servlet.ServletException;
+import org.apache.hadoop.hdds.utils.DBCheckpointServlet;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+
+/**
+ * Provides the current checkpoint Snapshot of the SCM 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 user name to
+ * `ozone.administrator`, e.g. `scm`
+ */
+public class SCMDBCheckpointServlet extends DBCheckpointServlet {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(SCMDBCheckpointServlet.class);
+  private static final long serialVersionUID = 1L;
+
+  @Override
+  public void init() throws ServletException {
+
+    StorageContainerManager scm = (StorageContainerManager) getServletContext()
+        .getAttribute(OzoneConsts.SCM_CONTEXT_ATTRIBUTE);
+
+    if (scm == null) {
+      LOG.error("Unable to initialize SCMDBCheckpointServlet. SCM is null");
+      return;
+    }
+
+    initialize(scm.getScmMetadataStore().getStore(),
+        scm.getMetrics().getDBCheckpointMetrics(),
+        false,
+        Collections.emptyList());
+  }
+}
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java
index e374d62..f45f372 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java
@@ -129,12 +129,14 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
 import org.apache.hadoop.security.authentication.client.AuthenticationException;
 import org.apache.hadoop.util.JvmPauseMonitor;
-
-import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_SCM_WATCHER_TIMEOUT_DEFAULT;
 import org.apache.ratis.grpc.GrpcTlsConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_SCM_WATCHER_TIMEOUT_DEFAULT;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_WILDCARD;
+import static org.apache.hadoop.ozone.OzoneConsts.CRL_SEQUENCE_ID_KEY;
+
 /**
  * StorageContainerManager is the main entry point for the service that
  * provides information about
@@ -187,7 +189,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
   /*
    * HTTP endpoint for JMX access.
    */
-  private final StorageContainerManagerHttpServer httpServer;
+  private StorageContainerManagerHttpServer httpServer;
   /**
    * SCM super user.
    */
@@ -236,7 +238,6 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
     this(conf, new SCMConfigurator());
   }
 
-
   /**
    * This constructor offers finer control over how SCM comes up.
    * To use this, user needs to create a SCMConfigurator and set various
@@ -359,7 +360,6 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
         eventQueue);
     blockProtocolServer = new SCMBlockProtocolServer(conf, this);
     clientProtocolServer = new SCMClientProtocolServer(conf, this);
-    httpServer = new StorageContainerManagerHttpServer(conf);
     eventQueue.addHandler(SCMEvents.DATANODE_COMMAND, scmNodeManager);
     eventQueue.addHandler(SCMEvents.RETRIABLE_DATANODE_COMMAND, scmNodeManager);
     eventQueue.addHandler(SCMEvents.NODE_REPORT, nodeReportHandler);
@@ -385,10 +385,15 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
 
     // Emit initial safe mode status, as now handlers are registered.
     scmSafeModeManager.emitSafeModeStatus();
+
     registerMXBean();
     registerMetricsSource(this);
   }
 
+  public OzoneConfiguration getConfiguration() {
+    return configuration;
+  }
+
   /**
    * Create an SCM instance based on the supplied configuration.
    *
@@ -637,10 +642,24 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
       throw new SCMException("Cannot initialize CA without a valid metadata " +
           "store", ResultCodes.SCM_NOT_INITIALIZED);
     }
-    SCMCertStore certStore = new SCMCertStore(this.scmMetadataStore);
+    SCMCertStore certStore = new SCMCertStore(this.scmMetadataStore,
+        getLastSequenceIdForCRL());
     return new DefaultCAServer(subject, clusterID, scmID, certStore);
   }
 
+  long getLastSequenceIdForCRL() throws IOException {
+    Long sequenceId =
+        scmMetadataStore.getCRLSequenceIdTable().get(CRL_SEQUENCE_ID_KEY);
+    // If the CRL_SEQUENCE_ID_KEY does not exist in DB return 0 so that new
+    // CRL requests can have sequence id starting from 1.
+    if (sequenceId == null) {
+      return 0L;
+    }
+    // If there exists a last sequence id in the DB, the new incoming
+    // CRL requests must have sequence ids greater than the one stored in the DB
+    return sequenceId;
+  }
+
   /**
    * Builds a message for logging startup information about an RPC server.
    *
@@ -904,6 +923,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
    *
    * @return Address where datanode are communicating.
    */
+  @Override
   public InetSocketAddress getDatanodeRpcAddress() {
     return getDatanodeProtocolServer().getDatanodeRpcAddress();
   }
@@ -926,6 +946,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
   /**
    * Start service.
    */
+  @Override
   public void start() throws IOException {
     if (LOG.isInfoEnabled()) {
       LOG.info(buildRpcServerStartMessage(
@@ -956,7 +977,6 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
       getSecurityProtocolServer().start();
     }
 
-    httpServer.start();
     scmBlockManager.start();
 
     // Start jvm monitor
@@ -964,12 +984,21 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
     jvmPauseMonitor.init(configuration);
     jvmPauseMonitor.start();
 
+    try {
+      httpServer = new StorageContainerManagerHttpServer(configuration, this);
+      httpServer.start();
+    } catch (Exception ex) {
+      // SCM HttpServer start-up failure should be non-fatal
+      LOG.error("SCM HttpServer failed to start.", ex);
+    }
+
     setStartTime();
   }
 
   /**
    * Stop service.
    */
+  @Override
   public void stop() {
     try {
       LOG.info("Stopping Replication Manager Service.");
@@ -1085,6 +1114,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
   /**
    * Wait until service has completed shutdown.
    */
+  @Override
   public void join() {
     try {
       getBlockProtocolServer().join();
@@ -1131,6 +1161,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
    * Returns SCM container manager.
    */
   @VisibleForTesting
+  @Override
   public ContainerManagerV2 getContainerManager() {
     return containerManager;
   }
@@ -1141,6 +1172,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
    * @return - Node Manager
    */
   @VisibleForTesting
+  @Override
   public NodeManager getScmNodeManager() {
     return scmNodeManager;
   }
@@ -1151,11 +1183,13 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
    * @return - Pipeline Manager
    */
   @VisibleForTesting
+  @Override
   public PipelineManager getPipelineManager() {
     return pipelineManager;
   }
 
   @VisibleForTesting
+  @Override
   public BlockManager getScmBlockManager() {
     return scmBlockManager;
   }
@@ -1166,6 +1200,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
   }
 
   @VisibleForTesting
+  @Override
   public ReplicationManager getReplicationManager() {
     return replicationManager;
   }
@@ -1180,7 +1215,8 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
   }
 
   public void checkAdminAccess(String remoteUser) throws IOException {
-    if (remoteUser != null && !scmAdminUsernames.contains(remoteUser)) {
+    if (remoteUser != null && !scmAdminUsernames.contains(remoteUser) &&
+        !scmAdminUsernames.contains(OZONE_ADMINISTRATORS_WILDCARD)) {
       throw new IOException(
           "Access denied for user " + remoteUser + ". Superuser privilege " +
               "is required.");
@@ -1341,10 +1377,12 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
     return this.pipelineChoosePolicy;
   }
 
+  @Override
   public String getScmId() {
     return getScmStorageConfig().getScmId();
   }
 
+  @Override
   public String getClusterId() {
     return getScmStorageConfig().getClusterID();
   }
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerHttpServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerHttpServer.java
index 8a94462..f7a0761 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerHttpServer.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerHttpServer.java
@@ -22,15 +22,21 @@ import java.io.IOException;
 import org.apache.hadoop.hdds.conf.MutableConfigurationSource;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.server.http.BaseHttpServer;
+import org.apache.hadoop.ozone.OzoneConsts;
+import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT;
 
 /**
  * HttpServer2 wrapper for the Ozone Storage Container Manager.
  */
 public class StorageContainerManagerHttpServer extends BaseHttpServer {
 
-  public StorageContainerManagerHttpServer(MutableConfigurationSource conf)
+  public StorageContainerManagerHttpServer(MutableConfigurationSource conf,
+                                           StorageContainerManager scm)
       throws IOException {
     super(conf, "scm");
+    addServlet("dbCheckpoint", OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT,
+        SCMDBCheckpointServlet.class);
+    getWebAppContext().setAttribute(OzoneConsts.SCM_CONTEXT_ATTRIBUTE, scm);
   }
 
   @Override protected String getHttpAddressKey() {
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerStarter.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerStarter.java
index 8de2730..4c7b693 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerStarter.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManagerStarter.java
@@ -159,23 +159,26 @@ public class StorageContainerManagerStarter extends GenericCli {
    */
   static class SCMStarterHelper implements SCMStarterInterface {
 
+    @Override
     public void start(OzoneConfiguration conf) throws Exception {
       StorageContainerManager stm = StorageContainerManager.createSCM(conf);
       stm.start();
       stm.join();
     }
 
+    @Override
     public boolean init(OzoneConfiguration conf, String clusterId)
         throws IOException{
       return StorageContainerManager.scmInit(conf, clusterId);
     }
 
+    @Override
     public boolean bootStrap(OzoneConfiguration conf)
         throws IOException{
       return StorageContainerManager.scmBootstrap(conf);
     }
 
-
+    @Override
     public String generateClusterId() {
       return StorageInfo.newClusterID();
     }
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManagerHttpServer.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManagerHttpServer.java
index 70b8ad4..20d5485 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManagerHttpServer.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManagerHttpServer.java
@@ -104,7 +104,7 @@ public class TestStorageContainerManagerHttpServer {
     StorageContainerManagerHttpServer server = null;
     try {
       DefaultMetricsSystem.initialize("TestStorageContainerManagerHttpServer");
-      server = new StorageContainerManagerHttpServer(conf);
+      server = new StorageContainerManagerHttpServer(conf, null);
       server.start();
 
       Assert.assertTrue(implies(policy.isHttpEnabled(),
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
index 2253820..ddd4aef 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java
@@ -299,6 +299,7 @@ public class MockNodeManager implements NodeManager {
    * @param datanodeDetails The datanode to set the new state for
    * @param newState The new operational state for the node
    */
+  @Override
   public void setNodeOperationalState(DatanodeDetails datanodeDetails,
       HddsProtos.NodeOperationalState newState) throws NodeNotFoundException {
   }
@@ -308,6 +309,7 @@ public class MockNodeManager implements NodeManager {
    * @param datanodeDetails The datanode to set the new state for
    * @param newState The new operational state for the node
    */
+  @Override
   public void setNodeOperationalState(DatanodeDetails datanodeDetails,
       HddsProtos.NodeOperationalState newState, long opStateExpiryEpocSec)
       throws NodeNotFoundException {
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMStoreImplWithOldPipelineIDKeyFormat.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMStoreImplWithOldPipelineIDKeyFormat.java
index 5366b17..afb3db1 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMStoreImplWithOldPipelineIDKeyFormat.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMStoreImplWithOldPipelineIDKeyFormat.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.hdds.utils.TransactionInfo;
 import org.apache.hadoop.hdds.scm.metadata.PipelineCodec;
 import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStore;
 import org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateStore;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.hdds.utils.db.BatchOperationHandler;
 import org.apache.hadoop.hdds.utils.db.Codec;
 import org.apache.hadoop.hdds.utils.db.DBColumnFamilyDefinition;
@@ -103,6 +104,16 @@ public class TestSCMStoreImplWithOldPipelineIDKeyFormat
   }
 
   @Override
+  public Table<Long, CRLInfo> getCRLInfoTable() {
+    return null;
+  }
+
+  @Override
+  public Table<String, Long> getCRLSequenceIdTable() {
+    return null;
+  }
+
+  @Override
   public TableIterator getAllCerts(CertificateStore.CertType certType) {
     return null;
   }
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java
new file mode 100644
index 0000000..96a4dc9
--- /dev/null
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.server;
+
+import org.apache.hadoop.hdds.HddsConfigKeys;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStore;
+import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStoreImpl;
+import org.apache.hadoop.hdds.security.x509.SecurityConfig;
+import org.apache.hadoop.hdds.security.x509.certificate.authority.CRLApprover;
+import org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateStore;
+import org.apache.hadoop.hdds.security.x509.certificate.authority.DefaultCRLApprover;
+import org.apache.hadoop.hdds.security.x509.certificate.utils.CertificateCodec;
+import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
+import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
+import org.bouncycastle.asn1.x509.CRLReason;
+import org.bouncycastle.cert.X509CertificateHolder;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.nio.file.Files;
+import java.security.KeyPair;
+import java.security.cert.X509CRLEntry;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.apache.hadoop.ozone.OzoneConsts.CRL_SEQUENCE_ID_KEY;
+
+/**
+ * Test class for @{@link SCMCertStore}.
+ */
+public class TestSCMCertStore {
+
+  private static final String COMPONENT_NAME = "scm";
+  private static final Long INITIAL_SEQUENCE_ID = 1L;
+
+  private OzoneConfiguration config;
+  private SCMMetadataStore scmMetadataStore;
+  private SCMCertStore scmCertStore;
+  private SecurityConfig securityConfig;
+  private X509Certificate x509Certificate;
+  private KeyPair keyPair;
+  private CRLApprover crlApprover;
+
+  @Rule
+  public final TemporaryFolder tempDir = new TemporaryFolder();
+
+  @Before
+  public void setUp() throws Exception {
+    config = new OzoneConfiguration();
+
+    config.set(HddsConfigKeys.OZONE_METADATA_DIRS,
+        tempDir.newFolder().getAbsolutePath());
+
+    securityConfig = new SecurityConfig(config);
+    keyPair = KeyStoreTestUtil.generateKeyPair("RSA");
+  }
+
+  @Before
+  public void initDbStore() throws IOException {
+    scmMetadataStore = new SCMMetadataStoreImpl(config);
+    scmCertStore = new SCMCertStore(scmMetadataStore, INITIAL_SEQUENCE_ID);
+  }
+
+  @Before
+  public void generateCertificate() throws Exception {
+    Files.createDirectories(securityConfig.getKeyLocation(COMPONENT_NAME));
+    x509Certificate = generateX509Cert();
+  }
+
+  @Before
+  public void initCRLApprover() {
+    crlApprover = new DefaultCRLApprover(securityConfig,
+        keyPair.getPrivate());
+  }
+
+  @After
+  public void destroyDbStore() throws Exception {
+    if (scmMetadataStore.getStore() != null) {
+      scmMetadataStore.getStore().close();
+    }
+  }
+
+  @Test
+  public void testRevokeCertificates() throws Exception {
+
+    BigInteger serialID = x509Certificate.getSerialNumber();
+    scmCertStore.storeValidCertificate(serialID, x509Certificate);
+    Date now = new Date();
+
+    assertNotNull(
+        scmCertStore.getCertificateByID(serialID,
+        CertificateStore.CertType.VALID_CERTS));
+
+    X509CertificateHolder caCertificateHolder =
+        new X509CertificateHolder(generateX509Cert().getEncoded());
+    List<BigInteger> certs = new ArrayList<>();
+    certs.add(x509Certificate.getSerialNumber());
+    Optional<Long> sequenceId = scmCertStore.revokeCertificates(certs,
+        caCertificateHolder,
+        CRLReason.lookup(CRLReason.keyCompromise), now, crlApprover);
+
+    assertTrue(sequenceId.isPresent());
+    assertEquals(INITIAL_SEQUENCE_ID + 1L, (long) sequenceId.get());
+
+    assertNull(
+        scmCertStore.getCertificateByID(serialID,
+            CertificateStore.CertType.VALID_CERTS));
+
+    assertNotNull(
+        scmCertStore.getCertificateByID(serialID,
+            CertificateStore.CertType.REVOKED_CERTS));
+
+    // CRL Info table should have a CRL with sequence id
+    assertNotNull(scmMetadataStore.getCRLInfoTable()
+        .get(sequenceId.get()));
+
+    // Check the sequence ID table for latest sequence id
+    assertEquals(INITIAL_SEQUENCE_ID + 1L, (long)
+        scmMetadataStore.getCRLSequenceIdTable().get(CRL_SEQUENCE_ID_KEY));
+
+    CRLInfo crlInfo =
+        scmMetadataStore.getCRLInfoTable().get(sequenceId.get());
+
+    Set<? extends X509CRLEntry> revokedCertificates =
+        crlInfo.getX509CRL().getRevokedCertificates();
+    assertEquals(1L, revokedCertificates.size());
+    assertEquals(x509Certificate.getSerialNumber(),
+        revokedCertificates.iterator().next().getSerialNumber());
+
+    // Now trying to revoke the already revoked certificate should result in
+    // a warning message and no-op. It should not create a new CRL.
+    sequenceId = scmCertStore.revokeCertificates(certs,
+        caCertificateHolder,
+        CRLReason.lookup(CRLReason.unspecified), now, crlApprover);
+
+    assertFalse(sequenceId.isPresent());
+
+    assertEquals(1L,
+        getTableSize(scmMetadataStore.getCRLInfoTable().iterator()));
+
+    // Generate 3 more certificates and revoke 2 of them
+    List<BigInteger> newSerialIDs = new ArrayList<>();
+    for (int i = 0; i<3; i++) {
+      X509Certificate cert = generateX509Cert();
+      scmCertStore.storeValidCertificate(cert.getSerialNumber(), cert);
+      newSerialIDs.add(cert.getSerialNumber());
+    }
+
+    // Add the first 2 certificates to the revocation list
+    sequenceId = scmCertStore.revokeCertificates(newSerialIDs.subList(0, 2),
+        caCertificateHolder,
+        CRLReason.lookup(CRLReason.aACompromise), now, crlApprover);
+
+    // This should create a CRL with sequence id INITIAL_SEQUENCE_ID + 2
+    // And contain 2 certificates in it
+    assertTrue(sequenceId.isPresent());
+    assertEquals(INITIAL_SEQUENCE_ID + 2L, (long) sequenceId.get());
+
+    // Check the sequence ID table for latest sequence id
+    assertEquals(INITIAL_SEQUENCE_ID + 2L, (long)
+        scmMetadataStore.getCRLSequenceIdTable().get(CRL_SEQUENCE_ID_KEY));
+
+    CRLInfo newCrlInfo = scmMetadataStore.getCRLInfoTable()
+        .get(sequenceId.get());
+    revokedCertificates = newCrlInfo.getX509CRL().getRevokedCertificates();
+    assertEquals(2L, revokedCertificates.size());
+    assertNotNull(
+        revokedCertificates.stream().filter(c ->
+            c.getSerialNumber().equals(newSerialIDs.get(0)))
+            .findAny());
+
+    assertNotNull(
+        revokedCertificates.stream().filter(c ->
+            c.getSerialNumber().equals(newSerialIDs.get(1)))
+            .findAny());
+
+    // Valid certs table should have 1 cert
+    assertEquals(1L,
+        getTableSize(scmMetadataStore.getValidCertsTable().iterator()));
+    // Make sure that the last certificate that was not revoked is the one
+    // in the valid certs table.
+    assertEquals(newSerialIDs.get(2),
+        scmMetadataStore.getValidCertsTable().iterator().next().getKey());
+
+    // Revoked certs table should have 3 certs
+    assertEquals(3L,
+        getTableSize(scmMetadataStore.getRevokedCertsTable().iterator()));
+  }
+
+  @Test
+  public void testRevokeCertificatesForFutureTime() throws Exception {
+    BigInteger serialID = x509Certificate.getSerialNumber();
+    scmCertStore.storeValidCertificate(serialID, x509Certificate);
+    Date now = new Date();
+    // Set revocation time in the future
+    Date revocationTime = new Date(now.getTime()+500);
+
+
+    X509CertificateHolder caCertificateHolder =
+        new X509CertificateHolder(generateX509Cert().getEncoded());
+    List<BigInteger> certs = new ArrayList<>();
+    certs.add(x509Certificate.getSerialNumber());
+    Optional<Long> sequenceId = scmCertStore.revokeCertificates(certs,
+        caCertificateHolder,
+        CRLReason.lookup(CRLReason.keyCompromise), revocationTime,
+        crlApprover);
+
+    assertTrue(sequenceId.isPresent());
+    assertEquals(INITIAL_SEQUENCE_ID + 1L, (long) sequenceId.get());
+
+    assertNotNull(
+        scmCertStore.getCertificateByID(serialID,
+            CertificateStore.CertType.VALID_CERTS));
+
+    assertNull(
+        scmCertStore.getCertificateByID(serialID,
+            CertificateStore.CertType.REVOKED_CERTS));
+  }
+
+  private X509Certificate generateX509Cert() throws Exception {
+    return CertificateCodec.getX509Certificate(
+        CertificateCodec.getPEMEncodedString(
+            KeyStoreTestUtil.generateCertificate("CN=Test", keyPair, 30,
+        "SHA256withRSA")));
+  }
+
+  private long getTableSize(Iterator iterator) {
+    long size = 0;
+
+    while(iterator.hasNext()) {
+      size++;
+      iterator.next();
+    }
+
+    return size;
+  }
+}
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestStorageContainerManagerStarter.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestStorageContainerManagerStarter.java
index 56f9f0a..09dd796 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestStorageContainerManagerStarter.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestStorageContainerManagerStarter.java
@@ -170,6 +170,7 @@ public class TestStorageContainerManagerStarter {
     private boolean generateCalled = false;
     private String clusterId = null;
 
+    @Override
     public void start(OzoneConfiguration conf) throws Exception {
       if (throwOnStart) {
         throw new Exception("Simulated error on start");
@@ -177,6 +178,7 @@ public class TestStorageContainerManagerStarter {
       startCalled = true;
     }
 
+    @Override
     public boolean init(OzoneConfiguration conf, String cid)
         throws IOException {
       if (throwOnInit) {
@@ -187,6 +189,7 @@ public class TestStorageContainerManagerStarter {
       return initStatus;
     }
 
+    @Override
     public boolean bootStrap(OzoneConfiguration conf)
         throws IOException {
       if (throwOnBootstrap) {
@@ -195,6 +198,8 @@ public class TestStorageContainerManagerStarter {
       bootStrapCalled = true;
       return initStatus;
     }
+
+    @Override
     public String generateClusterId() {
       generateCalled = true;
       return "static-cluster-id";
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerOperationClient.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerOperationClient.java
index 66f8f63..1435458 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerOperationClient.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerOperationClient.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
+import com.google.common.base.Preconditions;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hadoop.conf.StorageUnit;
 import org.apache.hadoop.hdds.conf.ConfigurationSource;
@@ -44,15 +45,14 @@ import org.apache.hadoop.hdds.security.x509.SecurityConfig;
 import org.apache.hadoop.hdds.tracing.TracingUtil;
 import org.apache.hadoop.ozone.OzoneSecurityUtil;
 
-import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_CONTAINER_SIZE;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_CONTAINER_SIZE_DEFAULT;
 import static org.apache.hadoop.hdds.utils.HddsServerUtil.getScmSecurityClient;
 import static org.apache.hadoop.ozone.ClientVersions.CURRENT_VERSION;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * This class provides the client-facing APIs of container operations.
  */
@@ -475,10 +475,12 @@ public class ContainerOperationClient implements ScmClient {
    * @return Returns true if SCM is in safe mode else returns false.
    * @throws IOException
    */
+  @Override
   public boolean inSafeMode() throws IOException {
     return storageContainerLocationClient.inSafeMode();
   }
 
+  @Override
   public Map<String, Pair<Boolean, String>> getSafeModeRuleStatuses()
       throws IOException {
     return storageContainerLocationClient.getSafeModeRuleStatuses();
@@ -513,4 +515,20 @@ public class ContainerOperationClient implements ScmClient {
   public List<String> getScmRatisRoles() throws IOException {
     return storageContainerLocationClient.getScmInfo().getRatisPeerRoles();
   }
+
+  /**
+   * Get Datanode Usage information by ipaddress or uuid.
+   *
+   * @param ipaddress - datanode ipaddress String
+   * @param uuid - datanode uuid String
+   * @return List of DatanodeUsageInfo. Each element contains info such as
+   * capacity, SCMused, and remaining space.
+   * @throws IOException
+   */
+  @Override
+  public List<HddsProtos.DatanodeUsageInfo> getDatanodeUsageInfo(
+      String ipaddress, String uuid) throws IOException {
+    return storageContainerLocationClient.getDatanodeUsageInfo(ipaddress,
+        uuid);
+  }
 }
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java
index bb442e0..e6888b8 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/TopologySubcommand.java
@@ -85,6 +85,7 @@ public class TopologySubcommand extends ScmSubcommand
     }
   }
 
+  @Override
   public Class<?> getParentType() {
     return OzoneAdmin.class;
   }
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/container/InfoSubcommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/container/InfoSubcommand.java
index 0a2ac4a..65884d2 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/container/InfoSubcommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/container/InfoSubcommand.java
@@ -29,8 +29,10 @@ import org.apache.hadoop.hdds.scm.container.common.helpers
     .ContainerWithPipeline;
 
 import com.google.common.base.Preconditions;
+import org.apache.hadoop.hdds.server.JsonUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import picocli.CommandLine;
 import picocli.CommandLine.Command;
 import picocli.CommandLine.Model.CommandSpec;
 import picocli.CommandLine.Parameters;
@@ -52,6 +54,11 @@ public class InfoSubcommand extends ScmSubcommand {
   @Spec
   private CommandSpec spec;
 
+  @CommandLine.Option(names = { "--json" },
+      defaultValue = "false",
+      description = "Format output as JSON")
+  private boolean json;
+
   @Parameters(description = "Decimal id of the container.")
   private long containerID;
 
@@ -61,22 +68,26 @@ public class InfoSubcommand extends ScmSubcommand {
         getContainerWithPipeline(containerID);
     Preconditions.checkNotNull(container, "Container cannot be null");
 
-    // Print container report info.
-    LOG.info("Container id: {}", containerID);
-    boolean verbose = spec.root().userObject() instanceof GenericParentCommand
-        && ((GenericParentCommand) spec.root().userObject()).isVerbose();
-    if (verbose) {
-      LOG.info("Pipeline Info: {}", container.getPipeline());
+    if (json) {
+      LOG.info(JsonUtils.toJsonStringWithDefaultPrettyPrinter(container));
     } else {
-      LOG.info("Pipeline id: {}", container.getPipeline().getId().getId());
-    }
-    LOG.info("Container State: {}", container.getContainerInfo().getState());
+      // Print container report info.
+      LOG.info("Container id: {}", containerID);
+      boolean verbose = spec.root().userObject() instanceof GenericParentCommand
+          && ((GenericParentCommand) spec.root().userObject()).isVerbose();
+      if (verbose) {
+        LOG.info("Pipeline Info: {}", container.getPipeline());
+      } else {
+        LOG.info("Pipeline id: {}", container.getPipeline().getId().getId());
+      }
+      LOG.info("Container State: {}", container.getContainerInfo().getState());
 
-    // Print pipeline of an existing container.
-    String machinesStr = container.getPipeline().getNodes().stream().map(
-        InfoSubcommand::buildDatanodeDetails)
-        .collect(Collectors.joining(",\n"));
-    LOG.info("Datanodes: [{}]", machinesStr);
+      // Print pipeline of an existing container.
+      String machinesStr = container.getPipeline().getNodes().stream().map(
+          InfoSubcommand::buildDatanodeDetails)
+          .collect(Collectors.joining(",\n"));
+      LOG.info("Datanodes: [{}]", machinesStr);
+    }
   }
 
   private static String buildDatanodeDetails(DatanodeDetails details) {
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DatanodeCommands.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DatanodeCommands.java
index 4f8d4d1..8cb2114 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DatanodeCommands.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DatanodeCommands.java
@@ -17,18 +17,17 @@
  */
 package org.apache.hadoop.hdds.scm.cli.datanode;
 
-import java.util.concurrent.Callable;
-
 import org.apache.hadoop.hdds.cli.GenericCli;
 import org.apache.hadoop.hdds.cli.HddsVersionProvider;
 import org.apache.hadoop.hdds.cli.OzoneAdmin;
 import org.apache.hadoop.hdds.cli.SubcommandWithParent;
-
 import org.kohsuke.MetaInfServices;
 import picocli.CommandLine;
 import picocli.CommandLine.Model.CommandSpec;
 import picocli.CommandLine.Spec;
 
+import java.util.concurrent.Callable;
+
 /**
  * Subcommand for datanode related operations.
  */
@@ -41,7 +40,8 @@ import picocli.CommandLine.Spec;
         ListInfoSubcommand.class,
         DecommissionSubCommand.class,
         MaintenanceSubCommand.class,
-        RecommissionSubCommand.class
+        RecommissionSubCommand.class,
+        UsageInfoSubcommand.class
     })
 @MetaInfServices(SubcommandWithParent.class)
 public class DatanodeCommands implements Callable<Void>, SubcommandWithParent {
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionSubCommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionSubCommand.java
index a4e7e3f..b4fa5ea 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionSubCommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionSubCommand.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hdds.scm.cli.datanode;
 
+import org.apache.hadoop.hdds.cli.GenericCli;
 import org.apache.hadoop.hdds.cli.HddsVersionProvider;
 import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
 import org.apache.hadoop.hdds.scm.client.ScmClient;
@@ -36,11 +37,20 @@ import java.util.List;
     versionProvider = HddsVersionProvider.class)
 public class DecommissionSubCommand extends ScmSubcommand {
 
+  @CommandLine.Spec
+  private CommandLine.Model.CommandSpec spec;
+
   @CommandLine.Parameters(description = "List of fully qualified host names")
-  private List<String> hosts = new ArrayList<String>();
+  private List<String> hosts = new ArrayList<>();
 
   @Override
   public void execute(ScmClient scmClient) throws IOException {
-    scmClient.decommissionNodes(hosts);
+    if (hosts.size() > 0) {
+      scmClient.decommissionNodes(hosts);
+      System.out.println("Started decommissioning datanode(s):\n" +
+          String.join("\n", hosts));
+    } else {
+      GenericCli.missingSubcommand(spec);
+    }
   }
 }
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
index 38ad390..53da082 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
@@ -94,7 +94,7 @@ public class ListInfoSubcommand extends ScmSubcommand {
           p -> p.getNodes().contains(datanode)).collect(Collectors.toList());
       if (relatedPipelines.isEmpty()) {
         pipelineListInfo.append("No related pipelines" +
-            " or the node is not in Healthy state.");
+            " or the node is not in Healthy state.\n");
       } else {
         relatedPipelineNum = relatedPipelines.size();
         relatedPipelines.forEach(
@@ -114,7 +114,7 @@ public class ListInfoSubcommand extends ScmSubcommand {
         + "/" + datanode.getHostName() + "/" + relatedPipelineNum +
         " pipelines)");
     System.out.println("Operational State: " + dna.getOpState());
-    System.out.println("Related pipelines: \n" + pipelineListInfo);
+    System.out.println("Related pipelines:\n" + pipelineListInfo);
   }
 
   private static class DatanodeWithAttributes {
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/MaintenanceSubCommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/MaintenanceSubCommand.java
index fa1d802..2bdf072 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/MaintenanceSubCommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/MaintenanceSubCommand.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hdds.scm.cli.datanode;
 
+import org.apache.hadoop.hdds.cli.GenericCli;
 import org.apache.hadoop.hdds.cli.HddsVersionProvider;
 import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
 import org.apache.hadoop.hdds.scm.client.ScmClient;
@@ -36,8 +37,11 @@ import java.util.List;
     versionProvider = HddsVersionProvider.class)
 public class MaintenanceSubCommand extends ScmSubcommand {
 
+  @CommandLine.Spec
+  private CommandLine.Model.CommandSpec spec;
+
   @CommandLine.Parameters(description = "List of fully qualified host names")
-  private List<String> hosts = new ArrayList<String>();
+  private List<String> hosts = new ArrayList<>();
 
   @CommandLine.Option(names = {"--end"},
       description = "Automatically end maintenance after the given hours. "+
@@ -46,6 +50,12 @@ public class MaintenanceSubCommand extends ScmSubcommand {
 
   @Override
   public void execute(ScmClient scmClient) throws IOException {
-    scmClient.startMaintenanceNodes(hosts, endInHours);
+    if (hosts.size() > 0) {
+      scmClient.startMaintenanceNodes(hosts, endInHours);
+      System.out.println("Entering maintenance mode on datanode(s):\n" +
+          String.join("\n", hosts));
+    } else {
+      GenericCli.missingSubcommand(spec);
+    }
   }
-}
\ No newline at end of file
+}
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/RecommissionSubCommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/RecommissionSubCommand.java
index b6e2f3d..2c731af 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/RecommissionSubCommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/RecommissionSubCommand.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hdds.scm.cli.datanode;
 
+import org.apache.hadoop.hdds.cli.GenericCli;
 import org.apache.hadoop.hdds.cli.HddsVersionProvider;
 import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
 import org.apache.hadoop.hdds.scm.client.ScmClient;
@@ -27,6 +28,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
+ * Recommission one or more datanodes.
  * Place decommissioned or maintenance nodes back into service.
  */
 @Command(
@@ -36,11 +38,20 @@ import java.util.List;
     versionProvider = HddsVersionProvider.class)
 public class RecommissionSubCommand extends ScmSubcommand {
 
+  @CommandLine.Spec
+  private CommandLine.Model.CommandSpec spec;
+
   @CommandLine.Parameters(description = "List of fully qualified host names")
-  private List<String> hosts = new ArrayList<String>();
+  private List<String> hosts = new ArrayList<>();
 
   @Override
   public void execute(ScmClient scmClient) throws IOException {
-    scmClient.recommissionNodes(hosts);
+    if (hosts.size() > 0) {
+      scmClient.recommissionNodes(hosts);
+      System.out.println("Started recommissioning datanode(s):\n" +
+          String.join("\n", hosts));
+    } else {
+      GenericCli.missingSubcommand(spec);
+    }
   }
-}
\ No newline at end of file
+}
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
new file mode 100644
index 0000000..ff8d624
--- /dev/null
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdds.scm.cli.datanode;
+
+import com.google.common.base.Strings;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
+import org.apache.hadoop.hdds.scm.client.ScmClient;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+import java.io.IOException;
+import java.text.NumberFormat;
+import java.util.List;
+
+/**
+ * Command to list the usage info of a datanode.
+ */
+@Command(
+    name = "usageinfo",
+    description = "List usage information " +
+        "(such as Capacity, SCMUsed, Remaining) of a datanode by IP address " +
+        "or UUID",
+    mixinStandardHelpOptions = true,
+    versionProvider = HddsVersionProvider.class)
+public class UsageInfoSubcommand extends ScmSubcommand {
+
+  @CommandLine.Option(names = {"--ip"}, paramLabel = "IP", description =
+      "Show info by datanode ip address")
+  private String ipaddress;
+
+  @CommandLine.Option(names = {"--uuid"}, paramLabel = "UUID", description =
+      "Show info by datanode UUID")
+  private String uuid;
+
+  public String getIpaddress() {
+    return ipaddress;
+  }
+
+  public void setIpaddress(String ipaddress) {
+    this.ipaddress = ipaddress;
+  }
+
+  public String getUuid() {
+    return uuid;
+  }
+
+  public void setUuid(String uuid) {
+    this.uuid = uuid;
+  }
+
+  @Override
+  public void execute(ScmClient scmClient) throws IOException {
+    if (Strings.isNullOrEmpty(ipaddress)) {
+      ipaddress = "";
+    }
+    if (Strings.isNullOrEmpty(uuid)) {
+      uuid = "";
+    }
+    if (Strings.isNullOrEmpty(ipaddress) && Strings.isNullOrEmpty(uuid)) {
+      throw new IOException("ipaddress or uuid of the datanode must be " +
+          "specified.");
+    }
+
+    List<HddsProtos.DatanodeUsageInfo> infoList =
+        scmClient.getDatanodeUsageInfo(ipaddress, uuid);
+
+    for (HddsProtos.DatanodeUsageInfo info : infoList) {
+      printInfo(info);
+    }
+  }
+
+  public void printInfo(HddsProtos.DatanodeUsageInfo info) {
+    Double capacity = (double)info.getCapacity();
+    Double usedRatio = info.getUsed() / capacity;
+    Double remainingRatio = info.getRemaining() / capacity;
+    NumberFormat percentFormat = NumberFormat.getPercentInstance();
+    percentFormat.setMinimumFractionDigits(5);
+
+    System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
+    System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+        percentFormat.format(usedRatio));
+    System.out.printf("%-10s: %20sB (%s) %n%n",
+        "Remaining", info.getRemaining(),
+        percentFormat.format(remainingRatio));
+  }
+}
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java
index a837fea..c8bf7db 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java
@@ -22,7 +22,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -96,6 +98,47 @@ public class KeyInputStream extends InputStream
     return new LengthInputStream(keyInputStream, keyInputStream.length);
   }
 
+  public static List<LengthInputStream> getStreamsFromKeyInfo(OmKeyInfo keyInfo,
+      XceiverClientFactory xceiverClientFactory, boolean verifyChecksum,
+      Function<OmKeyInfo, OmKeyInfo> retryFunction) {
+    List<OmKeyLocationInfo> keyLocationInfos = keyInfo
+        .getLatestVersionLocations().getBlocksLatestVersionOnly();
+
+    List<LengthInputStream> lengthInputStreams = new ArrayList<>();
+
+    // Iterate through each block info in keyLocationInfos and assign it the
+    // corresponding part in the partsToBlockMap. Also increment each part's
+    // length accordingly.
+    Map<Integer, List<OmKeyLocationInfo>> partsToBlocksMap = new HashMap<>();
+    Map<Integer, Long> partsLengthMap = new HashMap<>();
+
+    for (OmKeyLocationInfo omKeyLocationInfo: keyLocationInfos) {
+      int partNumber = omKeyLocationInfo.getPartNumber();
+
+      if (!partsToBlocksMap.containsKey(partNumber)) {
+        partsToBlocksMap.put(partNumber, new ArrayList<>());
+        partsLengthMap.put(partNumber, 0L);
+      }
+      // Add Block to corresponding partNumber in partsToBlocksMap
+      partsToBlocksMap.get(partNumber).add(omKeyLocationInfo);
+      // Update the part length
+      partsLengthMap.put(partNumber,
+          partsLengthMap.get(partNumber) + omKeyLocationInfo.getLength());
+    }
+
+    // Create a KeyInputStream for each part.
+    for (Map.Entry<Integer, List<OmKeyLocationInfo>> entry :
+        partsToBlocksMap.entrySet()) {
+      KeyInputStream keyInputStream = new KeyInputStream();
+      keyInputStream.initialize(keyInfo, entry.getValue(),
+          xceiverClientFactory, verifyChecksum, retryFunction);
+      lengthInputStreams.add(new LengthInputStream(keyInputStream,
+          partsLengthMap.get(entry.getKey())));
+    }
+
+    return lengthInputStreams;
+  }
+
   private synchronized void initialize(OmKeyInfo keyInfo,
       List<OmKeyLocationInfo> blockInfos,
       XceiverClientFactory xceiverClientFactory,
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/MultipartCryptoKeyInputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/MultipartCryptoKeyInputStream.java
new file mode 100644
index 0000000..07c0464
--- /dev/null
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/MultipartCryptoKeyInputStream.java
@@ -0,0 +1,375 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.client.io;
+
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.crypto.CryptoInputStream;
+import org.apache.hadoop.fs.CanUnbuffer;
+import org.apache.hadoop.fs.FSExceptionMessages;
+import org.apache.hadoop.fs.Seekable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class MultipartCryptoKeyInputStream extends OzoneInputStream
+    implements Seekable, CanUnbuffer {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(MultipartCryptoKeyInputStream.class);
+
+  private static final int EOF = -1;
+
+  private String key;
+  private long length = 0L;
+  private boolean closed = false;
+
+  // List of OzoneCryptoInputStream, one for each part of the key
+  private List<OzoneCryptoInputStream> partStreams;
+
+  // partOffsets[i] stores the index of the first data byte in
+  // partStream w.r.t the whole key data.
+  // For example, let’s say the part size is 200 bytes and part[0] stores
+  // data from indices 0 - 199, part[1] from indices 200 - 399 and so on.
+  // Then, partOffsets[0] = 0 (the offset of the first byte of data in
+  // part[0]), partOffsets[1] = 200 and so on.
+  private long[] partOffsets;
+
+  // Index of the partStream corresponding to the current position of the
+  // MultipartCryptoKeyInputStream.
+  private int partIndex = 0;
+
+  // Tracks the partIndex corresponding to the last seeked position so that it
+  // can be reset if a new position is seeked.
+  private int prevPartIndex = 0;
+
+  // If a read's start/ length position doesn't coincide with a Crypto buffer
+  // boundary, it will be adjusted as reads should happen only at the buffer
+  // boundaries for decryption to happen correctly. In this case, after the
+  // data has been read and decrypted, only the requested data should be
+  // returned to the client. readPositionAdjustedBy and readLengthAdjustedBy
+  // store these adjustment information. Before returning to client, the first
+  // readPositionAdjustedBy number of bytes and the last readLengthAdjustedBy
+  // number of bytes must be discarded.
+  private int readPositionAdjustedBy = 0;
+  private int readLengthAdjustedBy = 0;
+
+  public MultipartCryptoKeyInputStream(String keyName,
+      List<OzoneCryptoInputStream> inputStreams) {
+
+    Preconditions.checkNotNull(inputStreams);
+
+    this.key = keyName;
+    this.partStreams = inputStreams;
+
+    // Calculate and update the partOffsets
+    this.partOffsets = new long[inputStreams.size()];
+    int i = 0;
+    for (OzoneCryptoInputStream ozoneCryptoInputStream : inputStreams) {
+      this.partOffsets[i++] = length;
+      length += ozoneCryptoInputStream.getLength();
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public int read() throws IOException {
+    byte[] buf = new byte[1];
+    if (read(buf, 0, 1) == EOF) {
+      return EOF;
+    }
+    return Byte.toUnsignedInt(buf[0]);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public int read(byte[] b, int off, int len) throws IOException {
+    checkOpen();
+    if (b == null) {
+      throw new NullPointerException();
+    }
+    if (off < 0 || len < 0 || len > b.length - off) {
+      throw new IndexOutOfBoundsException();
+    }
+    if (len == 0) {
+      return 0;
+    }
+    int totalReadLen = 0;
+    while (len > 0) {
+      if (partStreams.size() == 0 ||
+          (partStreams.size() - 1 <= partIndex &&
+              partStreams.get(partIndex).getRemaining() == 0)) {
+        return totalReadLen == 0 ? EOF : totalReadLen;
+      }
+
+      // Get the current partStream and read data from it
+      OzoneCryptoInputStream current = partStreams.get(partIndex);
+      // CryptoInputStream reads hadoop.security.crypto.buffer.size number of
+      // bytes (default 8KB) at a time. This needs to be taken into account
+      // in calculating the numBytesToRead.
+      int numBytesToRead = getNumBytesToRead(len, (int)current.getRemaining(),
+          current.getBufferSize());
+      int numBytesRead;
+
+      if (readPositionAdjustedBy != 0 || readLengthAdjustedBy != 0) {
+        // There was some adjustment made in position and/ or length of data
+        // to be read to account for Crypto buffer boundary. Hence, read the
+        // data into a temp buffer and then copy only the requested data into
+        // clients buffer.
+        byte[] tempBuffer = new byte[numBytesToRead];
+        int actualNumBytesRead = current.read(tempBuffer, 0,
+            numBytesToRead);
+        numBytesRead = actualNumBytesRead - readPositionAdjustedBy -
+            readLengthAdjustedBy;
+
+        if (actualNumBytesRead != numBytesToRead) {
+          throw new IOException(String.format("Inconsistent read for key=%s " +
+                  "part=%d length=%d numBytesToRead(accounting for Crypto " +
+                  "boundaries)=%d numBytesRead(actual)=%d " +
+                  "numBytesToBeRead(into client buffer discarding crypto " +
+                  "boundary adjustments)=%d",
+              key, partIndex, current.getLength(), numBytesToRead,
+              actualNumBytesRead, numBytesRead));
+        }
+
+        // TODO: Byte array copies are not optimal. If there is a better and
+        //  more optimal solution to copy only a part of read data into
+        //  client buffer, this should be updated.
+        System.arraycopy(tempBuffer, readPositionAdjustedBy, b, off,
+            numBytesRead);
+
+        LOG.debug("OzoneCryptoInputStream for key: {} part: {} read {} bytes " +
+                "instead of {} bytes to account for Crypto buffer boundary. " +
+                "Client buffer will be copied with read data from position {}" +
+                "upto position {}, discarding the extra bytes read to " +
+                "maintain Crypto buffer boundary limits", key, partIndex,
+            actualNumBytesRead, numBytesRead, readPositionAdjustedBy,
+            actualNumBytesRead - readPositionAdjustedBy);
+
+        // Reset readPositionAdjustedBy and readLengthAdjustedBy
+        readPositionAdjustedBy = 0;
+        readLengthAdjustedBy = 0;
+      } else {
+        numBytesRead = current.read(b, off, numBytesToRead);
+        if (numBytesRead != numBytesToRead) {
+          throw new IOException(String.format("Inconsistent read for key=%s " +
+                  "part=%d length=%d numBytesToRead=%d numBytesRead=%d",
+              key, partIndex, current.getLength(), numBytesToRead,
+              numBytesRead));
+        }
+      }
+
+      totalReadLen += numBytesRead;
+      off += numBytesRead;
+      len -= numBytesRead;
+
+      if (current.getRemaining() <= 0 &&
+          ((partIndex + 1) < partStreams.size())) {
+        partIndex += 1;
+      }
+
+    }
+    return totalReadLen;
+  }
+
+  /**
+   * Get number of bytes to read from the current stream based on the length
+   * to be read, number of bytes remaining in the stream and the Crypto buffer
+   * size.
+   * Reads should be performed at the CryptoInputStream Buffer boundaries only.
+   * Otherwise, the decryption will be incorrect.
+   */
+  private int getNumBytesToRead(int lenToRead, int remaining,
+      int cryptoBufferSize) throws IOException {
+
+    Preconditions.checkArgument(readPositionAdjustedBy == 0);
+    Preconditions.checkArgument(readLengthAdjustedBy == 0);
+
+    // Check and adjust position if required
+    adjustReadPosition(cryptoBufferSize);
+    remaining += readPositionAdjustedBy;
+    lenToRead += readPositionAdjustedBy;
+
+    return adjustNumBytesToRead(lenToRead, remaining, cryptoBufferSize);
+  }
+
+  /**
+   * Reads should be performed at the CryptoInputStream Buffer boundary size.
+   * Otherwise, the decryption will be incorrect. Hence, if the position is
+   * not at the boundary limit, we have to adjust the position and might need
+   * to read more data than requested. The extra data will be filtered out
+   * before returning to the client.
+   */
+  private void adjustReadPosition(long cryptoBufferSize) throws IOException {
+    // Position of the buffer in current stream
+    long currentPosOfStream = partStreams.get(partIndex).getPos();
+    int modulus = (int) (currentPosOfStream % cryptoBufferSize);
+    if (modulus != 0) {
+      // Adjustment required.
+      // Update readPositionAdjustedBy and seek to the adjusted position
+      readPositionAdjustedBy = modulus;
+      // Seek current partStream to adjusted position. We do not need to
+      // reset the seeked positions of other streams.
+      partStreams.get(partIndex)
+          .seek(currentPosOfStream - readPositionAdjustedBy);
+      LOG.debug("OzoneCryptoInputStream for key: {} part: {} adjusted " +
+              "position {} by -{} to account for Crypto buffer boundary",
+          key, partIndex, currentPosOfStream, readPositionAdjustedBy);
+    }
+  }
+
+  /**
+   * If the length of data requested does not end at a Crypto Buffer
+   * boundary, the number of bytes to be read must be adjusted accordingly.
+   * The extra data will be filtered out before returning to the client.
+   */
+  private int adjustNumBytesToRead(int lenToRead, int remaining,
+      int cryptoBufferSize) {
+    int numBytesToRead = Math.min(cryptoBufferSize, remaining);
+    if (lenToRead < numBytesToRead) {
+      // Adjustment required; Update readLengthAdjustedBy.
+      readLengthAdjustedBy = numBytesToRead - lenToRead;
+      LOG.debug("OzoneCryptoInputStream for key: {} part: {} adjusted length " +
+              "by +{} to account for Crypto buffer boundary",
+          key, partIndex, readLengthAdjustedBy);
+    }
+    return numBytesToRead;
+  }
+
+  /**
+   * Seeks the InputStream to the specified position. This involves 2 steps:
+   *    1. Updating the partIndex to the partStream corresponding to the
+   *    seeked position.
+   *    2. Seeking the corresponding partStream to the adjusted position.
+   *
+   * For example, let’s say the part sizes are 200 bytes and part[0] stores
+   * data from indices 0 - 199, part[1] from indices 200 - 399 and so on.
+   * Let’s say we seek to position 240. In the first step, the partIndex
+   * would be updated to 1 as indices 200 - 399 reside in partStream[1]. In
+   * the second step, the partStream[1] would be seeked to position 40 (=
+   * 240 - blockOffset[1] (= 200)).
+   */
+  @Override
+  public void seek(long pos) throws IOException {
+    if (pos == 0 && length == 0) {
+      // It is possible for length and pos to be zero in which case
+      // seek should return instead of throwing exception
+      return;
+    }
+    if (pos < 0 || pos > length) {
+      throw new EOFException("EOF encountered at pos: " + pos);
+    }
+
+    // 1. Update the partIndex
+    if (partIndex >= partStreams.size()) {
+      partIndex = Arrays.binarySearch(partOffsets, pos);
+    } else if (pos < partOffsets[partIndex]) {
+      partIndex =
+          Arrays.binarySearch(partOffsets, 0, partIndex, pos);
+    } else if (pos >= partOffsets[partIndex] + partStreams
+        .get(partIndex).getLength()) {
+      partIndex = Arrays.binarySearch(partOffsets, partIndex + 1,
+          partStreams.size(), pos);
+    }
+    if (partIndex < 0) {
+      // Binary search returns -insertionPoint - 1  if element is not present
+      // in the array. insertionPoint is the point at which element would be
+      // inserted in the sorted array. We need to adjust the blockIndex
+      // accordingly so that partIndex = insertionPoint - 1
+      partIndex = -partIndex - 2;
+    }
+
+    // Reset the previous partStream's position
+    partStreams.get(prevPartIndex).seek(0);
+
+    // Reset all the partStreams above the partIndex. We do this to reset
+    // any previous reads which might have updated the higher part
+    // streams position.
+    for (int index = partIndex + 1; index < partStreams.size(); index++) {
+      partStreams.get(index).seek(0);
+    }
+    // 2. Seek the partStream to the adjusted position
+    partStreams.get(partIndex).seek(pos - partOffsets[partIndex]);
+    prevPartIndex = partIndex;
+  }
+
+  @Override
+  public synchronized long getPos() throws IOException {
+    checkOpen();
+    return length == 0 ? 0 : partOffsets[partIndex] +
+        partStreams.get(partIndex).getPos();
+  }
+
+  @Override
+  public boolean seekToNewSource(long targetPos) throws IOException {
+    return false;
+  }
+
+  @Override
+  public int available() throws IOException {
+    checkOpen();
+    long remaining = length - getPos();
+    return remaining <= Integer.MAX_VALUE ? (int) remaining : Integer.MAX_VALUE;
+  }
+
+  @Override
+  public void unbuffer() {
+    for (CryptoInputStream cryptoInputStream : partStreams) {
+      cryptoInputStream.unbuffer();
+    }
+  }
+
+  @Override
+  public long skip(long n) throws IOException {
+    if (n <= 0) {
+      return 0;
+    }
+
+    long toSkip = Math.min(n, length - getPos());
+    seek(getPos() + toSkip);
+    return toSkip;
+  }
+
+  @Override
+  public synchronized void close() throws IOException {
+    closed = true;
+    for (OzoneCryptoInputStream partStream : partStreams) {
+      partStream.close();
+    }
+  }
+
+  /**
+   * Verify that the input stream is open. Non blocking; this gives
+   * the last state of the volatile {@link #closed} field.
+   * @throws IOException if the connection is closed.
+   */
+  private void checkOpen() throws IOException {
+    if (closed) {
+      throw new IOException(
+          ": " + FSExceptionMessages.STREAM_IS_CLOSED + " Key: " + key);
+    }
+  }
+}
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneCryptoInputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneCryptoInputStream.java
new file mode 100644
index 0000000..9d5d888
--- /dev/null
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneCryptoInputStream.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.client.io;
+
+import java.io.IOException;
+import org.apache.hadoop.crypto.CryptoCodec;
+import org.apache.hadoop.crypto.CryptoInputStream;
+import org.apache.hadoop.crypto.CryptoStreamUtils;
+import org.apache.hadoop.fs.Seekable;
+
+/**
+ * A CryptoInputStream for Ozone with length. This stream is used to read
+ * Keys in Encrypted Buckets.
+ */
+public class OzoneCryptoInputStream extends CryptoInputStream
+    implements Seekable {
+
+  private final long length;
+  private final int bufferSize;
+
+  public OzoneCryptoInputStream(LengthInputStream in,
+      CryptoCodec codec, byte[] key, byte[] iv) throws IOException {
+    super(in.getWrappedStream(), codec, key, iv);
+    this.length = in.getLength();
+    // This is the buffer size used while creating the CryptoInputStream
+    // internally
+    this.bufferSize = CryptoStreamUtils.getBufferSize(codec.getConf());
+  }
+
+  public long getLength() {
+    return length;
+  }
+
+  public int getBufferSize() {
+    return bufferSize;
+  }
+
+  public long getRemaining() throws IOException {
+    return length - getPos();
+  }
+}
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java
index f01975c..fb3928d 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java
@@ -30,6 +30,9 @@ public class OzoneInputStream extends InputStream implements CanUnbuffer {
 
   private final InputStream inputStream;
 
+  public OzoneInputStream() {
+    inputStream = null;
+  }
   /**
    * Constructs OzoneInputStream with KeyInputStream.
    *
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java
index e4a7d6a..bf88b6f 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java
@@ -17,6 +17,7 @@
 
 package org.apache.hadoop.ozone.client.io;
 
+import org.apache.hadoop.crypto.CryptoOutputStream;
 import org.apache.hadoop.ozone.om.helpers.OmMultipartCommitUploadPartInfo;
 
 import java.io.IOException;
@@ -63,6 +64,12 @@ public class OzoneOutputStream extends OutputStream {
   public OmMultipartCommitUploadPartInfo getCommitUploadPartInfo() {
     if (outputStream instanceof KeyOutputStream) {
       return ((KeyOutputStream) outputStream).getCommitUploadPartInfo();
+    } else  if (outputStream instanceof CryptoOutputStream) {
+      OutputStream wrappedStream =
+          ((CryptoOutputStream) outputStream).getWrappedStream();
+      if (wrappedStream instanceof KeyOutputStream) {
+        return ((KeyOutputStream) wrappedStream).getCommitUploadPartInfo();
+      }
     }
     // Otherwise return null.
     return null;
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
index 48aacb6..ed85a32 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
@@ -67,6 +67,8 @@ import org.apache.hadoop.ozone.client.VolumeArgs;
 import org.apache.hadoop.ozone.client.io.KeyInputStream;
 import org.apache.hadoop.ozone.client.io.KeyOutputStream;
 import org.apache.hadoop.ozone.client.io.LengthInputStream;
+import org.apache.hadoop.ozone.client.io.MultipartCryptoKeyInputStream;
+import org.apache.hadoop.ozone.client.io.OzoneCryptoInputStream;
 import org.apache.hadoop.ozone.client.io.OzoneInputStream;
 import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
 import org.apache.hadoop.ozone.client.protocol.ClientProtocol;
@@ -942,7 +944,17 @@ public class RpcClient implements ClientProtocol {
     keyOutputStream.addPreallocateBlocks(
         openKey.getKeyInfo().getLatestVersionLocations(),
         openKey.getOpenVersion());
-    return new OzoneOutputStream(keyOutputStream);
+    FileEncryptionInfo feInfo = keyOutputStream.getFileEncryptionInfo();
+    if (feInfo != null) {
+      KeyProvider.KeyVersion decrypted = getDEK(feInfo);
+      final CryptoOutputStream cryptoOut =
+          new CryptoOutputStream(keyOutputStream,
+              OzoneKMSUtil.getCryptoCodec(conf, feInfo),
+              decrypted.getMaterial(), feInfo.getIV());
+      return new OzoneOutputStream(cryptoOut);
+    } else {
+      return new OzoneOutputStream(keyOutputStream);
+    }
   }
 
   @Override
@@ -1192,23 +1204,18 @@ public class RpcClient implements ClientProtocol {
   private OzoneInputStream createInputStream(
       OmKeyInfo keyInfo, Function<OmKeyInfo, OmKeyInfo> retryFunction)
       throws IOException {
-    LengthInputStream lengthInputStream = KeyInputStream
-        .getFromOmKeyInfo(keyInfo, xceiverClientManager,
-            clientConfig.isChecksumVerify(), retryFunction);
+    // When Key is not MPU or when Key is MPU and encryption is not enabled
+    // Need to revisit for GDP.
     FileEncryptionInfo feInfo = keyInfo.getFileEncryptionInfo();
-    if (feInfo != null) {
-      final KeyProvider.KeyVersion decrypted = getDEK(feInfo);
-      final CryptoInputStream cryptoIn =
-          new CryptoInputStream(lengthInputStream.getWrappedStream(),
-              OzoneKMSUtil.getCryptoCodec(conf, feInfo),
-              decrypted.getMaterial(), feInfo.getIV());
-      return new OzoneInputStream(cryptoIn);
-    } else {
-      try{
-        GDPRSymmetricKey gk;
-        Map<String, String> keyInfoMetadata = keyInfo.getMetadata();
-        if(Boolean.valueOf(keyInfoMetadata.get(OzoneConsts.GDPR_FLAG))){
-          gk = new GDPRSymmetricKey(
+
+    if (feInfo == null) {
+      LengthInputStream lengthInputStream = KeyInputStream
+          .getFromOmKeyInfo(keyInfo, xceiverClientManager,
+              clientConfig.isChecksumVerify(), retryFunction);
+      try {
+        Map< String, String > keyInfoMetadata = keyInfo.getMetadata();
+        if (Boolean.valueOf(keyInfoMetadata.get(OzoneConsts.GDPR_FLAG))) {
+          GDPRSymmetricKey gk = new GDPRSymmetricKey(
               keyInfoMetadata.get(OzoneConsts.GDPR_SECRET),
               keyInfoMetadata.get(OzoneConsts.GDPR_ALGORITHM)
           );
@@ -1216,11 +1223,39 @@ public class RpcClient implements ClientProtocol {
           return new OzoneInputStream(
               new CipherInputStream(lengthInputStream, gk.getCipher()));
         }
-      }catch (Exception ex){
+      } catch (Exception ex) {
         throw new IOException(ex);
       }
+      return new OzoneInputStream(lengthInputStream.getWrappedStream());
+    } else if (!keyInfo.getLatestVersionLocations().isMultipartKey()) {
+      // Regular Key with FileEncryptionInfo
+      LengthInputStream lengthInputStream = KeyInputStream
+          .getFromOmKeyInfo(keyInfo, xceiverClientManager,
+              clientConfig.isChecksumVerify(), retryFunction);
+      final KeyProvider.KeyVersion decrypted = getDEK(feInfo);
+      final CryptoInputStream cryptoIn =
+          new CryptoInputStream(lengthInputStream.getWrappedStream(),
+              OzoneKMSUtil.getCryptoCodec(conf, feInfo),
+              decrypted.getMaterial(), feInfo.getIV());
+      return new OzoneInputStream(cryptoIn);
+    } else {
+      // Multipart Key with FileEncryptionInfo
+      List<LengthInputStream> lengthInputStreams = KeyInputStream
+          .getStreamsFromKeyInfo(keyInfo, xceiverClientManager,
+              clientConfig.isChecksumVerify(), retryFunction);
+      final KeyProvider.KeyVersion decrypted = getDEK(feInfo);
+
+      List<OzoneCryptoInputStream> cryptoInputStreams = new ArrayList<>();
+      for(LengthInputStream lengthInputStream : lengthInputStreams) {
+        final OzoneCryptoInputStream ozoneCryptoInputStream =
+            new OzoneCryptoInputStream(lengthInputStream,
+                OzoneKMSUtil.getCryptoCodec(conf, feInfo),
+                decrypted.getMaterial(), feInfo.getIV());
+        cryptoInputStreams.add(ozoneCryptoInputStream);
+      }
+      return new MultipartCryptoKeyInputStream(keyInfo.getKeyName(),
+          cryptoInputStreams);
     }
-    return new OzoneInputStream(lengthInputStream.getWrappedStream());
   }
 
   private OzoneOutputStream createOutputStream(OpenKeySession openKey,
@@ -1287,6 +1322,7 @@ public class RpcClient implements ClientProtocol {
     return (dtService != null) ? dtService.toString() : null;
   }
 
+  @Override
   @VisibleForTesting
   public OzoneManagerProtocol getOzoneManagerClient() {
     return ozoneManagerClient;
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMProxyInfo.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMProxyInfo.java
index cbfe4a9..e166b6d 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMProxyInfo.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMProxyInfo.java
@@ -61,6 +61,7 @@ public class OMProxyInfo {
     }
   }
 
+  @Override
   public String toString() {
     StringBuilder sb = new StringBuilder()
         .append("nodeId=")
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
index 6481768..43213a9 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
@@ -145,9 +145,12 @@ public final class OmKeyInfo extends WithObjectID {
    *
    * @param locationInfoList list of locationInfo
    */
-  public void updateLocationInfoList(List<OmKeyLocationInfo> locationInfoList) {
+  public void updateLocationInfoList(List<OmKeyLocationInfo> locationInfoList,
+      boolean isMpu) {
     long latestVersion = getLatestVersionLocations().getVersion();
     OmKeyLocationInfoGroup keyLocationInfoGroup = getLatestVersionLocations();
+
+    keyLocationInfoGroup.setMultipartKey(isMpu);
     // Updates the latest locationList in the latest version only with
     // given locationInfoList here.
     // TODO : The original allocated list and the updated list here may vary
@@ -161,6 +164,8 @@ public final class OmKeyInfo extends WithObjectID {
     keyLocationInfoGroup.addAll(latestVersion, locationInfoList);
   }
 
+
+
   /**
    * Append a set of blocks to the latest version. Note that these blocks are
    * part of the latest version, not a new version.
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfo.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfo.java
index 4eac8be..d1a721a 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfo.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfo.java
@@ -42,21 +42,26 @@ public final class OmKeyLocationInfo {
 
   private Pipeline pipeline;
 
+  // PartNumber is set for Multipart upload Keys.
+  private int partNumber = -1;
+
   private OmKeyLocationInfo(BlockID blockID, Pipeline pipeline, long length,
-                            long offset) {
+                            long offset, int partNumber) {
     this.blockID = blockID;
     this.pipeline = pipeline;
     this.length = length;
     this.offset = offset;
+    this.partNumber = partNumber;
   }
 
   private OmKeyLocationInfo(BlockID blockID, Pipeline pipeline, long length,
-      long offset, Token<OzoneBlockTokenIdentifier> token) {
+      long offset, Token<OzoneBlockTokenIdentifier> token, int partNumber) {
     this.blockID = blockID;
     this.pipeline = pipeline;
     this.length = length;
     this.offset = offset;
     this.token = token;
+    this.partNumber = partNumber;
   }
 
   public void setCreateVersion(long version) {
@@ -111,6 +116,14 @@ public final class OmKeyLocationInfo {
     this.pipeline = pipeline;
   }
 
+  public void setPartNumber(int partNumber) {
+    this.partNumber = partNumber;
+  }
+
+  public int getPartNumber() {
+    return partNumber;
+  }
+
   /**
    * Builder of OmKeyLocationInfo.
    */
@@ -120,6 +133,7 @@ public final class OmKeyLocationInfo {
     private long offset;
     private Token<OzoneBlockTokenIdentifier> token;
     private Pipeline pipeline;
+    private int partNumber;
 
     public Builder setBlockID(BlockID blockId) {
       this.blockID = blockId;
@@ -147,8 +161,14 @@ public final class OmKeyLocationInfo {
       return this;
     }
 
+    public Builder setPartNumber(int partNum) {
+      this.partNumber = partNum;
+      return this;
+    }
+
     public OmKeyLocationInfo build() {
-      return new OmKeyLocationInfo(blockID, pipeline, length, offset, token);
+      return new OmKeyLocationInfo(blockID, pipeline, length, offset, token,
+          partNumber);
     }
   }
 
@@ -161,7 +181,7 @@ public final class OmKeyLocationInfo {
         .setBlockID(blockID.getProtobuf())
         .setLength(length)
         .setOffset(offset)
-        .setCreateVersion(createVersion);
+        .setCreateVersion(createVersion).setPartNumber(partNumber);
     if (this.token != null) {
       builder.setToken(OzonePBHelper.protoFromToken(token));
     }
@@ -189,7 +209,7 @@ public final class OmKeyLocationInfo {
         BlockID.getFromProtobuf(keyLocation.getBlockID()),
         getPipeline(keyLocation),
         keyLocation.getLength(),
-        keyLocation.getOffset());
+        keyLocation.getOffset(), keyLocation.getPartNumber());
     if(keyLocation.hasToken()) {
       info.token = (Token<OzoneBlockTokenIdentifier>)
               OzonePBHelper.tokenFromProto(keyLocation.getToken());
@@ -199,14 +219,15 @@ public final class OmKeyLocationInfo {
   }
 
   @Override
-  public String toString() {
+  public String  toString() {
     return "{blockID={containerID=" + blockID.getContainerID() +
         ", localID=" + blockID.getLocalID() + "}" +
         ", length=" + length +
         ", offset=" + offset +
         ", token=" + token +
         ", pipeline=" + pipeline +
-        ", createVersion=" + createVersion + '}';
+        ", createVersion=" + createVersion  + ", partNumber=" + partNumber
+        + '}';
   }
 
   @Override
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
index 440b1cb..a93bcf2 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
@@ -32,9 +32,15 @@ import java.util.stream.Collectors;
 public class OmKeyLocationInfoGroup {
   private final long version;
   private final Map<Long, List<OmKeyLocationInfo>> locationVersionMap;
+  private  boolean isMultipartKey;
 
   public OmKeyLocationInfoGroup(long version,
                                 List<OmKeyLocationInfo> locations) {
+    this(version, locations, false);
+  }
+
+  public OmKeyLocationInfoGroup(long version,
+      List<OmKeyLocationInfo> locations, boolean isMultipartKey) {
     this.version = version;
     locationVersionMap = new HashMap<>();
     for (OmKeyLocationInfo info : locations) {
@@ -44,14 +50,30 @@ public class OmKeyLocationInfoGroup {
     }
     //prevent NPE
     this.locationVersionMap.putIfAbsent(version, new ArrayList<>());
+    this.isMultipartKey = isMultipartKey;
+
   }
 
   public OmKeyLocationInfoGroup(long version,
                                 Map<Long, List<OmKeyLocationInfo>> locations) {
+    this(version, locations, false);
+  }
+
+  public OmKeyLocationInfoGroup(long version,
+      Map<Long, List<OmKeyLocationInfo>> locations, boolean isMultipartKey) {
     this.version = version;
     this.locationVersionMap = locations;
     //prevent NPE
     this.locationVersionMap.putIfAbsent(version, new ArrayList<>());
+    this.isMultipartKey = isMultipartKey;
+  }
+
+  public void setMultipartKey(boolean isMpu) {
+    this.isMultipartKey = isMpu;
+  }
+
+  public boolean isMultipartKey() {
+    return isMultipartKey;
   }
 
   /**
@@ -83,7 +105,7 @@ public class OmKeyLocationInfoGroup {
   public KeyLocationList getProtobuf(boolean ignorePipeline,
       int clientVersion) {
     KeyLocationList.Builder builder = KeyLocationList.newBuilder()
-        .setVersion(version);
+        .setVersion(version).setIsMultipartKey(isMultipartKey);
     List<OzoneManagerProtocolProtos.KeyLocation> keyLocationList =
         new ArrayList<>();
     for (List<OmKeyLocationInfo> locationList : locationVersionMap.values()) {
@@ -100,7 +122,9 @@ public class OmKeyLocationInfoGroup {
         keyLocationList.getVersion(),
         keyLocationList.getKeyLocationsList().stream()
             .map(OmKeyLocationInfo::getFromProtobuf)
-            .collect(Collectors.groupingBy(OmKeyLocationInfo::getCreateVersion))
+            .collect(Collectors.groupingBy(
+                OmKeyLocationInfo::getCreateVersion)),
+        keyLocationList.getIsMultipartKey()
     );
   }
 
@@ -141,6 +165,7 @@ public class OmKeyLocationInfoGroup {
   public String toString() {
     StringBuilder sb = new StringBuilder();
     sb.append("version:").append(version).append(" ");
+    sb.append("isMultipartKey:").append(isMultipartKey);
     for (List<OmKeyLocationInfo> kliList : locationVersionMap.values()) {
       for(OmKeyLocationInfo kli: kliList) {
         sb.append(kli.getLocalID()).append(" || ");
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFileStatus.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFileStatus.java
index d7d49be..cbb7f9a 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFileStatus.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFileStatus.java
@@ -23,7 +23,6 @@ import java.util.Objects;
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneFileStatusProto;
 import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneFileStatusProto.Builder;
 
-import static org.apache.hadoop.ozone.ClientVersions.CURRENT_VERSION;
 import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
 
 /**
@@ -94,14 +93,13 @@ public class OzoneFileStatus {
     return !isDirectory();
   }
 
-  public OzoneFileStatusProto getProtobuf() {
-
+  public OzoneFileStatusProto getProtobuf(int clientVersion) {
     Builder builder = OzoneFileStatusProto.newBuilder()
         .setBlockSize(blockSize)
         .setIsDirectory(isDirectory);
     //key info can be null for the fake root entry.
     if (keyInfo != null) {
-      builder.setKeyInfo(keyInfo.getProtobuf(CURRENT_VERSION));
+      builder.setKeyInfo(keyInfo.getProtobuf(clientVersion));
     }
     return builder.build();
   }
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
index 26dc34b..a2b2f48 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
@@ -648,6 +648,8 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
         .setBucketName(args.getBucketName())
         .setKeyName(args.getKeyName())
         .setDataSize(args.getDataSize())
+        .setType(args.getType())
+        .setFactor(args.getFactor())
         .addAllKeyLocations(locationInfoList.stream()
             // TODO use OM version?
             .map(info -> info.getProtobuf(CURRENT_VERSION))
@@ -784,6 +786,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
    * @param bucket - Name of the bucket.
    * @throws IOException
    */
+  @Override
   public void deleteBucket(String volume, String bucket) throws IOException {
     DeleteBucketRequest.Builder req = DeleteBucketRequest.newBuilder();
     req.setVolumeName(volume);
@@ -1043,6 +1046,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
     return response;
   }
 
+  @Override
   public List<ServiceInfo> getServiceList() throws IOException {
     ServiceListRequest req = ServiceListRequest.newBuilder().build();
 
@@ -1180,6 +1184,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
    * @return OzoneFileStatus for the key.
    * @throws IOException
    */
+  @Override
   public OzoneFileStatus getFileStatus(OmKeyArgs args) throws IOException {
     KeyArgs keyArgs = KeyArgs.newBuilder()
         .setVolumeName(args.getVolumeName())
diff --git a/hadoop-ozone/datanode/pom.xml b/hadoop-ozone/datanode/pom.xml
index b2d4fc7..035f937 100644
--- a/hadoop-ozone/datanode/pom.xml
+++ b/hadoop-ozone/datanode/pom.xml
@@ -26,6 +26,10 @@
   <packaging>jar</packaging>
   <version>1.1.0-SNAPSHOT</version>
 
+  <properties>
+    <spotbugs.skip>true</spotbugs.skip>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
diff --git a/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode2.xml b/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode2.xml
index 0dab683..7555a79 100644
--- a/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode2.xml
+++ b/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode2.xml
@@ -18,7 +18,7 @@
   <configuration default="false" name="Datanode2" type="Application" factoryName="Application">
     <option name="MAIN_CLASS_NAME" value="org.apache.hadoop.ozone.HddsDatanodeService" />
     <module name="hadoop-ozone-datanode" />
-    <option name="PROGRAM_PARAMETERS" value="-conf=hadoop-ozone/dev-support/intellij/ozone-site.xml --set ozone.metadata.dirs=/tmp/datanode2 --set hdds.datanode.dir=/tmp/datanode2/storage --set hdds.datanode.http-address=127.0.0.1:10021 --set dfs.container.ratis.ipc=10022 --set dfs.container.ipc=10023" />
+    <option name="PROGRAM_PARAMETERS" value="-conf=hadoop-ozone/dev-support/intellij/ozone-site.xml --set ozone.metadata.dirs=/tmp/datanode2 --set hdds.datanode.dir=/tmp/datanode2/storage --set hdds.datanode.http-address=127.0.0.1:10021 --set dfs.container.ratis.ipc=10022 --set dfs.container.ipc=10023 --set dfs.container.ratis.server.port=10024 --set dfs.container.ratis.admin.port=10025 --set hdds.datanode.replication.port=10026" />
     <option name="VM_PARAMETERS" value="-Dlog4j.configuration=file:hadoop-ozone/dev-support/intellij/log4j.properties" />
     <extension name="coverage">
       <pattern>
diff --git a/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode3.xml b/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode3.xml
index d44746f..5789824 100644
--- a/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode3.xml
+++ b/hadoop-ozone/dev-support/intellij/runConfigurations/Datanode3.xml
@@ -18,7 +18,7 @@
   <configuration default="false" name="Datanode3" type="Application" factoryName="Application">
     <option name="MAIN_CLASS_NAME" value="org.apache.hadoop.ozone.HddsDatanodeService" />
     <module name="hadoop-ozone-datanode" />
-    <option name="PROGRAM_PARAMETERS" value="-conf=hadoop-ozone/dev-support/intellij/ozone-site.xml --set ozone.metadata.dirs=/tmp/datanode3 --set hdds.datanode.dir=/tmp/datanode3/storage --set hdds.datanode.http-address=127.0.0.1:10031 --set dfs.container.ratis.ipc=10032 --set dfs.container.ipc=10033" />
+    <option name="PROGRAM_PARAMETERS" value="-conf=hadoop-ozone/dev-support/intellij/ozone-site.xml --set ozone.metadata.dirs=/tmp/datanode3 --set hdds.datanode.dir=/tmp/datanode3/storage --set hdds.datanode.http-address=127.0.0.1:10031 --set dfs.container.ratis.ipc=10032 --set dfs.container.ipc=10033 --set dfs.container.ratis.server.port=10034 --set dfs.container.ratis.admin.port=10035 --set hdds.datanode.replication.port=10036" />
     <option name="VM_PARAMETERS" value="-Dlog4j.configuration=file:hadoop-ozone/dev-support/intellij/log4j.properties" />
     <extension name="coverage">
       <pattern>
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh b/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh
index a14aa9c..5913b65 100755
--- a/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh
@@ -20,6 +20,7 @@ export COMPOSE_DIR
 
 export SECURITY_ENABLED=false
 export OZONE_REPLICATION_FACTOR=3
+export OM_SERVICE_ID=omservice
 
 # shellcheck source=/dev/null
 source "$COMPOSE_DIR/../testlib.sh"
@@ -27,6 +28,9 @@ source "$COMPOSE_DIR/../testlib.sh"
 start_docker_env
 
 execute_robot_test scm basic/ozone-shell-single.robot
+execute_robot_test scm basic/links.robot
+execute_robot_test scm s3
+execute_robot_test scm freon
 
 stop_docker_env
 
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml
deleted file mode 100644
index 0f385e4..0000000
--- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-version: "3"
-services:
-   datanode:
-      image: apache/ozone-runner:${OZONE_RUNNER_VERSION}
-      privileged: true #required by the profiler
-      volumes:
-        - ../..:/opt/hadoop
-      ports:
-        - 9864
-      command: ["/opt/hadoop/bin/ozone","datanode"]
-      env_file:
-        - ./docker-config
-      environment:
-         OZONE_OPTS:
-   om1:
-      image: apache/ozone-runner:${OZONE_RUNNER_VERSION}
-      privileged: true #required by the profiler
-      volumes:
-         - ../..:/opt/hadoop
-      ports:
-         - 9880:9874
-         - 9890:9872
-      environment:
-         ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
-         OZONE_OPTS:
-      env_file:
-          - ./docker-config
-      command: ["/opt/hadoop/bin/ozone","om"]
-   om2:
-      image: apache/ozone-runner:${OZONE_RUNNER_VERSION}
-      privileged: true #required by the profiler
-      volumes:
-         - ../..:/opt/hadoop
-      ports:
-         - 9882:9874
-         - 9892:9872
-      environment:
-         ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
-         OZONE_OPTS:
-      env_file:
-         - ./docker-config
-      command: ["/opt/hadoop/bin/ozone","om"]
-   om3:
-      image: apache/ozone-runner:${OZONE_RUNNER_VERSION}
-      privileged: true #required by the profiler
-      volumes:
-         - ../..:/opt/hadoop
-      ports:
-         - 9884:9874
-         - 9894:9872
-      environment:
-         ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
-         OZONE_OPTS:
-      env_file:
-         - ./docker-config
-      command: ["/opt/hadoop/bin/ozone","om"]
-   scm:
-      image: apache/ozone-runner:${OZONE_RUNNER_VERSION}
-      privileged: true #required by the profiler
-      volumes:
-         - ../..:/opt/hadoop
-      ports:
-         - 9876:9876
-         - 9860:9860
-      env_file:
-          - ./docker-config
-      environment:
-          ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION
-          OZONE-SITE.XML_hdds.scm.safemode.min.datanode: "${OZONE_SAFEMODE_MIN_DATANODES:-1}"
-          OZONE_OPTS:
-      command: ["/opt/hadoop/bin/ozone","scm"]
-   s3g:
-      image: apache/ozone-runner:${OZONE_RUNNER_VERSION}
-      volumes:
-         - ../..:/opt/hadoop
-      ports:
-         - 9878:9878
-      env_file:
-         - ./docker-config
-      environment:
-         OZONE_OPTS:
-      command: ["ozone","s3g"]
-
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure-om-ha/docker-config b/hadoop-ozone/dist/src/main/compose/ozonesecure-om-ha/docker-config
index 266ad00..eeb05f9 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure-om-ha/docker-config
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure-om-ha/docker-config
@@ -39,6 +39,7 @@ OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata
 OZONE-SITE.XML_ozone.handler.type=distributed
 OZONE-SITE.XML_ozone.scm.client.address=scm
 OZONE-SITE.XML_hdds.block.token.enabled=true
+OZONE-SITE.XML_hdds.grpc.tls.enabled=true
 OZONE-SITE.XML_ozone.replication=3
 
 OZONE-SITE.XML_ozone.recon.om.snapshot.task.interval.delay=1m
@@ -49,7 +50,7 @@ OZONE-SITE.XML_ozone.recon.address=recon:9891
 OZONE-SITE.XML_ozone.security.enabled=true
 OZONE-SITE.XML_ozone.acl.enabled=true
 OZONE-SITE.XML_ozone.acl.authorizer.class=org.apache.hadoop.ozone.security.acl.OzoneNativeAuthorizer
-OZONE-SITE.XML_ozone.administrators="testuser/scm@EXAMPLE.COM,testuser/s3g@EXAMPLE.COM"
+OZONE-SITE.XML_ozone.administrators="testuser/scm@EXAMPLE.COM,testuser/s3g@EXAMPLE.COM,recon/recon@EXAMPLE.COM"
 
 OZONE-SITE.XML_hdds.datanode.dir=/data/hdds
 HDFS-SITE.XML_dfs.datanode.address=0.0.0.0:1019
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config b/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config
index ec94dfb..c8d3643 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config
@@ -29,6 +29,7 @@ OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata
 OZONE-SITE.XML_ozone.handler.type=distributed
 OZONE-SITE.XML_ozone.scm.client.address=scm
 OZONE-SITE.XML_hdds.block.token.enabled=true
+OZONE-SITE.XML_hdds.grpc.tls.enabled=true
 OZONE-SITE.XML_ozone.replication=3
 OZONE-SITE.XML_ozone.datanode.pipeline.limit=1
 
@@ -58,6 +59,11 @@ OZONE-SITE.XML_ozone.om.kerberos.keytab.file=/etc/security/keytabs/om.keytab
 OZONE-SITE.XML_ozone.recon.kerberos.keytab.file=/etc/security/keytabs/recon.keytab
 OZONE-SITE.XML_ozone.recon.kerberos.principal=recon/recon@EXAMPLE.COM
 
+OZONE-SITE.XML_hdds.scm.replication.thread.interval=5s
+OZONE-SITE.XML_hdds.scm.replication.event.timeout=10s
+OZONE-SITE.XML_ozone.scm.stale.node.interval=30s
+OZONE-SITE.XML_ozone.scm.dead.node.interval=45s
+
 HDFS-SITE.XML_dfs.datanode.kerberos.principal=dn/_HOST@EXAMPLE.COM
 HDFS-SITE.XML_dfs.datanode.keytab.file=/etc/security/keytabs/dn.keytab
 HDFS-SITE.XML_dfs.web.authentication.kerberos.principal=HTTP/_HOST@EXAMPLE.COM
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh b/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
index eeccb84..a391cdd 100755
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
@@ -52,9 +52,16 @@ done
 execute_robot_test scm recon
 
 execute_robot_test scm admincli
-
 execute_robot_test scm spnego
 
+# test replication
+# TODO: https://issues.apache.org/jira/browse/HDDS-4860
+#   Reopen replication/wait.robot after distributed sequence id is implemented.
+#docker-compose up -d --scale datanode=2
+#execute_robot_test scm -v container:1 -v count:2 replication/wait.robot
+#docker-compose up -d --scale datanode=3
+#execute_robot_test scm -v container:1 -v count:3 replication/wait.robot
+
 stop_docker_env
 
 generate_report
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env b/hadoop-ozone/dist/src/main/compose/restart/.env
similarity index 89%
rename from hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env
rename to hadoop-ozone/dist/src/main/compose/restart/.env
index 9279c5b..6f757c5 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env
+++ b/hadoop-ozone/dist/src/main/compose/restart/.env
@@ -16,4 +16,6 @@
 
 HDDS_VERSION=${hdds.version}
 OZONE_RUNNER_VERSION=${docker.ozone-runner.version}
-OZONE_OPTS=
+OZONE_IMAGE=apache/ozone-runner:${docker.ozone-runner.version}
+OZONE_DIR=/opt/hadoop
+OZONE_VOLUME=.
diff --git a/hadoop-ozone/dist/src/main/compose/restart/README.md b/hadoop-ozone/dist/src/main/compose/restart/README.md
new file mode 100644
index 0000000..8bb4213
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/compose/restart/README.md
@@ -0,0 +1,22 @@
+<!---
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+# Compose file for restart
+
+This directory contains a sample cluster definition and script for
+testing restart of the cluster with the same version.
+
+Data for each container is persisted in mounted volume (by default it's
+`data` under the `compose/restart` directory, but can be overridden via
+`OZONE_VOLUME` environment variable).
diff --git a/hadoop-ozone/dist/src/main/compose/restart/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/restart/docker-compose.yaml
new file mode 100644
index 0000000..a15c2f9
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/compose/restart/docker-compose.yaml
@@ -0,0 +1,134 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+version: "3.4"
+
+# reusable fragments (see https://docs.docker.com/compose/compose-file/#extension-fields)
+x-common-config:
+  &common-config
+  env_file:
+    - docker-config
+  image: ${OZONE_IMAGE}
+
+x-replication:
+  &replication
+  OZONE-SITE.XML_ozone.replication: ${OZONE_REPLICATION_FACTOR:-1}
+
+x-datanode:
+  &datanode
+  command: ["ozone","datanode"]
+  <<: *common-config
+  environment:
+    <<: *replication
+  ports:
+    - 9864
+    - 9882
+
+services:
+  dn1:
+    <<: *datanode
+    networks:
+      net:
+        ipv4_address: 10.9.0.11
+    volumes:
+      - ${OZONE_VOLUME}/dn1:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+  dn2:
+    <<: *datanode
+    networks:
+      net:
+        ipv4_address: 10.9.0.12
+    volumes:
+      - ${OZONE_VOLUME}/dn2:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+  dn3:
+    <<: *datanode
+    networks:
+      net:
+        ipv4_address: 10.9.0.13
+    volumes:
+      - ${OZONE_VOLUME}/dn3:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+  om:
+    command: ["ozone","om"]
+    <<: *common-config
+    environment:
+      ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
+      <<: *replication
+    networks:
+      net:
+        ipv4_address: 10.9.0.14
+    ports:
+      - 9874:9874
+      - 9862:9862
+    volumes:
+      - ${OZONE_VOLUME}/om:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+  recon:
+    command: ["ozone","recon"]
+    <<: *common-config
+    environment:
+      <<: *replication
+    networks:
+      net:
+        ipv4_address: 10.9.0.15
+    ports:
+      - 9888:9888
+    volumes:
+      - ${OZONE_VOLUME}/recon:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+  s3g:
+    command: ["ozone","s3g"]
+    <<: *common-config
+    environment:
+      <<: *replication
+    networks:
+      net:
+        ipv4_address: 10.9.0.16
+    ports:
+      - 9878:9878
+    volumes:
+      - ${OZONE_VOLUME}/s3g:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+  scm:
+    command: ["ozone","scm"]
+    <<: *common-config
+    environment:
+      ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION
+      OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1}
+      <<: *replication
+    networks:
+      net:
+        ipv4_address: 10.9.0.17
+    ports:
+      - 9876:9876
+    volumes:
+      - ${OZONE_VOLUME}/scm:/data
+      - ../..:${OZONE_DIR}
+      - ../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py
+
+networks:
+  net:
+    driver: bridge
+    ipam:
+      config:
+      - subnet: 10.9.0.0/16
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config b/hadoop-ozone/dist/src/main/compose/restart/docker-config
similarity index 72%
rename from hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config
rename to hadoop-ozone/dist/src/main/compose/restart/docker-config
index 3d7aed7..83530bb 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config
+++ b/hadoop-ozone/dist/src/main/compose/restart/docker-config
@@ -14,14 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-CORE-SITE.XML_fs.defaultFS=ofs://id1
-
-OZONE-SITE.XML_ozone.om.service.ids=id1
-OZONE-SITE.XML_ozone.om.nodes.id1=om1,om2,om3
-OZONE-SITE.XML_ozone.om.address.id1.om1=om1
-OZONE-SITE.XML_ozone.om.address.id1.om2=om2
-OZONE-SITE.XML_ozone.om.address.id1.om3=om3
-OZONE-SITE.XML_ozone.om.ratis.enable=true
+OZONE-SITE.XML_ozone.om.address=om
+OZONE-SITE.XML_ozone.om.http-address=om:9874
 OZONE-SITE.XML_ozone.scm.container.size=1GB
 OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
 OZONE-SITE.XML_ozone.scm.pipeline.owner.container.count=1
@@ -29,13 +23,13 @@ OZONE-SITE.XML_ozone.scm.names=scm
 OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data
 OZONE-SITE.XML_ozone.scm.block.client.address=scm
 OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata
-OZONE-SITE.XML_ozone.handler.type=distributed
+OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon
 OZONE-SITE.XML_ozone.scm.client.address=scm
-OZONE-SITE.XML_ozone.replication=3
 OZONE-SITE.XML_hdds.datanode.dir=/data/hdds
-OZONE-SITE.XML_hdds.profiler.endpoint.enabled=true
+OZONE-SITE.XML_ozone.recon.address=recon:9891
+OZONE-SITE.XML_ozone.recon.om.snapshot.task.interval.delay=1m
 
 OZONE_CONF_DIR=/etc/hadoop
 OZONE_LOG_DIR=/var/log/hadoop
 
-no_proxy=om,scm,s3g,recon,kdc,localhost,127.0.0.1
+no_proxy=om,scm,s3g,kdc,localhost,127.0.0.1
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh b/hadoop-ozone/dist/src/main/compose/restart/test.sh
similarity index 50%
rename from hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh
rename to hadoop-ozone/dist/src/main/compose/restart/test.sh
index 4f2bd09..41e06c5 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/restart/test.sh
@@ -18,21 +18,37 @@
 COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 export COMPOSE_DIR
 
-export SECURITY_ENABLED=false
-export OM_SERVICE_ID="id1"
+: "${OZONE_REPLICATION_FACTOR:=3}"
+: "${OZONE_VOLUME:="${COMPOSE_DIR}/data"}"
 
-# shellcheck source=/dev/null
-source "$COMPOSE_DIR/../testlib.sh"
+export OZONE_VOLUME
 
-start_docker_env
+mkdir -p "${OZONE_VOLUME}"/{dn1,dn2,dn3,om,recon,s3g,scm}
 
-execute_robot_test scm s3
+if [[ -n "${OZONE_VOLUME_OWNER}" ]]; then
+  current_user=$(whoami)
+  if [[ "${OZONE_VOLUME_OWNER}" != "${current_user}" ]]; then
+    chown -R "${OZONE_VOLUME_OWNER}" "${OZONE_VOLUME}" \
+      || sudo chown -R "${OZONE_VOLUME_OWNER}" "${OZONE_VOLUME}"
+  fi
+fi
 
-execute_robot_test scm freon
+# shellcheck source=/dev/null
+source "${COMPOSE_DIR}/../testlib.sh"
 
-execute_robot_test scm basic/links.robot
+# prepare pre-upgrade cluster
+start_docker_env
+execute_robot_test scm -v PREFIX:pre freon/generate.robot
+execute_robot_test scm -v PREFIX:pre freon/validate.robot
+KEEP_RUNNING=false stop_docker_env
 
+# re-start cluster with new version and check after upgrade
+export OZONE_KEEP_RESULTS=true
+start_docker_env
+execute_robot_test scm -v PREFIX:pre freon/validate.robot
+# test write key to old bucket after upgrade
+execute_robot_test scm -v PREFIX:post freon/generate.robot
+execute_robot_test scm -v PREFIX:post freon/validate.robot
 stop_docker_env
 
 generate_report
-
diff --git a/hadoop-ozone/dist/src/main/compose/testlib.sh b/hadoop-ozone/dist/src/main/compose/testlib.sh
index 105ec56..0e12fde 100755
--- a/hadoop-ozone/dist/src/main/compose/testlib.sh
+++ b/hadoop-ozone/dist/src/main/compose/testlib.sh
@@ -23,8 +23,6 @@ RESULT_DIR_INSIDE="/tmp/smoketest/$(basename "$COMPOSE_ENV_NAME")/result"
 OM_HA_PARAM=""
 if [[ -n "${OM_SERVICE_ID}" ]] && [[ "${OM_SERVICE_ID}" != "om" ]]; then
   OM_HA_PARAM="--om-service-id=${OM_SERVICE_ID}"
-else
-  OM_SERVICE_ID=om
 fi
 
 ## @description create results directory, purging any prior data
@@ -95,6 +93,39 @@ wait_for_safemode_exit(){
    return 1
 }
 
+## @description wait until OM leader is elected (or 120 seconds)
+wait_for_om_leader() {
+  if [[ -z "${OM_SERVICE_ID:-}" ]]; then
+    echo "No OM HA service, no need to wait"
+    return
+  fi
+
+  #Reset the timer
+  SECONDS=0
+
+  #Don't give it up until 120 seconds
+  while [[ $SECONDS -lt 120 ]]; do
+    local command="ozone admin om roles --service-id '${OM_SERVICE_ID}'"
+    if [[ "${SECURITY_ENABLED}" == 'true' ]]; then
+      status=$(docker-compose exec -T scm bash -c "kinit -k scm/scm@EXAMPLE.COM -t /etc/security/keytabs/scm.keytab && $command" | grep LEADER)
+    else
+      status=$(docker-compose exec -T scm bash -c "$command" | grep LEADER)
+    fi
+    if [[ -n "${status}" ]]; then
+      echo "Found OM leader for service ${OM_SERVICE_ID}: $status"
+      return
+    else
+      echo "Waiting for OM leader for service ${OM_SERVICE_ID}"
+    fi
+
+    echo "SECONDS: $SECONDS"
+
+    sleep 2
+  done
+  echo "WARNING: OM leader still not found for service ${OM_SERVICE_ID}"
+  return 1
+}
+
 ## @description  Starts a docker-compose based test environment
 ## @param number of datanodes to start and wait for (default: 3)
 start_docker_env(){
@@ -104,7 +135,8 @@ start_docker_env(){
   export OZONE_SAFEMODE_MIN_DATANODES="${datanode_count}"
   docker-compose --no-ansi down
   if ! { docker-compose --no-ansi up -d --scale datanode="${datanode_count}" \
-      && wait_for_safemode_exit ; }; then
+      && wait_for_safemode_exit \
+      && wait_for_om_leader ; }; then
     OUTPUT_NAME="$COMPOSE_ENV_NAME"
     stop_docker_env
     return 1
@@ -142,7 +174,7 @@ execute_robot_test(){
     && docker-compose exec -T "$CONTAINER" robot \
       -v KEY_NAME:"${OZONE_BUCKET_KEY_NAME}" \
       -v OM_HA_PARAM:"${OM_HA_PARAM}" \
-      -v OM_SERVICE_ID:"${OM_SERVICE_ID}" \
+      -v OM_SERVICE_ID:"${OM_SERVICE_ID:-om}" \
       -v OZONE_DIR:"${OZONE_DIR}" \
       -v SECURITY_ENABLED:"${SECURITY_ENABLED}" \
       ${ARGUMENTS[@]} --log NONE --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" \
diff --git a/hadoop-ozone/dist/src/main/compose/xcompat/clients.yaml b/hadoop-ozone/dist/src/main/compose/xcompat/clients.yaml
index 3fe8e03..95951f4 100644
--- a/hadoop-ozone/dist/src/main/compose/xcompat/clients.yaml
+++ b/hadoop-ozone/dist/src/main/compose/xcompat/clients.yaml
@@ -17,15 +17,6 @@
 version: "3.4"
 
 services:
-  old_client_0_5_0:
-    image: apache/ozone:0.5.0
-    env_file:
-      - docker-config
-    volumes:
-      - ../..:/opt/ozone
-    environment:
-      HADOOP_OPTS:
-    command: ["sleep","1000000"]
   old_client_1_0_0:
     image: apache/ozone:1.0.0
     env_file:
diff --git a/hadoop-ozone/dist/src/main/compose/xcompat/test.sh b/hadoop-ozone/dist/src/main/compose/xcompat/test.sh
index 53b3308..27c5ef4 100755
--- a/hadoop-ozone/dist/src/main/compose/xcompat/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/xcompat/test.sh
@@ -80,7 +80,7 @@ create_results_dir
 # current cluster with various clients
 COMPOSE_FILE=new-cluster.yaml:clients.yaml cluster_version=${current_version} test_cross_compatibility
 
-for cluster_version in 1.0.0 0.5.0; do
+for cluster_version in 1.0.0; do
   # shellcheck source=/dev/null
   source "${COMPOSE_DIR}/../upgrade/versions/ozone-${cluster_version}.sh"
   # shellcheck source=/dev/null
diff --git a/hadoop-ozone/dist/src/main/dockerlibexec/entrypoint.sh b/hadoop-ozone/dist/src/main/dockerlibexec/entrypoint.sh
index 8184da4..95df27f 100755
--- a/hadoop-ozone/dist/src/main/dockerlibexec/entrypoint.sh
+++ b/hadoop-ozone/dist/src/main/dockerlibexec/entrypoint.sh
@@ -102,7 +102,7 @@ CONF_DESTINATION_DIR="${HADOOP_CONF_DIR:-/opt/hadoop/etc/hadoop}"
 #Try to copy the defaults
 set +e
 if [[ -d "/opt/ozone/etc/hadoop" ]]; then
-   cp /opt/hadoop/etc/hadoop/* "$CONF_DESTINATION_DIR/" > /dev/null 2>&1
+   cp /opt/ozone/etc/hadoop/* "$CONF_DESTINATION_DIR/" > /dev/null 2>&1
 elif [[ -d "/opt/hadoop/etc/hadoop" ]]; then
    cp /opt/hadoop/etc/hadoop/* "$CONF_DESTINATION_DIR/" > /dev/null 2>&1
 fi
diff --git a/hadoop-ozone/dist/src/main/smoketest/admincli/replicationmanager.robot b/hadoop-ozone/dist/src/main/smoketest/admincli/replicationmanager.robot
index cef294f..449d82e 100644
--- a/hadoop-ozone/dist/src/main/smoketest/admincli/replicationmanager.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/admincli/replicationmanager.robot
@@ -30,16 +30,16 @@ Check replicationmanager with explicit host
                         Should contain   ${output}   ReplicationManager
                         Should contain   ${output}   Running
 
-Start replicationmanager
-    ${output} =         Execute          ozone admin replicationmanager start
-                        Should contain   ${output}   Starting ReplicationManager
-                        Wait Until Keyword Succeeds    30sec    5sec    Execute          ozone admin replicationmanager status | grep -q 'is Running'
-
 Stop replicationmanager
     ${output} =         Execute          ozone admin replicationmanager stop
                         Should contain   ${output}   Stopping ReplicationManager
                         Wait Until Keyword Succeeds    30sec    5sec    Execute          ozone admin replicationmanager status | grep -q 'is Not Running'
 
+Start replicationmanager
+    ${output} =         Execute          ozone admin replicationmanager start
+                        Should contain   ${output}   Starting ReplicationManager
+                        Wait Until Keyword Succeeds    30sec    5sec    Execute          ozone admin replicationmanager status | grep -q 'is Running'
+
 Incomplete command
     ${output} =         Execute And Ignore Error     ozone admin replicationmanager
                         Should contain   ${output}   Incomplete command
diff --git a/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot b/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
index be3ea2e..fc133c1 100644
--- a/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
@@ -19,8 +19,15 @@ Resource            ../ozone-lib/shell.robot
 Test Timeout        5 minutes
 
 *** Variables ***
-${KEY_NAME_SUFFIX}    ${EMPTY}
+${SUFFIX}    ${EMPTY}
 
 *** Test Cases ***
 Key Can Be Read
-    Key Should Match Local File    /vol1/bucket1/key-${KEY_NAME_SUFFIX}    /etc/passwd
+    Key Should Match Local File    /vol1/bucket1/key-${SUFFIX}    /etc/passwd
+
+Dir Can Be Listed
+    Execute    ozone fs -ls o3fs://bucket1.vol1/dir-${SUFFIX}
+
+File Can Be Get
+    Execute    ozone fs -get o3fs://bucket1.vol1/dir-${SUFFIX}/passwd /tmp/passwd-${SUFFIX}
+    [teardown]    Execute    rm /tmp/passwd-${SUFFIX}
diff --git a/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot b/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
index f34aede..f5c9201 100644
--- a/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
@@ -19,8 +19,14 @@ Resource            ../ozone-lib/shell.robot
 Test Timeout        5 minutes
 
 *** Variables ***
-${KEY_NAME_SUFFIX}    ${EMPTY}
+${SUFFIX}    ${EMPTY}
 
 *** Test Cases ***
 Key Can Be Written
-    Create Key    /vol1/bucket1/key-${KEY_NAME_SUFFIX}    /etc/passwd
+    Create Key    /vol1/bucket1/key-${SUFFIX}    /etc/passwd
+
+Dir Can Be Created
+    Execute    ozone fs -mkdir o3fs://bucket1.vol1/dir-${SUFFIX}
+
+File Can Be Put
+    Execute    ozone fs -put /etc/passwd o3fs://bucket1.vol1/dir-${SUFFIX}/
diff --git a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot
index 5a1d770..a5863e9 100644
--- a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot
@@ -58,9 +58,9 @@ Check if Recon picks up DN heartbeats
                         Should contain      ${result}       datanode_3
 
     ${result} =         Execute                             curl --negotiate -u : -LSs ${API_ENDPOINT_URL}/clusterState
-                        Should contain      ${result}       \"totalDatanodes\":3
-                        Should contain      ${result}       \"healthyDatanodes\":3
-                        Should contain      ${result}       \"pipelines\":4
+                        Should contain      ${result}       \"totalDatanodes\"
+                        Should contain      ${result}       \"healthyDatanodes\"
+                        Should contain      ${result}       \"pipelines\"
 
 Check if Recon Web UI is up
     Run Keyword if      '${SECURITY_ENABLED}' == 'true'     Kinit HTTP user
diff --git a/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot b/hadoop-ozone/dist/src/main/smoketest/replication/wait.robot
similarity index 65%
copy from hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
copy to hadoop-ozone/dist/src/main/smoketest/replication/wait.robot
index f34aede..cf2d621 100644
--- a/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/replication/wait.robot
@@ -14,13 +14,20 @@
 # limitations under the License.
 
 *** Settings ***
-Documentation       Write Compatibility
-Resource            ../ozone-lib/shell.robot
+Documentation       Wait for replication to succeed
+Library             BuiltIn
+Resource            ../commonlib.robot
 Test Timeout        5 minutes
 
 *** Variables ***
-${KEY_NAME_SUFFIX}    ${EMPTY}
+${container}    1
+${count}        3
+
+*** Keywords ***
+Check Container Replicated
+    ${output} =    Execute    ozone admin container info --json "${container}" | jq '.pipeline.nodes | length'
+    Should Be Equal    ${output}   ${count}
 
 *** Test Cases ***
-Key Can Be Written
-    Create Key    /vol1/bucket1/key-${KEY_NAME_SUFFIX}    /etc/passwd
+Wait Until Container Replicated
+    Wait Until Keyword Succeeds    5min    10sec    Check Container Replicated
diff --git a/hadoop-ozone/dist/src/main/smoketest/s3/MultipartUpload.robot b/hadoop-ozone/dist/src/main/smoketest/s3/MultipartUpload.robot
index e05a706..b9d99f2 100644
--- a/hadoop-ozone/dist/src/main/smoketest/s3/MultipartUpload.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/s3/MultipartUpload.robot
@@ -17,6 +17,7 @@
 Documentation       S3 gateway test with aws cli
 Library             OperatingSystem
 Library             String
+Library             DateTime
 Resource            ../commonlib.robot
 Resource            commonawslib.robot
 Test Timeout        5 minutes
@@ -274,6 +275,44 @@ Test Multipart Upload Put With Copy and range
 
                         Compare files           /tmp/part1        /tmp/part-result
 
+Test Multipart Upload Put With Copy and range with IfModifiedSince
+    Run Keyword         Create Random file      10
+    ${curDate} =        Get Current Date
+    ${beforeCreate} =   Subtract Time From Date     ${curDate}  1 day
+    ${afterCreate} =    Add Time To Date        ${curDate}  1 day
+
+    ${result} =         Execute AWSS3APICli     put-object --bucket ${BUCKET} --key ${PREFIX}/copyrange/source --body /tmp/part1
+
+    ${result} =         Execute AWSS3APICli     create-multipart-upload --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination
+
+    ${uploadID} =       Execute and checkrc      echo '${result}' | jq -r '.UploadId'    0
+                        Should contain           ${result}    ${BUCKET}
+                        Should contain           ${result}    UploadId
+
+    ${result} =         Execute AWSS3APICli and checkrc     upload-part-copy --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination --upload-id ${uploadID} --part-number 1 --copy-source ${BUCKET}/${PREFIX}/copyrange/source --copy-source-range bytes=0-10485757 --copy-source-if-modified-since '${afterCreate}'    255
+                        Should contain           ${result}    PreconditionFailed
+
+    ${result} =         Execute AWSS3APICli and checkrc     upload-part-copy --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination --upload-id ${uploadID} --part-number 2 --copy-source ${BUCKET}/${PREFIX}/copyrange/source --copy-source-range bytes=10485758-10485759 --copy-source-if-unmodified-since '${beforeCreate}'  255
+                        Should contain           ${result}    PreconditionFailed
+
+    ${result} =         Execute AWSS3APICli and checkrc     upload-part-copy --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination --upload-id ${uploadID} --part-number 1 --copy-source ${BUCKET}/${PREFIX}/copyrange/source --copy-source-range bytes=0-10485757 --copy-source-if-modified-since '${beforeCreate}'   0
+                        Should contain           ${result}    ETag
+                        Should contain           ${result}    LastModified
+
+    ${eTag1} =          Execute and checkrc      echo '${result}' | jq -r '.CopyPartResult.ETag'   0
+
+    ${result} =         Execute AWSS3APICli and checkrc     upload-part-copy --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination --upload-id ${uploadID} --part-number 2 --copy-source ${BUCKET}/${PREFIX}/copyrange/source --copy-source-range bytes=10485758-10485759 --copy-source-if-unmodified-since '${afterCreate}'   0
+                        Should contain           ${result}    ETag
+                        Should contain           ${result}    LastModified
+
+    ${eTag2} =          Execute and checkrc      echo '${result}' | jq -r '.CopyPartResult.ETag'   0
+
+
+                        Execute AWSS3APICli     complete-multipart-upload --upload-id ${uploadID} --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination --multipart-upload 'Parts=[{ETag=${eTag1},PartNumber=1},{ETag=${eTag2},PartNumber=2}]'
+                        Execute AWSS3APICli     get-object --bucket ${BUCKET} --key ${PREFIX}/copyrange/destination /tmp/part-result
+
+                        Compare files           /tmp/part1        /tmp/part-result
+
 Test Multipart Upload list
     ${result} =         Execute AWSS3APICli     create-multipart-upload --bucket ${BUCKET} --key ${PREFIX}/listtest/key1
     ${uploadID1} =      Execute and checkrc     echo '${result}' | jq -r '.UploadId'    0
diff --git a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java
index 45680d3..aa03deb 100644
--- a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java
+++ b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java
@@ -114,6 +114,7 @@ public class MiniOzoneChaosCluster extends MiniOzoneHAClusterImpl {
     failureManager.start(initialDelay, period, timeUnit);
   }
 
+  @Override
   public void shutdown() {
     try {
       failureManager.stop();
@@ -166,6 +167,7 @@ public class MiniOzoneChaosCluster extends MiniOzoneHAClusterImpl {
      * @param val number of datanodes
      * @return MiniOzoneChaosCluster.Builder
      */
+    @Override
     public Builder setNumDatanodes(int val) {
       super.setNumDatanodes(val);
       return this;
@@ -196,6 +198,7 @@ public class MiniOzoneChaosCluster extends MiniOzoneHAClusterImpl {
       return this;
     }
 
+    @Override
     protected void initializeConfiguration() throws IOException {
       super.initializeConfiguration();
 
@@ -253,6 +256,7 @@ public class MiniOzoneChaosCluster extends MiniOzoneHAClusterImpl {
      *
      * @return MiniOzoneCluster.Builder
      */
+    @Override
     public Builder setNumDataVolumes(int val) {
       numDataVolumes = val;
       return this;
@@ -323,11 +327,13 @@ public class MiniOzoneChaosCluster extends MiniOzoneHAClusterImpl {
     return oms;
   }
 
+  @Override
   public void shutdownOzoneManager(OzoneManager om) {
     super.shutdownOzoneManager(om);
     failedOmSet.add(om);
   }
 
+  @Override
   public void restartOzoneManager(OzoneManager om, boolean waitForOM)
       throws IOException, TimeoutException, InterruptedException {
     super.restartOzoneManager(om, waitForOM);
diff --git a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/failure/Failures.java b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/failure/Failures.java
index 604fcff..678720b 100644
--- a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/failure/Failures.java
+++ b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/failure/Failures.java
@@ -72,6 +72,7 @@ public abstract class Failures {
    * Restart Ozone Manager to induce failure.
    */
   public static class OzoneManagerRestartFailure extends OzoneFailures {
+    @Override
     public void fail(MiniOzoneChaosCluster cluster) {
       boolean failureMode = FailureManager.isFastRestart();
       Set<OzoneManager> oms = cluster.omToFail();
@@ -91,6 +92,7 @@ public abstract class Failures {
    * Start/Stop Ozone Manager to induce failure.
    */
   public static class OzoneManagerStartStopFailure extends OzoneFailures {
+    @Override
     public void fail(MiniOzoneChaosCluster cluster) {
       // Get the number of OzoneManager to fail in the cluster.
       boolean shouldStop = cluster.shouldStop();
@@ -124,6 +126,7 @@ public abstract class Failures {
    * Restart Datanodes to induce failure.
    */
   public static class DatanodeRestartFailure extends DatanodeFailures {
+    @Override
     public void fail(MiniOzoneChaosCluster cluster) {
       boolean failureMode = FailureManager.isFastRestart();
       Set<DatanodeDetails> dns = cluster.dnToFail();
@@ -141,6 +144,7 @@ public abstract class Failures {
    * Start/Stop Datanodes to induce failure.
    */
   public static class DatanodeStartStopFailure extends DatanodeFailures {
+    @Override
     public void fail(MiniOzoneChaosCluster cluster) {
       // Get the number of datanodes to fail in the cluster.
       Set<DatanodeDetails> dns = cluster.dnToFail();
diff --git a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/RandomLoadGenerator.java b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/RandomLoadGenerator.java
index 354d93a..e6d70cc 100644
--- a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/RandomLoadGenerator.java
+++ b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/RandomLoadGenerator.java
@@ -52,6 +52,7 @@ public class RandomLoadGenerator extends LoadGenerator {
     ozoneBucket.deleteKey(keyName);
   }
 
+  @Override
   public void initialize() {
     // Nothing to do here
   }
diff --git a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/ReadOnlyLoadGenerator.java b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/ReadOnlyLoadGenerator.java
index e8e6257..758d83a 100644
--- a/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/ReadOnlyLoadGenerator.java
+++ b/hadoop-ozone/fault-injection-test/mini-chaos-tests/src/test/java/org/apache/hadoop/ozone/loadgenerators/ReadOnlyLoadGenerator.java
@@ -43,6 +43,7 @@ public class ReadOnlyLoadGenerator extends LoadGenerator {
   }
 
 
+  @Override
   public void initialize() throws Exception {
     for (int index = 0; index < NUM_KEYS; index++) {
       ByteBuffer buffer = dataBuffer.getBuffer(index);
diff --git a/hadoop-hdds/client/src/test/resources/log4j.properties b/hadoop-ozone/insight/src/test/resources/log4j.properties
similarity index 91%
copy from hadoop-hdds/client/src/test/resources/log4j.properties
copy to hadoop-ozone/insight/src/test/resources/log4j.properties
index bb5cbe5..3987866 100644
--- a/hadoop-hdds/client/src/test/resources/log4j.properties
+++ b/hadoop-ozone/insight/src/test/resources/log4j.properties
@@ -20,4 +20,4 @@ log4j.rootLogger=INFO,stdout
 log4j.threshold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) - %m%n
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
index a3f56a9..710c906 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
@@ -1195,15 +1195,27 @@ public class TestRootedOzoneFileSystem {
   /**
    * 1.Move a Key to Trash
    * 2.Verify that the key gets deleted by the trash emptier.
+   * 3.Create a second Key in different bucket and verify deletion.
    * @throws Exception
    */
   @Test
   public void testTrash() throws Exception {
     String testKeyName = "keyToBeDeleted";
-    Path path = new Path(bucketPath, testKeyName);
-    try (FSDataOutputStream stream = fs.create(path)) {
+    Path keyPath1 = new Path(bucketPath, testKeyName);
+    try (FSDataOutputStream stream = fs.create(keyPath1)) {
+      stream.write(1);
+    }
+    // create second bucket and write a key in it.
+    OzoneBucket bucket2 = TestDataUtil.createVolumeAndBucket(cluster);
+    String volumeName2 = bucket2.getVolumeName();
+    Path volumePath2 = new Path(OZONE_URI_DELIMITER, volumeName2);
+    String bucketName2 = bucket2.getName();
+    Path bucketPath2 = new Path(volumePath2, bucketName2);
+    Path keyPath2 = new Path(bucketPath2, testKeyName + "1");
+    try (FSDataOutputStream stream = fs.create(keyPath2)) {
       stream.write(1);
     }
+
     Assert.assertTrue(trash.getConf().getClass(
         "fs.trash.classname", TrashPolicy.class).
         isAssignableFrom(TrashPolicyOzone.class));
@@ -1215,20 +1227,26 @@ public class TestRootedOzoneFileSystem {
     long prevNumTrashFileRenames = getOMMetrics().getNumTrashFilesRenames();
 
     // Call moveToTrash. We can't call protected fs.rename() directly
-    trash.moveToTrash(path);
+    trash.moveToTrash(keyPath1);
+    // for key in second bucket
+    trash.moveToTrash(keyPath2);
 
-    // Construct paths
+    // Construct paths for first key
     String username = UserGroupInformation.getCurrentUser().getShortUserName();
     Path trashRoot = new Path(bucketPath, TRASH_PREFIX);
     Path userTrash = new Path(trashRoot, username);
-    Path userTrashCurrent = new Path(userTrash, "Current");
-    String key = path.toString().substring(1);
-    Path trashPath = new Path(userTrashCurrent, key);
+    Path trashPath = getTrashKeyPath(keyPath1, userTrash);
+
+    // Construct paths for second key in different bucket
+    Path trashRoot2 = new Path(bucketPath2, TRASH_PREFIX);
+    Path userTrash2 = new Path(trashRoot2, username);
+    Path trashPath2 = getTrashKeyPath(keyPath2, userTrash2);
 
-    // Wait until the TrashEmptier purges the key
+
+    // Wait until the TrashEmptier purges the keys
     GenericTestUtils.waitFor(()-> {
       try {
-        return !ofs.exists(trashPath);
+        return !ofs.exists(trashPath) && !ofs.exists(trashPath2);
       } catch (IOException e) {
         LOG.error("Delete from Trash Failed", e);
         Assert.fail("Delete from Trash Failed");
@@ -1242,6 +1260,18 @@ public class TestRootedOzoneFileSystem {
     Assert.assertTrue(getOMMetrics()
         .getNumTrashFilesRenames() > prevNumTrashFileRenames);
 
+    // wait for deletion of checkpoint dir
+    GenericTestUtils.waitFor(()-> {
+      try {
+        return ofs.listStatus(userTrash).length==0 &&
+            ofs.listStatus(userTrash2).length==0;
+      } catch (IOException e) {
+        LOG.error("Delete from Trash Failed", e);
+        Assert.fail("Delete from Trash Failed");
+        return false;
+      }
+    }, 1000, 120000);
+
     // This condition should succeed once the checkpoint directory is deleted
     GenericTestUtils.waitFor(
         () -> getOMMetrics().getNumTrashDeletes() > prevNumTrashDeletes
@@ -1249,9 +1279,16 @@ public class TestRootedOzoneFileSystem {
             > prevNumTrashFileDeletes, 100, 180000);
     // Cleanup
     ofs.delete(trashRoot, true);
+    ofs.delete(trashRoot2, true);
 
   }
 
+  private Path getTrashKeyPath(Path keyPath, Path userTrash) {
+    Path userTrashCurrent = new Path(userTrash, "Current");
+    String key = keyPath.toString().substring(1);
+    return new Path(userTrashCurrent, key);
+  }
+
   @Test
   public void testCreateWithInvalidPaths() throws Exception {
     // Test for path with ..
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMDbCheckpointServlet.java
similarity index 55%
copy from hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java
copy to hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMDbCheckpointServlet.java
index 2a52c96..7c3a8a9 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMDbCheckpointServlet.java
@@ -6,17 +6,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-package org.apache.hadoop.ozone.om;
+package org.apache.hadoop.hdds.scm;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
@@ -25,33 +24,24 @@ import javax.servlet.WriteListener;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.util.Collections;
 import java.util.UUID;
 
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
-import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMMetrics;
+import org.apache.hadoop.hdds.scm.server.SCMDBCheckpointServlet;
+import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.ozone.MiniOzoneCluster;
 import org.apache.hadoop.ozone.OzoneConsts;
 
 import org.apache.commons.io.FileUtils;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
-import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS;
-import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_WILDCARD;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS;
 import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_FLUSH;
-import static org.apache.hadoop.ozone.om.OMDBCheckpointServlet.writeOmDBCheckpointToStream;
-
-import org.apache.hadoop.security.UserGroupInformation;
 import org.junit.After;
 import org.junit.Assert;
-import static org.junit.Assert.assertNotNull;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -66,16 +56,17 @@ import static org.mockito.Mockito.when;
 /**
  * Class used for testing the OM DB Checkpoint provider servlet.
  */
-public class TestOMDbCheckpointServlet {
+public class TestSCMDbCheckpointServlet {
   private MiniOzoneCluster cluster = null;
-  private OMMetrics omMetrics;
+  private StorageContainerManager scm;
+  private SCMMetrics scmMetrics;
   private OzoneConfiguration conf;
   private String clusterId;
   private String scmId;
   private String omId;
 
   @Rule
-  public Timeout timeout = new Timeout(60000);
+  public Timeout timeout = new Timeout(240000);
 
   @Rule
   public TemporaryFolder folder = new TemporaryFolder();
@@ -92,8 +83,7 @@ public class TestOMDbCheckpointServlet {
     clusterId = UUID.randomUUID().toString();
     scmId = UUID.randomUUID().toString();
     omId = UUID.randomUUID().toString();
-    conf.setBoolean(OZONE_ACL_ENABLED, false);
-    conf.set(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
+    conf.setBoolean(OZONE_ACL_ENABLED, true);
     conf.setInt(OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS, 2);
     cluster = MiniOzoneCluster.newBuilder(conf)
         .setClusterId(clusterId)
@@ -101,7 +91,8 @@ public class TestOMDbCheckpointServlet {
         .setOmId(omId)
         .build();
     cluster.waitForClusterToBeReady();
-    omMetrics = cluster.getOzoneManager().getMetrics();
+    scm = cluster.getStorageContainerManager();
+    scmMetrics = StorageContainerManager.getMetrics();
   }
 
   /**
@@ -119,23 +110,25 @@ public class TestOMDbCheckpointServlet {
 
     File tempFile = null;
     try {
-      OMDBCheckpointServlet omDbCheckpointServletMock =
-          mock(OMDBCheckpointServlet.class);
+      SCMDBCheckpointServlet scmDbCheckpointServletMock =
+          mock(SCMDBCheckpointServlet.class);
 
-      doCallRealMethod().when(omDbCheckpointServletMock).init();
+      doCallRealMethod().when(scmDbCheckpointServletMock).init();
+      doCallRealMethod().when(scmDbCheckpointServletMock).initialize(
+          scm.getScmMetadataStore().getStore(),
+          scmMetrics.getDBCheckpointMetrics(),
+          false,
+          Collections.emptyList());
 
       HttpServletRequest requestMock = mock(HttpServletRequest.class);
-      // Return current user short name when asked
-      when(requestMock.getRemoteUser())
-          .thenReturn(UserGroupInformation.getCurrentUser().getShortUserName());
       HttpServletResponse responseMock = mock(HttpServletResponse.class);
 
       ServletContext servletContextMock = mock(ServletContext.class);
-      when(omDbCheckpointServletMock.getServletContext())
+      when(scmDbCheckpointServletMock.getServletContext())
           .thenReturn(servletContextMock);
 
-      when(servletContextMock.getAttribute(OzoneConsts.OM_CONTEXT_ATTRIBUTE))
-          .thenReturn(cluster.getOzoneManager());
+      when(servletContextMock.getAttribute(OzoneConsts.SCM_CONTEXT_ATTRIBUTE))
+          .thenReturn(cluster.getStorageContainerManager());
       when(requestMock.getParameter(OZONE_DB_CHECKPOINT_REQUEST_FLUSH))
           .thenReturn("true");
       doNothing().when(responseMock).setContentType("application/x-tgz");
@@ -163,90 +156,27 @@ public class TestOMDbCheckpointServlet {
             }
           });
 
-      doCallRealMethod().when(omDbCheckpointServletMock).doGet(requestMock,
+      doCallRealMethod().when(scmDbCheckpointServletMock).doGet(requestMock,
           responseMock);
 
-      omDbCheckpointServletMock.init();
-      long initialCheckpointCount = omMetrics.getNumCheckpoints();
+      scmDbCheckpointServletMock.init();
+      long initialCheckpointCount =
+          scmMetrics.getDBCheckpointMetrics().getNumCheckpoints();
 
-      omDbCheckpointServletMock.doGet(requestMock, responseMock);
+      scmDbCheckpointServletMock.doGet(requestMock, responseMock);
 
       Assert.assertTrue(tempFile.length() > 0);
       Assert.assertTrue(
-          omMetrics.getLastCheckpointCreationTimeTaken() > 0);
+          scmMetrics.getDBCheckpointMetrics().
+              getLastCheckpointCreationTimeTaken() > 0);
       Assert.assertTrue(
-          omMetrics.getLastCheckpointStreamingTimeTaken() > 0);
-      Assert.assertTrue(omMetrics.getNumCheckpoints() > initialCheckpointCount);
+          scmMetrics.getDBCheckpointMetrics().
+              getLastCheckpointStreamingTimeTaken() > 0);
+      Assert.assertTrue(scmMetrics.getDBCheckpointMetrics().
+          getNumCheckpoints() > initialCheckpointCount);
     } finally {
       FileUtils.deleteQuietly(tempFile);
     }
 
   }
-
-  @Test
-  public void testWriteCheckpointToOutputStream() throws Exception {
-
-    FileInputStream fis = null;
-    FileOutputStream fos = null;
-
-    try {
-      String testDirName = folder.newFolder().getAbsolutePath();
-      File file = new File(testDirName + "/temp1.txt");
-      OutputStreamWriter writer = new OutputStreamWriter(
-          new FileOutputStream(file), StandardCharsets.UTF_8);
-      writer.write("Test data 1");
-      writer.close();
-
-      file = new File(testDirName + "/temp2.txt");
-      writer = new OutputStreamWriter(
-          new FileOutputStream(file), StandardCharsets.UTF_8);
-      writer.write("Test data 2");
-      writer.close();
-
-      File outputFile =
-          new File(Paths.get(testDirName, "output_file.tgz").toString());
-      TestDBCheckpoint dbCheckpoint = new TestDBCheckpoint(
-          Paths.get(testDirName));
-      writeOmDBCheckpointToStream(dbCheckpoint,
-          new FileOutputStream(outputFile));
-      assertNotNull(outputFile);
-    } finally {
-      IOUtils.closeStream(fis);
-      IOUtils.closeStream(fos);
-    }
-  }
 }
-
-class TestDBCheckpoint implements DBCheckpoint {
-
-  private Path checkpointFile;
-
-  TestDBCheckpoint(Path checkpointFile) {
-    this.checkpointFile = checkpointFile;
-  }
-
-  @Override
-  public Path getCheckpointLocation() {
-    return checkpointFile;
-  }
-
-  @Override
-  public long getCheckpointTimestamp() {
-    return 0;
-  }
-
-  @Override
-  public long getLatestSequenceNumber() {
-    return 0;
-  }
-
-  @Override
-  public long checkpointCreationTimeTaken() {
-    return 0;
-  }
-
-  @Override
-  public void cleanupCheckpoint() throws IOException {
-    FileUtils.deleteDirectory(checkpointFile.toFile());
-  }
-}
\ No newline at end of file
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
index c2ecd34..07ae25a 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
@@ -71,13 +71,19 @@ import org.apache.hadoop.test.GenericTestUtils;
 
 import org.apache.commons.io.FileUtils;
 import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_HEARTBEAT_INTERVAL;
+import static org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.RATIS;
+import static org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.RATIS_ADMIN;
+import static org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.RATIS_SERVER;
+import static org.apache.hadoop.hdds.protocol.DatanodeDetails.Port.Name.STANDALONE;
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState.HEALTHY;
 import static org.apache.hadoop.hdds.recon.ReconConfigKeys.OZONE_RECON_ADDRESS_KEY;
 import static org.apache.hadoop.hdds.recon.ReconConfigKeys.OZONE_RECON_DATANODE_ADDRESS_KEY;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_IPC_PORT;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_RATIS_ADMIN_PORT;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_PORT;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_RATIS_SERVER_PORT;
 import static org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_DB_DIR;
 import static org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_HTTP_ADDRESS_KEY;
 import static org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_OM_SNAPSHOT_DB_DIR;
@@ -173,15 +179,18 @@ public class MiniOzoneClusterImpl implements MiniOzoneCluster {
     this.reconServer = reconServer;
   }
 
+  @Override
   public OzoneConfiguration getConf() {
     return conf;
   }
 
+  @Override
   public String getOMServiceId() {
     // Non-HA cluster doesn't have OM Service Id.
     return null;
   }
 
+  @Override
   public String getSCMServiceId() {
     // Non-HA cluster doesn't have OM Service Id.
     return null;
@@ -379,14 +388,17 @@ public class MiniOzoneClusterImpl implements MiniOzoneCluster {
     stopDatanode(datanodeService);
     // ensure same ports are used across restarts.
     OzoneConfiguration config = datanodeService.getConf();
-    int currentPort = datanodeService.getDatanodeDetails()
-        .getPort(DatanodeDetails.Port.Name.STANDALONE).getValue();
-    config.setInt(DFS_CONTAINER_IPC_PORT, currentPort);
+    DatanodeDetails dn = datanodeService.getDatanodeDetails();
     config.setBoolean(DFS_CONTAINER_IPC_RANDOM_PORT, false);
-    int ratisPort = datanodeService.getDatanodeDetails()
-        .getPort(DatanodeDetails.Port.Name.RATIS).getValue();
-    config.setInt(DFS_CONTAINER_RATIS_IPC_PORT, ratisPort);
     config.setBoolean(DFS_CONTAINER_RATIS_IPC_RANDOM_PORT, false);
+    config.setInt(DFS_CONTAINER_IPC_PORT,
+        dn.getPort(STANDALONE).getValue());
+    config.setInt(DFS_CONTAINER_RATIS_IPC_PORT,
+        dn.getPort(RATIS).getValue());
+    config.setInt(DFS_CONTAINER_RATIS_ADMIN_PORT,
+        dn.getPort(RATIS_ADMIN).getValue());
+    config.setInt(DFS_CONTAINER_RATIS_SERVER_PORT,
+        dn.getPort(RATIS_SERVER).getValue());
     hddsDatanodes.remove(i);
     if (waitForDatanode) {
       // wait for node to be removed from SCM healthy node list.
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
index 5ff02ad..178ea6d 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestMiniOzoneCluster.java
@@ -139,34 +139,12 @@ public class TestMiniOzoneCluster {
   public void testDatanodeIDPersistent() throws Exception {
     // Generate IDs for testing
     DatanodeDetails id1 = randomDatanodeDetails();
-    DatanodeDetails id2 = randomDatanodeDetails();
-    DatanodeDetails id3 = randomDatanodeDetails();
     id1.setPort(DatanodeDetails.newPort(Port.Name.STANDALONE, 1));
-    id2.setPort(DatanodeDetails.newPort(Port.Name.STANDALONE, 2));
-    id3.setPort(DatanodeDetails.newPort(Port.Name.STANDALONE, 3));
+    assertWriteRead(id1);
 
     // Add certificate serial  id.
-    String certSerialId = "" + RandomUtils.nextLong();
-    id1.setCertSerialId(certSerialId);
-
-    // Write a single ID to the file and read it out
-    File validIdsFile = new File(WRITE_TMP, "valid-values.id");
-    validIdsFile.delete();
-    ContainerUtils.writeDatanodeDetailsTo(id1, validIdsFile);
-    // Validate using yaml parser
-    Yaml yaml = new Yaml();
-    try {
-      yaml.load(new InputStreamReader(new FileInputStream(validIdsFile),
-          StandardCharsets.UTF_8));
-    } catch (Exception e) {
-      Assert.fail("Failed parsing datanode id yaml.");
-    }
-    DatanodeDetails validId = ContainerUtils.readDatanodeDetailsFrom(
-        validIdsFile);
-
-    assertEquals(validId.getCertSerialId(), certSerialId);
-    assertEquals(id1, validId);
-    assertEquals(id1.getProtoBufMessage(), validId.getProtoBufMessage());
+    id1.setCertSerialId("" + RandomUtils.nextLong());
+    assertWriteRead(id1);
 
     // Read should return an empty value if file doesn't exist
     File nonExistFile = new File(READ_TMP, "non_exist.id");
@@ -194,10 +172,32 @@ public class TestMiniOzoneCluster {
       HddsProtos.DatanodeDetailsProto proto = id1.getProtoBufMessage();
       proto.writeTo(out);
     }
-    validId = ContainerUtils.readDatanodeDetailsFrom(protoFile);
-    assertEquals(validId.getCertSerialId(), certSerialId);
-    assertEquals(id1, validId);
-    assertEquals(id1.getProtoBufMessage(), validId.getProtoBufMessage());
+    assertDetailsEquals(id1, ContainerUtils.readDatanodeDetailsFrom(protoFile));
+
+    id1.setInitialVersion(1);
+    assertWriteRead(id1);
+  }
+
+  private static void assertWriteRead(DatanodeDetails details)
+      throws IOException {
+    // Write a single ID to the file and read it out
+    File file = new File(WRITE_TMP, "valid-values.id");
+    file.delete();
+    ContainerUtils.writeDatanodeDetailsTo(details, file);
+
+    // Validate using yaml parser
+    Yaml yaml = new Yaml();
+    try {
+      yaml.load(new InputStreamReader(new FileInputStream(file),
+          StandardCharsets.UTF_8));
+    } catch (Exception e) {
+      Assert.fail("Failed parsing datanode id yaml.");
+    }
+
+    DatanodeDetails read = ContainerUtils.readDatanodeDetailsFrom(file);
+
+    assertDetailsEquals(details, read);
+    assertEquals(details.getCurrentVersion(), read.getCurrentVersion());
   }
 
   @Test
@@ -360,4 +360,12 @@ public class TestMiniOzoneCluster {
         .getDatanodeStateMachine().getContainer().getVolumeSet()
         .getVolumesList().size());
   }
+
+  private static void assertDetailsEquals(DatanodeDetails expected,
+      DatanodeDetails actual) {
+    assertEquals(expected, actual);
+    assertEquals(expected.getCertSerialId(), actual.getCertSerialId());
+    assertEquals(expected.getProtoBufMessage(), actual.getProtoBufMessage());
+    assertEquals(expected.getInitialVersion(), actual.getInitialVersion());
+  }
 }
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java
index 6970bc3..676c096 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java
@@ -22,10 +22,16 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.security.NoSuchAlgorithmException;
 import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Random;
+import java.util.TreeMap;
 import java.util.UUID;
 
+import org.apache.hadoop.conf.StorageUnit;
 import org.apache.hadoop.crypto.key.KeyProvider;
 import org.apache.hadoop.crypto.key.kms.KMSClientProvider;
 import org.apache.hadoop.crypto.key.kms.server.MiniKMS;
@@ -48,6 +54,7 @@ import org.apache.hadoop.ozone.client.OzoneClientFactory;
 import org.apache.hadoop.ozone.client.OzoneKey;
 import org.apache.hadoop.ozone.client.OzoneKeyDetails;
 import org.apache.hadoop.ozone.client.OzoneVolume;
+import org.apache.hadoop.ozone.client.io.MultipartCryptoKeyInputStream;
 import org.apache.hadoop.ozone.client.io.OzoneInputStream;
 import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
 import org.apache.hadoop.ozone.om.OMMetadataManager;
@@ -55,21 +62,25 @@ import org.apache.hadoop.ozone.om.OzoneManager;
 import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
 import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
 import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
+import org.apache.hadoop.ozone.om.helpers.OmMultipartCommitUploadPartInfo;
+import org.apache.hadoop.ozone.om.helpers.OmMultipartInfo;
+import org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo;
 import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
 import org.apache.hadoop.test.GenericTestUtils;
 
 import static org.apache.hadoop.hdds.HddsConfigKeys.OZONE_METADATA_DIRS;
+import static org.apache.hadoop.hdds.client.ReplicationFactor.ONE;
+import static org.apache.hadoop.hdds.client.ReplicationType.STAND_ALONE;
+
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * This class is to test all the public facing APIs of Ozone Client.
  */
-@Ignore
-public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
+public class TestOzoneAtRestEncryption {
 
   private static MiniOzoneCluster cluster = null;
   private static MiniKMS miniKMS;
@@ -84,15 +95,15 @@ public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
   private static File testDir;
   private static OzoneConfiguration conf;
   private static final String TEST_KEY = "key1";
+  private static final Random RANDOM = new Random();
 
+  private static final int MPU_PART_MIN_SIZE = 256 * 1024; // 256KB
+  private static final int BLOCK_SIZE = 64 * 1024; // 64KB
+  private static final int CHUNK_SIZE = 16 * 1024; // 16KB
+  private static final int DEFAULT_CRYPTO_BUFFER_SIZE = 8 * 1024; // 8KB
+  // (this is the default Crypto Buffer size as determined by the config
+  // hadoop.security.crypto.buffer.size)
 
-    /**
-     * Create a MiniOzoneCluster for testing.
-     * <p>
-     * Ozone is made active by setting OZONE_ENABLED = true
-     *
-     * @throws IOException
-     */
   @BeforeClass
   public static void init() throws Exception {
     testDir = GenericTestUtils.getTestDir(
@@ -117,6 +128,9 @@ public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
         .setNumDatanodes(10)
         .setScmId(SCM_ID)
         .setClusterId(CLUSTER_ID)
+        .setBlockSize(BLOCK_SIZE)
+        .setChunkSize(CHUNK_SIZE)
+        .setStreamBufferSizeUnit(StorageUnit.BYTES)
         .setCertificateClient(certificateClientTest)
         .build();
     cluster.getOzoneManager().startSecretManager();
@@ -126,6 +140,7 @@ public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
     storageContainerLocationClient =
         cluster.getStorageContainerLocationClient();
     ozoneManager = cluster.getOzoneManager();
+    ozoneManager.setMinMultipartUploadPartSize(MPU_PART_MIN_SIZE);
     TestOzoneRpcClient.setCluster(cluster);
     TestOzoneRpcClient.setOzClient(ozClient);
     TestOzoneRpcClient.setOzoneManager(ozoneManager);
@@ -138,11 +153,9 @@ public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
     createKey(TEST_KEY, cluster.getOzoneManager().getKmsProvider(), conf);
   }
 
-
-
-    /**
-     * Close OzoneClient and shutdown MiniOzoneCluster.
-     */
+  /**
+   * Close OzoneClient and shutdown MiniOzoneCluster.
+   */
   @AfterClass
   public static void shutdown() throws IOException {
     if(ozClient != null) {
@@ -273,6 +286,14 @@ public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
     OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
     String objectKey = omMetadataManager.getOzoneKey(volumeName, bucketName,
         keyName);
+
+    GenericTestUtils.waitFor(() -> {
+      try {
+        return omMetadataManager.getDeletedTable().isExist(objectKey);
+      } catch (IOException e) {
+        return false;
+      }
+    }, 500, 100000);
     RepeatedOmKeyInfo deletedKeys =
         omMetadataManager.getDeletedTable().get(objectKey);
     Map<String, String> deletedKeyMetadata =
@@ -325,4 +346,151 @@ public class TestOzoneAtRestEncryption extends TestOzoneRpcClient {
     provider.createKey(keyName, options);
     provider.flush();
   }
+
+  @Test
+  public void testMPUwithOnePart() throws Exception {
+    testMultipartUploadWithEncryption(1);
+  }
+
+  @Test
+  public void testMPUwithTwoParts() throws Exception {
+    testMultipartUploadWithEncryption(2);
+  }
+
+  public void testMultipartUploadWithEncryption(int numParts) throws Exception {
+    String volumeName = UUID.randomUUID().toString();
+    String bucketName = UUID.randomUUID().toString();
+    String keyName = "mpu_test_key_" + numParts;
+
+    store.createVolume(volumeName);
+    OzoneVolume volume = store.getVolume(volumeName);
+    BucketArgs bucketArgs = BucketArgs.newBuilder()
+        .setBucketEncryptionKey(TEST_KEY).build();
+    volume.createBucket(bucketName, bucketArgs);
+    OzoneBucket bucket = volume.getBucket(bucketName);
+
+    // Initiate multipart upload
+    String uploadID = initiateMultipartUpload(bucket, keyName, STAND_ALONE,
+        ONE);
+
+    // Upload Parts
+    Map<Integer, String> partsMap = new TreeMap<>();
+    List<byte[]> partsData = new ArrayList<>();
+    int keySize = 0;
+    for (int i = 1; i <= numParts; i++) {
+      // Generate random data with different sizes for each part.
+      // Adding a random int with a cap at 8K (the default crypto buffer
+      // size) to get parts whose last byte does not coincide with crypto
+      // buffer boundary.
+      byte[] data = generateRandomData((MPU_PART_MIN_SIZE * i) +
+          RANDOM.nextInt(DEFAULT_CRYPTO_BUFFER_SIZE));
+      String partName = uploadPart(bucket, keyName, uploadID, i, data);
+      partsMap.put(i, partName);
+      partsData.add(data);
+      keySize += data.length;
+    }
+
+    // Combine the parts data into 1 byte array for verification
+    byte[] inputData = new byte[keySize];
+    int dataCopied = 0;
+    for (int i = 1; i <= numParts; i++) {
+      byte[] partBytes = partsData.get(i - 1);
+      System.arraycopy(partBytes, 0, inputData, dataCopied, partBytes.length);
+      dataCopied += partBytes.length;
+    }
+
+    // Complete MPU
+    completeMultipartUpload(bucket, keyName, uploadID, partsMap);
+
+    // Read different data lengths and starting from different offsets and
+    // verify the data matches.
+    Random random = new Random();
+    int randomSize = random.nextInt(keySize/2);
+    int randomOffset = random.nextInt(keySize - randomSize);
+
+    int[] readDataSizes = {keySize, keySize / 3 + 1, BLOCK_SIZE,
+        BLOCK_SIZE * 2 + 1, CHUNK_SIZE, CHUNK_SIZE / 4 - 1,
+        DEFAULT_CRYPTO_BUFFER_SIZE, DEFAULT_CRYPTO_BUFFER_SIZE / 2, 1,
+        randomSize};
+
+    int[] readFromPositions = {0, DEFAULT_CRYPTO_BUFFER_SIZE + 10, CHUNK_SIZE,
+        BLOCK_SIZE - DEFAULT_CRYPTO_BUFFER_SIZE + 1, BLOCK_SIZE, keySize / 3,
+        keySize - 1, randomOffset};
+
+    // Create an input stream to read the data
+    OzoneInputStream inputStream = bucket.readKey(keyName);
+    Assert.assertTrue(inputStream instanceof MultipartCryptoKeyInputStream);
+    MultipartCryptoKeyInputStream cryptoInputStream =
+        (MultipartCryptoKeyInputStream) inputStream;
+
+    for (int readDataLen : readDataSizes) {
+      for (int readFromPosition : readFromPositions) {
+        // Check that offset + buffer size does not exceed the key size
+        if (readFromPosition + readDataLen > keySize) {
+          continue;
+        }
+
+        byte[] readData = new byte[readDataLen];
+        cryptoInputStream.seek(readFromPosition);
+        inputStream.read(readData, 0, readDataLen);
+
+        assertReadContent(inputData, readData, readFromPosition);
+      }
+    }
+  }
+
+  private static byte[] generateRandomData(int length) {
+    byte[] bytes = new byte[length];
+    RANDOM.nextBytes(bytes);
+    return bytes;
+  }
+
+  private String initiateMultipartUpload(OzoneBucket bucket, String keyName,
+      ReplicationType replicationType, ReplicationFactor replicationFactor)
+      throws Exception {
+    OmMultipartInfo multipartInfo = bucket.initiateMultipartUpload(keyName,
+        replicationType, replicationFactor);
+
+    String uploadID = multipartInfo.getUploadID();
+    Assert.assertNotNull(uploadID);
+    return uploadID;
+  }
+
+  private String uploadPart(OzoneBucket bucket, String keyName,
+      String uploadID, int partNumber, byte[] data) throws Exception {
+    OzoneOutputStream ozoneOutputStream = bucket.createMultipartKey(keyName,
+        data.length, partNumber, uploadID);
+    ozoneOutputStream.write(data, 0, data.length);
+    ozoneOutputStream.close();
+
+    OmMultipartCommitUploadPartInfo omMultipartCommitUploadPartInfo =
+        ozoneOutputStream.getCommitUploadPartInfo();
+
+    Assert.assertNotNull(omMultipartCommitUploadPartInfo);
+    Assert.assertNotNull(omMultipartCommitUploadPartInfo.getPartName());
+    return omMultipartCommitUploadPartInfo.getPartName();
+  }
+
+  private void completeMultipartUpload(OzoneBucket bucket, String keyName,
+      String uploadID, Map<Integer, String> partsMap) throws Exception {
+    OmMultipartUploadCompleteInfo omMultipartUploadCompleteInfo = bucket
+        .completeMultipartUpload(keyName, uploadID, partsMap);
+
+    Assert.assertNotNull(omMultipartUploadCompleteInfo);
+    Assert.assertEquals(omMultipartUploadCompleteInfo.getBucket(), bucket
+        .getName());
+    Assert.assertEquals(omMultipartUploadCompleteInfo.getVolume(), bucket
+        .getVolumeName());
+    Assert.assertEquals(omMultipartUploadCompleteInfo.getKey(), keyName);
+    Assert.assertNotNull(omMultipartUploadCompleteInfo.getHash());
+  }
+
+  private static void assertReadContent(byte[] inputData, byte[] readData,
+      int offset) {
+    byte[] inputDataForComparison = Arrays.copyOfRange(inputData, offset,
+        offset + readData.length);
+    Assert.assertArrayEquals("Read data does not match input data at offset " +
+        offset + " and length " + readData.length,
+        inputDataForComparison, readData);
+  }
 }
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
index 9319f13..028d9bb 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
@@ -89,6 +89,7 @@ import org.apache.hadoop.ozone.om.ha.OMProxyInfo;
 import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
 import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
 import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
+import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfoGroup;
 import org.apache.hadoop.ozone.om.helpers.OmMultipartCommitUploadPartInfo;
 import org.apache.hadoop.ozone.om.helpers.OmMultipartInfo;
 import org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo;
@@ -3072,7 +3073,6 @@ public abstract class TestOzoneRpcClientAbstract {
     return chars;
   }
 
-
   private void doMultipartUpload(OzoneBucket bucket, String keyName, byte val)
       throws Exception {
     // Initiate Multipart upload request
@@ -3101,11 +3101,9 @@ public abstract class TestOzoneRpcClientAbstract {
     partsMap.put(3, partName);
     length += part3.getBytes(UTF_8).length;
 
-
     // Complete multipart upload request
     completeMultipartUpload(bucket, keyName, uploadID, partsMap);
 
-
     //Now Read the key which has been completed multipart upload.
     byte[] fileContent = new byte[data.length + data.length + part3.getBytes(
         UTF_8).length];
@@ -3125,8 +3123,19 @@ public abstract class TestOzoneRpcClientAbstract {
     sb.append(part2);
     sb.append(part3);
     Assert.assertEquals(sb.toString(), new String(fileContent, UTF_8));
-  }
 
+    String ozoneKey = ozoneManager.getMetadataManager()
+        .getOzoneKey(bucket.getVolumeName(), bucket.getName(), keyName);
+    OmKeyInfo omKeyInfo = ozoneManager.getMetadataManager().getKeyTable()
+        .get(ozoneKey);
+
+    OmKeyLocationInfoGroup latestVersionLocations =
+        omKeyInfo.getLatestVersionLocations();
+    Assert.assertEquals(true, latestVersionLocations.isMultipartKey());
+    latestVersionLocations.getBlocksLatestVersionOnly()
+        .forEach(omKeyLocationInfo ->
+            Assert.assertTrue(omKeyLocationInfo.getPartNumber() != -1));
+  }
 
   private String initiateMultipartUpload(OzoneBucket bucket, String keyName,
       ReplicationType replicationType, ReplicationFactor replicationFactor)
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java
index 2a52c96..3a90ae1 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java
@@ -39,6 +39,7 @@ import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.ozone.MiniOzoneCluster;
 import org.apache.hadoop.ozone.OzoneConsts;
+import org.apache.hadoop.security.UserGroupInformation;
 
 import org.apache.commons.io.FileUtils;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
@@ -46,13 +47,11 @@ import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_WILDCARD;
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS;
 import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_FLUSH;
-import static org.apache.hadoop.ozone.om.OMDBCheckpointServlet.writeOmDBCheckpointToStream;
-
-import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.After;
+import static org.apache.hadoop.ozone.om.OMDBCheckpointServlet.writeDBCheckpointToStream;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import static org.junit.Assert.assertNotNull;
-import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -67,15 +66,15 @@ import static org.mockito.Mockito.when;
  * Class used for testing the OM DB Checkpoint provider servlet.
  */
 public class TestOMDbCheckpointServlet {
-  private MiniOzoneCluster cluster = null;
-  private OMMetrics omMetrics;
-  private OzoneConfiguration conf;
-  private String clusterId;
-  private String scmId;
-  private String omId;
+  private static MiniOzoneCluster cluster = null;
+  private static OMMetrics omMetrics;
+  private static OzoneConfiguration conf;
+  private static String clusterId;
+  private static String scmId;
+  private static String omId;
 
   @Rule
-  public Timeout timeout = new Timeout(60000);
+  public Timeout timeout = new Timeout(240000);
 
   @Rule
   public TemporaryFolder folder = new TemporaryFolder();
@@ -86,8 +85,8 @@ public class TestOMDbCheckpointServlet {
    *
    * @throws IOException
    */
-  @Before
-  public void init() throws Exception {
+  @BeforeClass
+  public static void init() throws Exception {
     conf = new OzoneConfiguration();
     clusterId = UUID.randomUUID().toString();
     scmId = UUID.randomUUID().toString();
@@ -99,6 +98,7 @@ public class TestOMDbCheckpointServlet {
         .setClusterId(clusterId)
         .setScmId(scmId)
         .setOmId(omId)
+        .setNumDatanodes(1)
         .build();
     cluster.waitForClusterToBeReady();
     omMetrics = cluster.getOzoneManager().getMetrics();
@@ -107,8 +107,8 @@ public class TestOMDbCheckpointServlet {
   /**
    * Shutdown MiniDFSCluster.
    */
-  @After
-  public void shutdown() {
+  @AfterClass
+  public static void shutdown() {
     if (cluster != null) {
       cluster.shutdown();
     }
@@ -116,13 +116,19 @@ public class TestOMDbCheckpointServlet {
 
   @Test
   public void testDoGet() throws ServletException, IOException {
-
     File tempFile = null;
     try {
       OMDBCheckpointServlet omDbCheckpointServletMock =
           mock(OMDBCheckpointServlet.class);
 
+      final OzoneManager om = cluster.getOzoneManager();
+
       doCallRealMethod().when(omDbCheckpointServletMock).init();
+      doCallRealMethod().when(omDbCheckpointServletMock).initialize(
+          om.getMetadataManager().getStore(),
+          om.getMetrics().getDBCheckpointMetrics(),
+          om.getAclsEnabled(),
+          om.getOzoneAdmins(om.getConfiguration()));
 
       HttpServletRequest requestMock = mock(HttpServletRequest.class);
       // Return current user short name when asked
@@ -167,16 +173,20 @@ public class TestOMDbCheckpointServlet {
           responseMock);
 
       omDbCheckpointServletMock.init();
-      long initialCheckpointCount = omMetrics.getNumCheckpoints();
+      long initialCheckpointCount =
+          omMetrics.getDBCheckpointMetrics().getNumCheckpoints();
 
       omDbCheckpointServletMock.doGet(requestMock, responseMock);
 
       Assert.assertTrue(tempFile.length() > 0);
       Assert.assertTrue(
-          omMetrics.getLastCheckpointCreationTimeTaken() > 0);
+          omMetrics.getDBCheckpointMetrics().
+              getLastCheckpointCreationTimeTaken() > 0);
       Assert.assertTrue(
-          omMetrics.getLastCheckpointStreamingTimeTaken() > 0);
-      Assert.assertTrue(omMetrics.getNumCheckpoints() > initialCheckpointCount);
+          omMetrics.getDBCheckpointMetrics().
+              getLastCheckpointStreamingTimeTaken() > 0);
+      Assert.assertTrue(omMetrics.getDBCheckpointMetrics().
+          getNumCheckpoints() > initialCheckpointCount);
     } finally {
       FileUtils.deleteQuietly(tempFile);
     }
@@ -207,7 +217,7 @@ public class TestOMDbCheckpointServlet {
           new File(Paths.get(testDirName, "output_file.tgz").toString());
       TestDBCheckpoint dbCheckpoint = new TestDBCheckpoint(
           Paths.get(testDirName));
-      writeOmDBCheckpointToStream(dbCheckpoint,
+      writeDBCheckpointToStream(dbCheckpoint,
           new FileOutputStream(outputFile));
       assertNotNull(outputFile);
     } finally {
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconAsPassiveScm.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconAsPassiveScm.java
index 19496d9..efde033 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconAsPassiveScm.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconAsPassiveScm.java
@@ -42,6 +42,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.Timeout;
+import org.slf4j.event.Level;
 
 import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_CONTAINER_REPORT_INTERVAL;
 import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_PIPELINE_REPORT_INTERVAL;
@@ -140,6 +141,7 @@ public class TestReconAsPassiveScm {
 
     GenericTestUtils.LogCapturer logCapturer =
         GenericTestUtils.LogCapturer.captureLogs(ReconNodeManager.LOG);
+    GenericTestUtils.setLogLevel(ReconNodeManager.LOG, Level.DEBUG);
     reconScm.getEventQueue().fireEvent(CLOSE_CONTAINER,
         containerInfo.containerID());
     GenericTestUtils.waitFor(() -> logCapturer.getOutput()
diff --git a/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto b/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
index 38b8c50..da43725 100644
--- a/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
+++ b/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
@@ -747,12 +747,15 @@ message KeyLocation {
     // get the up to date pipeline information. This will need o3fs
     // provide not only a OM delegation token but also a SCM delegation token
     optional hadoop.hdds.Pipeline pipeline = 7;
+
+    optional int32 partNumber = 9 [default = -1];
 }
 
 message KeyLocationList {
     optional uint64 version = 1;
     repeated KeyLocation keyLocations = 2;
     optional FileEncryptionInfoProto fileEncryptionInfo = 3;
+    optional bool isMultipartKey = 4 [default = false];
 }
 
 message KeyInfo {
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
index 962ffc3..4a968fd 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
@@ -621,7 +621,7 @@ public class KeyManagerImpl implements KeyManager {
       keyInfo.setModificationTime(Time.now());
 
       //update the block length for each block
-      keyInfo.updateLocationInfoList(locationInfoList);
+      keyInfo.updateLocationInfoList(locationInfoList, false);
       metadataManager.getStore().move(
           openKey,
           objectKey,
@@ -1116,7 +1116,7 @@ public class KeyManagerImpl implements KeyManager {
 
       // set the data size and location info list
       keyInfo.setDataSize(omKeyArgs.getDataSize());
-      keyInfo.updateLocationInfoList(omKeyArgs.getLocationInfoList());
+      keyInfo.updateLocationInfoList(omKeyArgs.getLocationInfoList(), true);
 
       partName = metadataManager.getOzoneKey(volumeName, bucketName, keyName)
           + clientID;
@@ -1748,6 +1748,7 @@ public class KeyManagerImpl implements KeyManager {
    * @throws IOException if there is error in the db
    *                     invalid arguments
    */
+  @Override
   public OzoneFileStatus getFileStatus(OmKeyArgs args) throws IOException {
     Preconditions.checkNotNull(args, "Key args can not be null");
     return getFileStatus(args, null);
@@ -1765,6 +1766,7 @@ public class KeyManagerImpl implements KeyManager {
    * @throws IOException if there is error in the db
    *                     invalid arguments
    */
+  @Override
   public OzoneFileStatus getFileStatus(OmKeyArgs args, String clientAddress)
           throws IOException {
     Preconditions.checkNotNull(args, "Key args can not be null");
@@ -1846,6 +1848,7 @@ public class KeyManagerImpl implements KeyManager {
    * @throws IOException if there is error in the db
    *                     invalid arguments
    */
+  @Override
   public void createDirectory(OmKeyArgs args) throws IOException {
     Preconditions.checkNotNull(args, "Key args can not be null");
     String volumeName = args.getVolumeName();
@@ -1994,6 +1997,7 @@ public class KeyManagerImpl implements KeyManager {
    * Refresh the key block location information by get latest info from SCM.
    * @param key
    */
+  @Override
   public void refresh(OmKeyInfo key) throws IOException {
     Preconditions.checkNotNull(key, "Key info can not be null");
     refreshPipeline(Arrays.asList(key));
@@ -2048,6 +2052,7 @@ public class KeyManagerImpl implements KeyManager {
    * @param numEntries Number of entries to list from the start key
    * @return list of file status
    */
+  @Override
   public List<OzoneFileStatus> listStatus(OmKeyArgs args, boolean recursive,
                                           String startKey, long numEntries)
           throws IOException {
@@ -2067,6 +2072,7 @@ public class KeyManagerImpl implements KeyManager {
    *                      pipeline by distance between client and datanode.
    * @return list of file status
    */
+  @Override
   public List<OzoneFileStatus> listStatus(OmKeyArgs args, boolean recursive,
       String startKey, long numEntries, String clientAddress)
           throws IOException {
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java
index dcb5392..39868b4 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java
@@ -19,42 +19,15 @@
 package org.apache.hadoop.ozone.om;
 
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.time.Duration;
-import java.time.Instant;
-import java.util.Collection;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
-import org.apache.hadoop.hdds.utils.db.DBStore;
-import org.apache.hadoop.hdfs.util.DataTransferThrottler;
+import org.apache.hadoop.hdds.utils.DBCheckpointServlet;
 import org.apache.hadoop.ozone.OzoneConsts;
 
-import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.ArchiveOutputStream;
-import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
-import org.apache.commons.compress.compressors.CompressorException;
-import org.apache.commons.compress.compressors.CompressorOutputStream;
-import org.apache.commons.compress.compressors.CompressorStreamFactory;
-import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-
-import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_WILDCARD;
-import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_FLUSH;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
+
 /**
  * Provides the current checkpoint Snapshot of the OM DB. (tar.gz)
  *
@@ -68,21 +41,16 @@ import org.slf4j.LoggerFactory;
  * If Kerberos is not enabled, simply append the login user name to
  * `ozone.administrator`, e.g. `scm`
  */
-public class OMDBCheckpointServlet extends HttpServlet {
+public class OMDBCheckpointServlet extends DBCheckpointServlet {
 
   private static final Logger LOG =
       LoggerFactory.getLogger(OMDBCheckpointServlet.class);
   private static final long serialVersionUID = 1L;
 
-  private transient OzoneManager om;
-  private transient DBStore omDbStore;
-  private transient OMMetrics omMetrics;
-  private transient DataTransferThrottler throttler = null;
-
   @Override
   public void init() throws ServletException {
 
-    om = (OzoneManager) getServletContext()
+    OzoneManager om = (OzoneManager) getServletContext()
         .getAttribute(OzoneConsts.OM_CONTEXT_ATTRIBUTE);
 
     if (om == null) {
@@ -90,185 +58,13 @@ public class OMDBCheckpointServlet extends HttpServlet {
       return;
     }
 
-    omDbStore = om.getMetadataManager().getStore();
-    omMetrics = om.getMetrics();
-
-    OzoneConfiguration configuration = om.getConfiguration();
-    long transferBandwidth = configuration.getLongBytes(
-        OMConfigKeys.OZONE_DB_CHECKPOINT_TRANSFER_RATE_KEY,
-        OMConfigKeys.OZONE_DB_CHECKPOINT_TRANSFER_RATE_DEFAULT);
-
-    if (transferBandwidth > 0) {
-      throttler = new DataTransferThrottler(transferBandwidth);
-    }
-  }
-
-  private boolean hasPermission(String username) {
-    // Check ACL for dbCheckpoint only when global Ozone ACL is enabled
-    if (om.getAclsEnabled()) {
-      // Only Ozone admins are allowed
-      try {
-        Collection<String> admins = om.getOzoneAdmins(om.getConfiguration());
-        if (admins.contains(OZONE_ADMINISTRATORS_WILDCARD) ||
-            admins.contains(username)) {
-          return true;
-        }
-      } catch (IOException e) {
-        LOG.warn("Error checking permission: {}", e.getMessage());
-      }
-      return false;
-    } else {
-      return true;
-    }
-  }
-
-  /**
-   * Process a GET request for the Ozone Manager DB checkpoint snapshot.
-   *
-   * @param request  The servlet request we are processing
-   * @param response The servlet response we are creating
-   */
-  @Override
-  public void doGet(HttpServletRequest request, HttpServletResponse response) {
-
-    LOG.info("Received request to obtain OM DB checkpoint snapshot");
-    if (omDbStore == null) {
-      LOG.error(
-          "Unable to process metadata snapshot request. DB Store is null");
-      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-      return;
-    }
-
-    // Check ACL for dbCheckpoint only when global Ozone ACL is enable
-    if (om.getAclsEnabled()) {
-      final java.security.Principal userPrincipal = request.getUserPrincipal();
-      if (userPrincipal == null) {
-        final String remoteUser = request.getRemoteUser();
-        LOG.error("Permission denied: Unauthorized access to /dbCheckpoint,"
-            + " no user principal found. Current login user is {}.",
-            remoteUser != null ? "'" + remoteUser + "'" : "UNKNOWN");
-        response.setStatus(HttpServletResponse.SC_FORBIDDEN);
... 3498 lines suppressed ...


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org