Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,6 @@ StatusAndMessages queryUpgradeFinalizationProgress(
* commands operating on {@code containerID}.
*/
Token<?> getContainerToken(ContainerID containerID) throws IOException;

long getContainerCount() throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public final class OzoneConsts {
// OM Http server endpoints
public static final String OZONE_OM_SERVICE_LIST_HTTP_ENDPOINT =
"/serviceList";
public static final String OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT =
public static final String OZONE_DB_CHECKPOINT_HTTP_ENDPOINT =
"/dbCheckpoint";

// Ozone File System scheme
Expand Down
35 changes: 35 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2546,6 +2546,24 @@
OM snapshot.
</description>
</property>
<property>
<name>ozone.recon.scm.connection.request.timeout</name>
<value>5s</value>
<tag>OZONE, RECON, SCM</tag>
<description>
Connection request timeout in milliseconds for HTTP call made by Recon to
request SCM DB snapshot.
</description>
</property>
<property>
<name>ozone.recon.scm.connection.timeout</name>
<value>5s</value>
<tag>OZONE, RECON, SCM</tag>
<description>
Connection timeout for HTTP call in milliseconds made by Recon to request
SCM snapshot.
</description>
</property>
<property>
<name>ozone.recon.om.socket.timeout</name>
<value>5s</value>
Expand Down Expand Up @@ -2579,6 +2597,23 @@
Request to flush the OM DB before taking checkpoint snapshot.
</description>
</property>
<property>
<name>ozone.recon.scm.container.threshold</name>
<value>100</value>
<tag>OZONE, RECON, SCM</tag>
<description>
Threshold value for the difference in number of containers
in SCM and RECON.
</description>
</property>
<property>
<name>ozone.recon.scm.snapshot.enabled</name>
<value>false</value>
<tag>OZONE, RECON, SCM</tag>
<description>
If enabled, SCM DB Snapshot is taken by Recon.
</description>
</property>
<property>
<name>hdds.tracing.enabled</name>
<value>false</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchRequestProto;
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.GetContainerCountRequestProto;
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerCountResponseProto;
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;
Expand Down Expand Up @@ -931,6 +933,18 @@ public Token<?> getContainerToken(
return OzonePBHelper.tokenFromProto(response.getToken());
}

@Override
public long getContainerCount() throws IOException {
GetContainerCountRequestProto request =
GetContainerCountRequestProto.newBuilder().build();

GetContainerCountResponseProto response =
submitRequest(Type.GetContainerCount,
builder -> builder.setGetContainerCountRequest(request))
.getGetContainerCountResponse();
return response.getContainerCount();
}

@Override
public Object getUnderlyingProxyObject() {
return rpcProxy;
Expand Down
10 changes: 10 additions & 0 deletions hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ message ScmContainerLocationRequest {
optional ContainerBalancerStatusRequestProto containerBalancerStatusRequest = 35;
optional FinalizeScmUpgradeRequestProto finalizeScmUpgradeRequest = 36;
optional QueryUpgradeFinalizationProgressRequestProto queryUpgradeFinalizationProgressRequest = 37;
optional GetContainerCountRequestProto getContainerCountRequest = 38;
}

message ScmContainerLocationResponse {
Expand Down Expand Up @@ -119,6 +120,7 @@ message ScmContainerLocationResponse {
optional ContainerBalancerStatusResponseProto containerBalancerStatusResponse = 35;
optional FinalizeScmUpgradeResponseProto finalizeScmUpgradeResponse = 36;
optional QueryUpgradeFinalizationProgressResponseProto queryUpgradeFinalizationProgressResponse = 37;
optional GetContainerCountResponseProto getContainerCountResponse = 38;

enum Status {
OK = 1;
Expand Down Expand Up @@ -162,6 +164,7 @@ enum Type {
GetContainerBalancerStatus = 30;
FinalizeScmUpgrade = 31;
QueryUpgradeFinalizationProgress = 32;
GetContainerCount = 33;
}

/**
Expand Down Expand Up @@ -383,6 +386,13 @@ message GetPipelineResponseProto {
required Pipeline pipeline = 1;
}

message GetContainerCountRequestProto {
}

message GetContainerCountResponseProto {
required int64 containerCount = 1;
}

message ActivatePipelineRequestProto {
required PipelineID pipelineID = 1;
optional string traceID = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ public List<String> getRatisRoles() throws IOException {
peer.getAddress().concat(isLocal ?
":".concat(RaftProtos.RaftPeerRole.LEADER.toString()) :
":".concat(RaftProtos.RaftPeerRole.FOLLOWER.toString()))
.concat(":".concat(peer.getId().toString()))));
.concat(":".concat(peer.getId().toString()))
.concat(":".concat(peerInetAddress.getHostAddress()))));
}
return ratisRoles;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineResponseProto;
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchRequestProto;
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchResponseProto;
import org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerCountResponseProto;
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;
Expand Down Expand Up @@ -397,6 +398,13 @@ public ScmContainerLocationResponse processRequest(
.setDatanodeUsageInfoResponse(getDatanodeUsageInfo(
request.getDatanodeUsageInfoRequest()))
.build();
case GetContainerCount:
return ScmContainerLocationResponse.newBuilder()
.setCmdType(request.getCmdType())
.setStatus(Status.OK)
.setGetContainerCountResponse(getContainerCount(
request.getGetContainerCountRequest()))
.build();
default:
throw new IllegalArgumentException(
"Unknown command type: " + request.getCmdType());
Expand Down Expand Up @@ -831,4 +839,12 @@ public DatanodeUsageInfoResponseProto getDatanodeUsageInfo(
.build();
}

public GetContainerCountResponseProto getContainerCount(
StorageContainerLocationProtocolProtos.GetContainerCountRequestProto
request) throws IOException {

return GetContainerCountResponseProto.newBuilder()
.setContainerCount(impl.getContainerCount())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,11 @@ public Token<?> getContainerToken(ContainerID containerID)
.generateToken(remoteUser.getUserName(), containerID);
}

@Override
public long getContainerCount() throws IOException {
return scm.getContainerManager().getContainers().size();
}

/**
* Queries a list of Node that match a set of statuses.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
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;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_HTTP_ENDPOINT;

/**
* HttpServer2 wrapper for the Ozone Storage Container Manager.
Expand All @@ -34,7 +34,7 @@ public StorageContainerManagerHttpServer(MutableConfigurationSource conf,
StorageContainerManager scm)
throws IOException {
super(conf, "scm");
addServlet("dbCheckpoint", OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT,
addServlet("dbCheckpoint", OZONE_DB_CHECKPOINT_HTTP_ENDPOINT,
SCMDBCheckpointServlet.class);
getWebAppContext().setAttribute(OzoneConsts.SCM_CONTEXT_ATTRIBUTE, scm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.net.InetSocketAddress;

import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_FLUSH;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_HTTP_ENDPOINT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_RATIS_PORT_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_RATIS_PORT_KEY;
Expand Down Expand Up @@ -153,13 +153,13 @@ public String getOMDBCheckpointEnpointUrl(boolean isHttpPolicy) {
if (isHttpPolicy) {
if (StringUtils.isNotEmpty(getHttpAddress())) {
return "http://" + getHttpAddress() +
OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT +
OZONE_DB_CHECKPOINT_HTTP_ENDPOINT +
"?" + OZONE_DB_CHECKPOINT_REQUEST_FLUSH + "=true";
}
} else {
if (StringUtils.isNotEmpty(getHttpsAddress())) {
return "https://" + getHttpsAddress() +
OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT +
OZONE_DB_CHECKPOINT_HTTP_ENDPOINT +
"?" + OZONE_DB_CHECKPOINT_REQUEST_FLUSH + "=true";
}
}
Expand Down
1 change: 1 addition & 0 deletions hadoop-ozone/dist/src/main/compose/ozone-csi/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OZONE-SITE.XML_ozone.csi.socket=/tmp/csi.sock

OZONE-SITE.XML_ozone.om.address=om
OZONE-SITE.XML_ozone.om.http-address=om:9874
OZONE-SITE.XML_ozone.scm.http-address=scm:9876
OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.datanode.ratis.volume.free-space.min=10MB
OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
Expand Down
4 changes: 4 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone-ha/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ OZONE-SITE.XML_ozone.datanode.pipeline.limit=1
OZONE-SITE.XML_hdds.scmclient.max.retry.timeout=30s
OZONE-SITE.XML_ozone.scm.primordial.node.id=scm1
OZONE-SITE.XML_hdds.container.report.interval=60s
OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon
OZONE-SITE.XML_ozone.recon.address=recon:9891
OZONE-SITE.XML_ozone.recon.http-address=0.0.0.0:9888
OZONE-SITE.XML_ozone.recon.https-address=0.0.0.0:9889

OZONE_CONF_DIR=/etc/hadoop
OZONE_LOG_DIR=/var/log/hadoop
Expand Down
1 change: 1 addition & 0 deletions hadoop-ozone/dist/src/main/compose/ozone/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CORE-SITE.XML_fs.trash.interval=1

OZONE-SITE.XML_ozone.om.address=om
OZONE-SITE.XML_ozone.om.http-address=om:9874
OZONE-SITE.XML_ozone.scm.http-address=scm:9876
OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.datanode.ratis.volume.free-space.min=10MB
OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

OZONE-SITE.XML_ozone.om.address=om
OZONE-SITE.XML_ozone.om.http-address=om:9874
OZONE-SITE.XML_ozone.scm.http-address=scm:9876
OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.datanode.ratis.volume.free-space.min=10MB
OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CORE-SITE.XML_fs.trash.interval=1

OZONE-SITE.XML_ozone.om.address=om
OZONE-SITE.XML_ozone.om.http-address=om:9874
OZONE-SITE.XML_ozone.scm.http-address=scm:9876
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
Expand Down
Loading