From ad89743b4baf544fef25b725a3dec493bb1785c0 Mon Sep 17 00:00:00 2001 From: HuangTao Date: Sat, 27 Jun 2020 23:48:20 +0800 Subject: [PATCH 1/7] HDDS-3798. Collect more info about DN in recon web --- .../hadoop/hdds/protocol/DatanodeDetails.java | 90 ++++++++++++++++++- .../hadoop/ozone/HddsDatanodeService.java | 5 ++ .../src/main/proto/hdds.proto | 2 + .../src/main/proto/proto.lock | 10 +++ .../hadoop/ozone/recon/api/NodeEndpoint.java | 2 + .../recon/api/types/DatanodeMetadata.java | 28 ++++++ .../src/views/datanodes/datanodes.tsx | 20 ++++- 7 files changed, 154 insertions(+), 3 deletions(-) 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 7fa77654ee7b..dd568fd4708b 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 @@ -49,6 +49,8 @@ public class DatanodeDetails extends NodeImpl implements private String hostName; private List ports; private String certSerialId; + private String version; + private String setupTime; /** * Constructs DatanodeDetails instance. DatanodeDetails.Builder is used @@ -59,15 +61,20 @@ public class DatanodeDetails extends NodeImpl implements * @param networkLocation DataNode's network location path * @param ports Ports used by the DataNode * @param certSerialId serial id from SCM issued certificate. + * @param version DataNode's version + * @param setupTime the setup time of DataNode */ private DatanodeDetails(UUID uuid, String ipAddress, String hostName, - String networkLocation, List ports, String certSerialId) { + String networkLocation, List ports, String certSerialId, + String version, String setupTime) { super(hostName, networkLocation, NetConstants.NODE_COST_DEFAULT); this.uuid = uuid; this.ipAddress = ipAddress; this.hostName = hostName; this.ports = ports; this.certSerialId = certSerialId; + this.version = version; + this.setupTime = setupTime; } public DatanodeDetails(DatanodeDetails datanodeDetails) { @@ -78,6 +85,8 @@ public DatanodeDetails(DatanodeDetails datanodeDetails) { this.hostName = datanodeDetails.hostName; this.ports = datanodeDetails.ports; this.setNetworkName(datanodeDetails.getNetworkName()); + this.version = datanodeDetails.version; + this.setupTime = datanodeDetails.setupTime; } /** @@ -206,6 +215,12 @@ public static DatanodeDetails getFromProtoBuf( if (datanodeDetailsProto.hasNetworkLocation()) { builder.setNetworkLocation(datanodeDetailsProto.getNetworkLocation()); } + if (datanodeDetailsProto.hasVersion()) { + builder.setVersion(datanodeDetailsProto.getVersion()); + } + if (datanodeDetailsProto.hasSetupTime()) { + builder.setSetupTime(datanodeDetailsProto.getSetupTime()); + } return builder.build(); } @@ -247,6 +262,15 @@ public HddsProtos.DatanodeDetailsProto getProtoBufMessage() { .setValue(port.getValue()) .build()); } + + if (!Strings.isNullOrEmpty(getVersion())) { + builder.setVersion(getVersion()); + } + + if (!Strings.isNullOrEmpty(getSetupTime())) { + builder.setSetupTime(getSetupTime()); + } + return builder.build(); } @@ -299,6 +323,8 @@ public static final class Builder { private String networkLocation; private List ports; private String certSerialId; + private String version; + private String setupTime; /** * Default private constructor. To create Builder instance use @@ -387,6 +413,30 @@ public Builder setCertSerialId(String certId) { return this; } + /** + * Sets the DataNode version. + * + * @param version the version of DataNode. + * + * @return DatanodeDetails.Builder + */ + public Builder setVersion(String version) { + this.version = version; + return this; + } + + /** + * Sets the DataNode setup time. + * + * @param setupTime the setupt time of DataNode. + * + * @return DatanodeDetails.Builder + */ + public Builder setSetupTime(String setupTime) { + this.setupTime = setupTime; + return this; + } + /** * Builds and returns DatanodeDetails instance. * @@ -398,7 +448,7 @@ public DatanodeDetails build() { networkLocation = NetConstants.DEFAULT_RACK; } DatanodeDetails dn = new DatanodeDetails(id, ipAddress, hostName, - networkLocation, ports, certSerialId); + networkLocation, ports, certSerialId, version, setupTime); if (networkName != null) { dn.setNetworkName(networkName); } @@ -504,4 +554,40 @@ public String getCertSerialId() { public void setCertSerialId(String certSerialId) { this.certSerialId = certSerialId; } + + /** + * Returns the DataNode version. + * + * @return DataNode version + */ + public String getVersion() { + return version; + } + + /** + * Set DataNode version. + * + * @param version DataNode version + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * Returns the DataNode setup time. + * + * @return DataNode setup time + */ + public String getSetupTime() { + return setupTime; + } + + /** + * Set DataNode setup time. + * + * @param setupTime DataNode setup time + */ + public void setSetupTime(String setupTime) { + this.setupTime = setupTime; + } } 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 7e896e715598..1f40249c036e 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 @@ -23,6 +23,7 @@ import java.security.KeyPair; import java.security.cert.CertificateException; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; @@ -191,6 +192,10 @@ public void start() { datanodeDetails = initializeDatanodeDetails(); datanodeDetails.setHostName(hostname); datanodeDetails.setIpAddress(ip); + datanodeDetails.setVersion( + HddsVersionInfo.HDDS_VERSION_INFO.getVersion()); + datanodeDetails.setSetupTime( + new Date(System.currentTimeMillis()).toString()); TracingUtil.initTracing( "HddsDatanodeService." + datanodeDetails.getUuidString() .substring(0, 8), conf); diff --git a/hadoop-hdds/interface-client/src/main/proto/hdds.proto b/hadoop-hdds/interface-client/src/main/proto/hdds.proto index 23cc9cbf6ced..cbbafe06350a 100644 --- a/hadoop-hdds/interface-client/src/main/proto/hdds.proto +++ b/hadoop-hdds/interface-client/src/main/proto/hdds.proto @@ -43,6 +43,8 @@ message DatanodeDetailsProto { // network name, can be Ip address or host name, depends optional string networkName = 6; optional string networkLocation = 7; // Network topology location + optional string version = 8; // Datanode version + optional string setupTime = 9; // TODO(runzhiwang): when uuid is gone, specify 1 as the index of uuid128 and mark as required optional UUID uuid128 = 100; // UUID with 128 bits assigned to the Datanode. } diff --git a/hadoop-hdds/interface-client/src/main/proto/proto.lock b/hadoop-hdds/interface-client/src/main/proto/proto.lock index 1be06ae0fe22..52ffa4dfae8e 100644 --- a/hadoop-hdds/interface-client/src/main/proto/proto.lock +++ b/hadoop-hdds/interface-client/src/main/proto/proto.lock @@ -1514,6 +1514,16 @@ "id": 7, "name": "networkLocation", "type": "string" + }, + { + "id": 8, + "name": "version", + "type": "string" + }, + { + "id": 9, + "name": "setupTime", + "type": "string" } ] }, diff --git a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java index 2c017491f59d..42832debfee1 100644 --- a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java +++ b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java @@ -121,6 +121,8 @@ public Response getDatanodes() { .withPipelines(pipelines) .withLeaderCount(leaderCount.get()) .withUUid(datanode.getUuidString()) + .withVersion(datanode.getVersion()) + .withSetupTime(datanode.getSetupTime()) .build()); }); diff --git a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java index 02d9ae811829..89d1a5d9e33a 100644 --- a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java +++ b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java @@ -55,6 +55,12 @@ public final class DatanodeMetadata { @XmlElement(name = "leaderCount") private int leaderCount; + @XmlElement(name = "version") + private String version; + + @XmlElement(name = "setupTime") + private String setupTime; + private DatanodeMetadata(Builder builder) { this.hostname = builder.hostname; this.uuid = builder.uuid; @@ -64,6 +70,8 @@ private DatanodeMetadata(Builder builder) { this.pipelines = builder.pipelines; this.containers = builder.containers; this.leaderCount = builder.leaderCount; + this.version = builder.version; + this.setupTime = builder.setupTime; } public String getHostname() { @@ -98,6 +106,14 @@ public String getUuid() { return uuid; } + public String getVersion() { + return version; + } + + public String getSetupTime() { + return setupTime; + } + /** * Returns new builder class that builds a DatanodeMetadata. * @@ -120,6 +136,8 @@ public static final class Builder { private List pipelines; private int containers; private int leaderCount; + private String version; + private String setupTime; public Builder() { this.containers = 0; @@ -167,6 +185,16 @@ public Builder withUUid(String uuid) { return this; } + public Builder withVersion(String version) { + this.version = version; + return this; + } + + public Builder withSetupTime(String setupTime) { + this.setupTime = setupTime; + return this; + } + /** * Constructs DatanodeMetadata. * diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx index bfba82a5bebb..623b8535beaa 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx @@ -38,6 +38,8 @@ interface IDatanodeResponse { containers: number; leaderCount: number; uuid: string; + version: string; + setupTime: string; } interface IDatanodesResponse { @@ -56,6 +58,8 @@ interface IDatanode { containers: number; leaderCount: number; uuid: string; + version: string; + setupTime: string; } interface IPipeline { @@ -165,6 +169,18 @@ const COLUMNS = [ dataIndex: 'containers', key: 'containers', sorter: (a: IDatanode, b: IDatanode) => a.containers - b.containers + }, + { + title: 'Version', + dataIndex: 'version', + key: 'version', + sorter: (a: IDatanode, b: IDatanode) => a.version - b.version + }, + { + title: 'SetupTime', + dataIndex: 'setupTime', + key: 'setupTime', + sorter: (a: IDatanode, b: IDatanode) => a.setupTime - b.setupTime } ]; @@ -201,7 +217,9 @@ export class Datanodes extends React.Component, IDatanode storageRemaining: datanode.storageReport.remaining, pipelines: datanode.pipelines, containers: datanode.containers, - leaderCount: datanode.leaderCount + leaderCount: datanode.leaderCount, + version: datanode.version, + setupTime: datanode.setupTime }; }); this.setState({ From 40b0e065a3fd9ef21ae6a3d1122d7160903836c4 Mon Sep 17 00:00:00 2001 From: HuangTao Date: Sun, 28 Jun 2020 11:02:50 +0800 Subject: [PATCH 2/7] HDDS-3798. fix checkstyle and the zone of setup time --- .../hadoop/hdds/protocol/DatanodeDetails.java | 29 +++++++++---------- .../hadoop/ozone/HddsDatanodeService.java | 6 ++-- .../src/main/proto/proto.lock | 2 +- .../recon/api/types/DatanodeMetadata.java | 8 ++--- .../src/views/datanodes/datanodes.tsx | 7 +++-- 5 files changed, 27 insertions(+), 25 deletions(-) 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 dd568fd4708b..343d8c4375d4 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 @@ -50,7 +50,7 @@ public class DatanodeDetails extends NodeImpl implements private List ports; private String certSerialId; private String version; - private String setupTime; + private long setupTime; /** * Constructs DatanodeDetails instance. DatanodeDetails.Builder is used @@ -64,9 +64,10 @@ public class DatanodeDetails extends NodeImpl implements * @param version DataNode's version * @param setupTime the setup time of DataNode */ - private DatanodeDetails(UUID uuid, String ipAddress, String hostName, + @SuppressWarnings("parameternumber") + private DatanodeDetails(String uuid, String ipAddress, String hostName, String networkLocation, List ports, String certSerialId, - String version, String setupTime) { + String version, long setupTime) { super(hostName, networkLocation, NetConstants.NODE_COST_DEFAULT); this.uuid = uuid; this.ipAddress = ipAddress; @@ -267,9 +268,7 @@ public HddsProtos.DatanodeDetailsProto getProtoBufMessage() { builder.setVersion(getVersion()); } - if (!Strings.isNullOrEmpty(getSetupTime())) { - builder.setSetupTime(getSetupTime()); - } + builder.setSetupTime(getSetupTime()); return builder.build(); } @@ -324,7 +323,7 @@ public static final class Builder { private List ports; private String certSerialId; private String version; - private String setupTime; + private long setupTime; /** * Default private constructor. To create Builder instance use @@ -416,24 +415,24 @@ public Builder setCertSerialId(String certId) { /** * Sets the DataNode version. * - * @param version the version of DataNode. + * @param ver the version of DataNode. * * @return DatanodeDetails.Builder */ - public Builder setVersion(String version) { - this.version = version; + public Builder setVersion(String ver) { + this.version = ver; return this; } /** * Sets the DataNode setup time. * - * @param setupTime the setupt time of DataNode. + * @param time the setup time of DataNode. * * @return DatanodeDetails.Builder */ - public Builder setSetupTime(String setupTime) { - this.setupTime = setupTime; + public Builder setSetupTime(long time) { + this.setupTime = time; return this; } @@ -578,7 +577,7 @@ public void setVersion(String version) { * * @return DataNode setup time */ - public String getSetupTime() { + public long getSetupTime() { return setupTime; } @@ -587,7 +586,7 @@ public String getSetupTime() { * * @param setupTime DataNode setup time */ - public void setSetupTime(String setupTime) { + public void setSetupTime(long setupTime) { this.setupTime = setupTime; } } 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 1f40249c036e..08eef6f88eac 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 @@ -23,7 +23,6 @@ import java.security.KeyPair; import java.security.cert.CertificateException; import java.util.Arrays; -import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; @@ -66,6 +65,8 @@ import static org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.getEncodedString; import static org.apache.hadoop.ozone.OzoneConfigKeys.HDDS_DATANODE_PLUGINS_KEY; import static org.apache.hadoop.util.ExitUtil.terminate; + +import org.apache.hadoop.util.Time; import org.bouncycastle.pkcs.PKCS10CertificationRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -194,8 +195,7 @@ public void start() { datanodeDetails.setIpAddress(ip); datanodeDetails.setVersion( HddsVersionInfo.HDDS_VERSION_INFO.getVersion()); - datanodeDetails.setSetupTime( - new Date(System.currentTimeMillis()).toString()); + datanodeDetails.setSetupTime(Time.now()); TracingUtil.initTracing( "HddsDatanodeService." + datanodeDetails.getUuidString() .substring(0, 8), conf); diff --git a/hadoop-hdds/interface-client/src/main/proto/proto.lock b/hadoop-hdds/interface-client/src/main/proto/proto.lock index 52ffa4dfae8e..4eb5459d7295 100644 --- a/hadoop-hdds/interface-client/src/main/proto/proto.lock +++ b/hadoop-hdds/interface-client/src/main/proto/proto.lock @@ -1523,7 +1523,7 @@ { "id": 9, "name": "setupTime", - "type": "string" + "type": "int64" } ] }, diff --git a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java index 89d1a5d9e33a..542654e96e2e 100644 --- a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java +++ b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DatanodeMetadata.java @@ -59,7 +59,7 @@ public final class DatanodeMetadata { private String version; @XmlElement(name = "setupTime") - private String setupTime; + private long setupTime; private DatanodeMetadata(Builder builder) { this.hostname = builder.hostname; @@ -110,7 +110,7 @@ public String getVersion() { return version; } - public String getSetupTime() { + public long getSetupTime() { return setupTime; } @@ -137,7 +137,7 @@ public static final class Builder { private int containers; private int leaderCount; private String version; - private String setupTime; + private long setupTime; public Builder() { this.containers = 0; @@ -190,7 +190,7 @@ public Builder withVersion(String version) { return this; } - public Builder withSetupTime(String setupTime) { + public Builder withSetupTime(long setupTime) { this.setupTime = setupTime; return this; } diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx index 623b8535beaa..b4e3f548caa5 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx @@ -59,7 +59,7 @@ interface IDatanode { leaderCount: number; uuid: string; version: string; - setupTime: string; + setupTime: number; } interface IPipeline { @@ -180,7 +180,10 @@ const COLUMNS = [ title: 'SetupTime', dataIndex: 'setupTime', key: 'setupTime', - sorter: (a: IDatanode, b: IDatanode) => a.setupTime - b.setupTime + sorter: (a: IDatanode, b: IDatanode) => a.setupTime - b.setupTime, + render:(uptime: number) => { + return uptime > 0 ? moment(uptime).format('lll') : 'NA'; + } } ]; From 6b8d1a4187309a3ccc3cf703bd8fbf8b29f29466 Mon Sep 17 00:00:00 2001 From: HuangTao Date: Sun, 5 Jul 2020 15:54:57 +0800 Subject: [PATCH 3/7] HDDS-3798. add a multi-select dropdown to hide/show some columns --- .gitignore | 2 + .../hadoop/hdds/protocol/DatanodeDetails.java | 2 +- .../src/main/proto/hdds.proto | 2 +- .../src/main/proto/proto.lock | 30 +++++++ .../webapps/recon/ozone-recon-web/api/db.json | 48 +++++++--- .../components/multiSelect/multiSelect.tsx | 5 +- .../src/views/datanodes/datanodes.less | 14 +++ .../src/views/datanodes/datanodes.tsx | 89 ++++++++++++++++--- 8 files changed, 166 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 551b1b5361ce..e09c2eb819c0 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ .classpath .project .settings +*.factorypath target build dependency-reduced-pom.xml @@ -61,5 +62,6 @@ output.xml report.html hadoop-hdds/docs/public +hadoop-ozone/recon/node_modules .mvn 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 343d8c4375d4..8db1ab0fa2c2 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 @@ -65,7 +65,7 @@ public class DatanodeDetails extends NodeImpl implements * @param setupTime the setup time of DataNode */ @SuppressWarnings("parameternumber") - private DatanodeDetails(String uuid, String ipAddress, String hostName, + private DatanodeDetails(UUID uuid, String ipAddress, String hostName, String networkLocation, List ports, String certSerialId, String version, long setupTime) { super(hostName, networkLocation, NetConstants.NODE_COST_DEFAULT); diff --git a/hadoop-hdds/interface-client/src/main/proto/hdds.proto b/hadoop-hdds/interface-client/src/main/proto/hdds.proto index cbbafe06350a..243e8ecaced7 100644 --- a/hadoop-hdds/interface-client/src/main/proto/hdds.proto +++ b/hadoop-hdds/interface-client/src/main/proto/hdds.proto @@ -44,7 +44,7 @@ message DatanodeDetailsProto { optional string networkName = 6; optional string networkLocation = 7; // Network topology location optional string version = 8; // Datanode version - optional string setupTime = 9; + optional int64 setupTime = 9; // TODO(runzhiwang): when uuid is gone, specify 1 as the index of uuid128 and mark as required optional UUID uuid128 = 100; // UUID with 128 bits assigned to the Datanode. } diff --git a/hadoop-hdds/interface-client/src/main/proto/proto.lock b/hadoop-hdds/interface-client/src/main/proto/proto.lock index 4eb5459d7295..5ba0625f33fb 100644 --- a/hadoop-hdds/interface-client/src/main/proto/proto.lock +++ b/hadoop-hdds/interface-client/src/main/proto/proto.lock @@ -1476,6 +1476,21 @@ } ], "messages": [ + { + "name": "UUID", + "fields": [ + { + "id": 1, + "name": "mostSigBits", + "type": "int64" + }, + { + "id": 2, + "name": "leastSigBits", + "type": "int64" + } + ] + }, { "name": "DatanodeDetailsProto", "fields": [ @@ -1524,6 +1539,11 @@ "id": 9, "name": "setupTime", "type": "int64" + }, + { + "id": 100, + "name": "uuid128", + "type": "UUID" } ] }, @@ -1575,6 +1595,11 @@ "id": 1, "name": "id", "type": "string" + }, + { + "id": 100, + "name": "uuid128", + "type": "UUID" } ] }, @@ -1640,6 +1665,11 @@ "id": 8, "name": "creationTimeStamp", "type": "uint64" + }, + { + "id": 100, + "name": "leaderID128", + "type": "UUID" } ] }, diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json index 82fae3735b12..d8d6eac55a9f 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json @@ -41,7 +41,9 @@ } ], "containers": 80, - "leaderCount": 2 + "leaderCount": 2, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574728775759 }, { "hostname": "localhost2.storage.enterprise.com", @@ -68,7 +70,9 @@ } ], "containers": 8192, - "leaderCount": 1 + "leaderCount": 1, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724805059 }, { "hostname": "localhost3.storage.enterprise.com", @@ -101,7 +105,9 @@ } ], "containers": 43, - "leaderCount": 2 + "leaderCount": 2, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1343544679543 }, { "hostname": "localhost4.storage.enterprise.com", @@ -115,7 +121,9 @@ }, "pipelines": [], "containers": 0, - "leaderCount": 0 + "leaderCount": 0, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1074724802059 }, { "hostname": "localhost5.storage.enterprise.com", @@ -142,7 +150,9 @@ } ], "containers": 643, - "leaderCount": 2 + "leaderCount": 2, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724816029 }, { "hostname": "localhost6.storage.enterprise.com", @@ -169,7 +179,9 @@ } ], "containers": 5, - "leaderCount": 1 + "leaderCount": 1, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724802059 }, { "hostname": "localhost7.storage.enterprise.com", @@ -202,7 +214,9 @@ } ], "containers": 64, - "leaderCount": 2 + "leaderCount": 2, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724676009 }, { "hostname": "localhost8.storage.enterprise.com", @@ -229,7 +243,9 @@ } ], "containers": 21, - "leaderCount": 1 + "leaderCount": 1, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724276050 }, { "hostname": "localhost9.storage.enterprise.com", @@ -256,7 +272,9 @@ } ], "containers": 897, - "leaderCount": 1 + "leaderCount": 1, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724573011 }, { "hostname": "localhost10.storage.enterprise.com", @@ -289,7 +307,9 @@ } ], "containers": 6754, - "leaderCount": 2 + "leaderCount": 2, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574723756059 }, { "hostname": "localhost11.storage.enterprise.com", @@ -316,7 +336,9 @@ } ], "containers": 78, - "leaderCount": 2 + "leaderCount": 2, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1474724705783 }, { "hostname": "localhost12.storage.enterprise.com", @@ -343,7 +365,9 @@ } ], "containers": 543, - "leaderCount": 1 + "leaderCount": 1, + "version": "0.6.0-SNAPSHOT", + "setupTime": 1574724706232 } ] }, diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/components/multiSelect/multiSelect.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/components/multiSelect/multiSelect.tsx index 19005dddd11e..417c2efdcb7a 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/components/multiSelect/multiSelect.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/components/multiSelect/multiSelect.tsx @@ -36,6 +36,7 @@ interface IMultiSelectProps extends ReactSelectProps { options: IOption[]; allowSelectAll: boolean; allOption?: IOption; + maxShowValues?: number; } const defaultProps = { @@ -48,7 +49,7 @@ const defaultProps = { export class MultiSelect extends PureComponent { static defaultProps = defaultProps; render() { - const {allowSelectAll, allOption, options, onChange} = this.props; + const {allowSelectAll, allOption, options, maxShowValues = 5, onChange} = this.props; if (allowSelectAll) { const Option = (props: OptionProps) => { return ( @@ -70,7 +71,7 @@ export class MultiSelect extends PureComponent { let toBeRendered = children; if (currentValues.some(val => val.value === allOption!.value) && children) { toBeRendered = allOption!.label; - } else if (currentValues.length >= 5) { + } else if (currentValues.length > maxShowValues) { toBeRendered = `${currentValues.length} selected`; } diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.less b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.less index 4a3cdf5accc9..10ec907a7334 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.less +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.less @@ -22,4 +22,18 @@ margin-bottom: 5px; } } + + .filter-block { + font-size: 14px; + font-weight: normal; + display: inline-block; + margin-left: 20px; + } + + .multi-select-container { + padding-left: 5px; + margin-right: 5px; + display: inline-block; + min-width: 200px; + } } diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx index b4e3f548caa5..9c5838602a1e 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx @@ -27,6 +27,8 @@ import {DatanodeStatus, IStorageReport} from 'types/datanode.types'; import './datanodes.less'; import {AutoReloadHelper} from 'utils/autoReloadHelper'; import AutoReloadPanel from 'components/autoReloadPanel/autoReloadPanel'; +import {MultiSelect, IOption} from 'components/multiSelect/multiSelect'; +import {ActionMeta, ValueType} from 'react-select'; import {showDataFetchError} from 'utils/common'; interface IDatanodeResponse { @@ -39,7 +41,7 @@ interface IDatanodeResponse { leaderCount: number; uuid: string; version: string; - setupTime: string; + setupTime: number; } interface IDatanodesResponse { @@ -74,6 +76,8 @@ interface IDatanodesState { dataSource: IDatanode[]; totalCount: number; lastUpdated: number; + selectedColumns: IOption[]; + columnOptions: IOption[]; } const renderDatanodeStatus = (status: DatanodeStatus) => { @@ -93,6 +97,7 @@ const COLUMNS = [ title: 'Status', dataIndex: 'state', key: 'state', + isVisible: true, render: (text: DatanodeStatus) => renderDatanodeStatus(text), sorter: (a: IDatanode, b: IDatanode) => a.state.localeCompare(b.state) }, @@ -100,6 +105,7 @@ const COLUMNS = [ title: 'Uuid', dataIndex: 'uuid', key: 'uuid', + isVisible: true, sorter: (a: IDatanode, b: IDatanode) => a.uuid.localeCompare(b.uuid), defaultSortOrder: 'ascend' as const }, @@ -107,6 +113,7 @@ const COLUMNS = [ title: 'Hostname', dataIndex: 'hostname', key: 'hostname', + isVisible: true, sorter: (a: IDatanode, b: IDatanode) => a.hostname.localeCompare(b.hostname), defaultSortOrder: 'ascend' as const }, @@ -114,6 +121,7 @@ const COLUMNS = [ title: 'Storage Capacity', dataIndex: 'storageUsed', key: 'storageUsed', + isVisible: true, sorter: (a: IDatanode, b: IDatanode) => a.storageRemaining - b.storageRemaining, render: (text: string, record: IDatanode) => ( a.lastHeartbeat - b.lastHeartbeat, render: (heartbeat: number) => { return heartbeat > 0 ? moment(heartbeat).format('lll') : 'NA'; @@ -133,6 +142,7 @@ const COLUMNS = [ title: 'Pipeline ID(s)', dataIndex: 'pipelines', key: 'pipelines', + isVisible: true, render: (pipelines: IPipeline[], record: IDatanode) => { return (
@@ -162,24 +172,29 @@ const COLUMNS = [ , dataIndex: 'leaderCount', key: 'leaderCount', + isVisible: true, sorter: (a: IDatanode, b: IDatanode) => a.leaderCount - b.leaderCount }, { title: 'Containers', dataIndex: 'containers', key: 'containers', + isVisible: true, sorter: (a: IDatanode, b: IDatanode) => a.containers - b.containers }, { title: 'Version', dataIndex: 'version', key: 'version', - sorter: (a: IDatanode, b: IDatanode) => a.version - b.version + isVisible: false, + sorter: (a: IDatanode, b: IDatanode) => a.version.localeCompare(b.version), + defaultSortOrder: 'ascend' as const }, { title: 'SetupTime', dataIndex: 'setupTime', key: 'setupTime', + isVisible: false, sorter: (a: IDatanode, b: IDatanode) => a.setupTime - b.setupTime, render:(uptime: number) => { return uptime > 0 ? moment(uptime).format('lll') : 'NA'; @@ -187,6 +202,16 @@ const COLUMNS = [ } ]; +const allColumnsOption: IOption = { + label: 'All', + value: '*' +}; + +const defaultColumns: IOption[] = COLUMNS.map(column => ({ + label: column.key, + value: column.key +})); + export class Datanodes extends React.Component, IDatanodesState> { autoReload: AutoReloadHelper; @@ -196,11 +221,20 @@ export class Datanodes extends React.Component, IDatanode loading: false, dataSource: [], totalCount: 0, - lastUpdated: 0 + lastUpdated: 0, + selectedColumns: [], + columnOptions: defaultColumns, }; this.autoReload = new AutoReloadHelper(this._loadData); } + _handleColumnChange = (selected: ValueType, _action: ActionMeta) => { + const selectedColumns = (selected as IOption[]); + this.setState({ + selectedColumns + }); + }; + _loadData = () => { this.setState({ loading: true @@ -225,11 +259,18 @@ export class Datanodes extends React.Component, IDatanode setupTime: datanode.setupTime }; }); + const selectedColumns: IOption[] = COLUMNS.filter(column => column.isVisible).map(column => ({ + label: column.key, + value: column.key + })) + this.setState({ loading: false, dataSource, totalCount, - lastUpdated: Number(moment()) + lastUpdated: Number(moment()), + }, () => { + this._handleColumnChange(selectedColumns, {action: 'select-option'}); }); }).catch(error => { this.setState({ @@ -254,20 +295,48 @@ export class Datanodes extends React.Component, IDatanode }; render() { - const {dataSource, loading, totalCount, lastUpdated} = this.state; + const {dataSource, loading, totalCount, lastUpdated, selectedColumns, columnOptions} = this.state; const paginationConfig: PaginationConfig = { showTotal: (total: number, range) => `${range[0]}-${range[1]} of ${total} datanodes`, showSizeChanger: true, onShowSizeChange: this.onShowSizeChange }; return ( -
-
+
+
Datanodes ({totalCount}) - +
+ Columns +
+
-
- + +
+
+ selectedColumns.some((e) => e.label === column.key) + )} + loading={loading} + pagination={paginationConfig} + rowKey="hostname" + /> ); From 354d4c27d7cb32eea3068381cf478afe352e73ab Mon Sep 17 00:00:00 2001 From: HuangTao Date: Sun, 5 Jul 2020 16:02:24 +0800 Subject: [PATCH 4/7] HDDS-3798. fix conflict --- hadoop-hdds/interface-client/src/main/proto/proto.lock | 2 +- .../recon/ozone-recon-web/src/views/datanodes/datanodes.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdds/interface-client/src/main/proto/proto.lock b/hadoop-hdds/interface-client/src/main/proto/proto.lock index 5ba0625f33fb..b27896c655e3 100644 --- a/hadoop-hdds/interface-client/src/main/proto/proto.lock +++ b/hadoop-hdds/interface-client/src/main/proto/proto.lock @@ -1935,4 +1935,4 @@ } } ] -} \ No newline at end of file +} diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx index 9c5838602a1e..1ab82fa0a215 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx @@ -203,7 +203,7 @@ const COLUMNS = [ ]; const allColumnsOption: IOption = { - label: 'All', + label: 'Select all', value: '*' }; From 18a90ce06a59478960186985b884f11de1e6428b Mon Sep 17 00:00:00 2001 From: HuangTao Date: Sun, 5 Jul 2020 22:26:51 +0800 Subject: [PATCH 5/7] HDDS-3798. revert some unrelated fields --- .../src/main/proto/proto.lock | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/hadoop-hdds/interface-client/src/main/proto/proto.lock b/hadoop-hdds/interface-client/src/main/proto/proto.lock index b27896c655e3..da82ffc600f4 100644 --- a/hadoop-hdds/interface-client/src/main/proto/proto.lock +++ b/hadoop-hdds/interface-client/src/main/proto/proto.lock @@ -1476,21 +1476,6 @@ } ], "messages": [ - { - "name": "UUID", - "fields": [ - { - "id": 1, - "name": "mostSigBits", - "type": "int64" - }, - { - "id": 2, - "name": "leastSigBits", - "type": "int64" - } - ] - }, { "name": "DatanodeDetailsProto", "fields": [ @@ -1539,11 +1524,6 @@ "id": 9, "name": "setupTime", "type": "int64" - }, - { - "id": 100, - "name": "uuid128", - "type": "UUID" } ] }, @@ -1595,11 +1575,6 @@ "id": 1, "name": "id", "type": "string" - }, - { - "id": 100, - "name": "uuid128", - "type": "UUID" } ] }, @@ -1665,11 +1640,6 @@ "id": 8, "name": "creationTimeStamp", "type": "uint64" - }, - { - "id": 100, - "name": "leaderID128", - "type": "UUID" } ] }, From 3be240ca336c84c67d46ef83d6e6b7489ef40525 Mon Sep 17 00:00:00 2001 From: HuangTao Date: Mon, 6 Jul 2020 10:12:22 +0800 Subject: [PATCH 6/7] HDDS-3798. fix lint errors --- .../src/views/datanodes/datanodes.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx index 1ab82fa0a215..877ebf9f2c75 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/datanodes.tsx @@ -196,7 +196,7 @@ const COLUMNS = [ key: 'setupTime', isVisible: false, sorter: (a: IDatanode, b: IDatanode) => a.setupTime - b.setupTime, - render:(uptime: number) => { + render: (uptime: number) => { return uptime > 0 ? moment(uptime).format('lll') : 'NA'; } } @@ -223,7 +223,7 @@ export class Datanodes extends React.Component, IDatanode totalCount: 0, lastUpdated: 0, selectedColumns: [], - columnOptions: defaultColumns, + columnOptions: defaultColumns }; this.autoReload = new AutoReloadHelper(this._loadData); } @@ -262,13 +262,13 @@ export class Datanodes extends React.Component, IDatanode const selectedColumns: IOption[] = COLUMNS.filter(column => column.isVisible).map(column => ({ label: column.key, value: column.key - })) - + })); + this.setState({ loading: false, dataSource, totalCount, - lastUpdated: Number(moment()), + lastUpdated: Number(moment()) }, () => { this._handleColumnChange(selectedColumns, {action: 'select-option'}); }); @@ -302,15 +302,15 @@ export class Datanodes extends React.Component, IDatanode onShowSizeChange: this.onShowSizeChange }; return ( -
-
+
+
Datanodes ({totalCount}) -
+
, IDatanode />
-
+
- selectedColumns.some((e) => e.label === column.key) + columns={COLUMNS.filter(column => + selectedColumns.some(e => e.value === column.key) )} loading={loading} pagination={paginationConfig} - rowKey="hostname" + rowKey='hostname' /> From 006ed2d0f9f809b246f01bda5721f07914c5e6e8 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Thu, 9 Jul 2020 12:32:02 +0200 Subject: [PATCH 7/7] trigger new CI check