This is an automated email from the ASF dual-hosted git repository.
pifta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 5f0925e190 HDDS-10249 Remove unused, dead code in hdds-common module.
(#6136)
5f0925e190 is described below
commit 5f0925e190f1dbf2d4617daad8ad42401d5079e1
Author: Istvan Fajth <[email protected]>
AuthorDate: Thu Feb 1 09:46:28 2024 +0100
HDDS-10249 Remove unused, dead code in hdds-common module. (#6136)
---
.../java/org/apache/hadoop/hdds/HddsIdFactory.java | 10 -
.../java/org/apache/hadoop/hdds/HddsUtils.java | 35 ---
.../java/org/apache/hadoop/hdds/NodeDetails.java | 9 -
.../org/apache/hadoop/hdds/client/OzoneQuota.java | 14 -
.../hadoop/hdds/conf/OzoneConfiguration.java | 10 -
.../hadoop/hdds/freon/FakeClusterTopology.java | 4 +-
.../apache/hadoop/hdds/function/Predicates.java | 47 ----
.../apache/hadoop/hdds/function/package-info.java | 22 --
.../hadoop/hdds/protocol/DatanodeDetails.java | 9 -
.../hdds/ratis/ServerNotLeaderException.java | 5 -
.../apache/hadoop/hdds/scm/RemoveSCMRequest.java | 49 ----
.../scm/container/ReplicationManagerReport.java | 9 -
.../org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java | 4 -
.../apache/hadoop/hdds/scm/net/NetConstants.java | 1 -
.../org/apache/hadoop/hdds/scm/net/NetUtils.java | 4 -
.../protocol/StorageContainerLocationProtocol.java | 3 +-
.../ContainerCommandResponseBuilders.java | 11 -
.../security/ssl/PemFileBasedKeyStoresFactory.java | 4 +-
.../security/token/OzoneBlockTokenIdentifier.java | 13 -
.../security/token/OzoneBlockTokenSelector.java | 21 --
.../x509/certificate/client/CertificateClient.java | 43 ----
.../certificate/utils/SelfSignedCertificate.java | 9 -
.../x509/exception/CertificateException.java | 1 -
.../org/apache/hadoop/hdds/server/JsonUtils.java | 17 --
.../org/apache/hadoop/hdds/server/ServerUtils.java | 12 -
.../hadoop/hdds/tracing/GrpcServerInterceptor.java | 2 +-
.../apache/hadoop/hdds/tracing/TracingUtil.java | 19 --
.../org/apache/hadoop/hdds/utils/db/Codec.java | 8 -
.../apache/hadoop/hdds/utils/db/CodecBuffer.java | 11 -
.../hadoop/hdds/utils/db/StringCodecBase.java | 3 +-
.../java/org/apache/hadoop/ozone/OzoneConsts.java | 11 -
.../apache/hadoop/ozone/OzoneManagerVersion.java | 1 -
.../org/apache/hadoop/ozone/common/Checksum.java | 4 -
.../apache/hadoop/ozone/common/MonotonicClock.java | 81 ------
.../ozone/common/OzoneChecksumException.java | 12 -
.../hadoop/ozone/common/utils/BufferUtils.java | 6 -
.../ozone/container/common/helpers/BlockData.java | 16 --
.../container/common/helpers/ChunkInfoList.java | 4 -
.../apache/hadoop/ozone/lease/LeaseManager.java | 2 +-
.../org/apache/hadoop/ozone/lock/ActiveLock.java | 172 -------------
.../org/apache/hadoop/ozone/lock/LockManager.java | 284 ---------------------
.../hadoop/ozone/lock/PooledLockFactory.java | 48 ----
.../hadoop/hdds/client/TestReplicationConfig.java | 1 -
.../hadoop/hdds/fs/MockSpaceUsageSource.java | 4 -
.../hadoop/hdds/tracing/TestTracingUtil.java | 3 +-
.../hadoop/ozone/common/NativeCheckSumCRC32.java | 0
.../hadoop/ozone/common/TestChunkBuffer.java | 14 -
.../ozone/container/ContainerTestHelper.java | 29 +--
.../apache/hadoop/ozone/lock/TestLockManager.java | 208 ---------------
.../org/apache/hadoop/ozone/lock/package-info.java | 21 --
.../upgrade/TestLayoutVersionInstanceFactory.java | 5 -
.../org/apache/hadoop/util/NativeCRC32Wrapper.java | 0
.../authority/profile/DefaultProfile.java | 7 +-
.../client/DefaultCertificateClient.java | 9 +-
.../hdds/security/x509/keys/SecurityUtil.java | 8 +-
.../ssl/TestPemFileBasedKeyStoresFactory.java | 6 +-
.../client/CertificateClientTestImpl.java | 27 +-
.../container/ozoneimpl/TestOzoneContainer.java | 4 +-
58 files changed, 26 insertions(+), 1370 deletions(-)
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsIdFactory.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsIdFactory.java
index b244b8cf75..7a94d77c77 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsIdFactory.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsIdFactory.java
@@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hdds;
-import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
/**
@@ -41,13 +40,4 @@ public final class HddsIdFactory {
return LONG_COUNTER.incrementAndGet();
}
- /**
- * Returns a uuid.
- *
- * @return UUID.
- */
- public static UUID getUUId() {
- return UUID.randomUUID();
- }
-
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java
index 839e9bc6b5..f5a00e2dbe 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java
@@ -105,17 +105,6 @@ public final class HddsUtils {
private static final Logger LOG = LoggerFactory.getLogger(HddsUtils.class);
- /**
- * The service ID of the solitary Ozone SCM service.
- */
- public static final String OZONE_SCM_SERVICE_ID = "OzoneScmService";
- public static final String OZONE_SCM_SERVICE_INSTANCE_ID =
- "OzoneScmServiceInstance";
-
- private static final String MULTIPLE_SCM_NOT_YET_SUPPORTED =
- ScmConfigKeys.OZONE_SCM_NAMES + " must contain a single hostname."
- + " Multiple SCM hosts are currently unsupported";
-
public static final ByteString REDACTED =
ByteString.copyFromUtf8("<redacted>");
@@ -647,30 +636,6 @@ public final class HddsUtils {
return dirFile;
}
- /**
- * Leverages the Configuration.getPassword method to attempt to get
- * passwords from the CredentialProvider API before falling back to
- * clear text in config - if falling back is allowed.
- * @param conf Configuration instance
- * @param alias name of the credential to retrieve
- * @return String credential value or null
- */
- static String getPassword(ConfigurationSource conf, String alias) {
- String password = null;
- try {
- char[] passchars = conf.getPassword(alias);
- if (passchars != null) {
- password = new String(passchars);
- }
- } catch (IOException ioe) {
- LOG.warn("Setting password to null since IOException is caught"
- + " when getting password", ioe);
-
- password = null;
- }
- return password;
- }
-
/**
* Utility string formatter method to display SCM roles.
*
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/NodeDetails.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/NodeDetails.java
index 8349b12e6b..fc4e796fff 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/NodeDetails.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/NodeDetails.java
@@ -111,15 +111,6 @@ public abstract class NodeDetails {
return hostPort.toString();
}
- public String getRatisAddressPortStr() {
- StringBuilder hostPort = new StringBuilder();
- hostPort.append(getInetAddress().getHostAddress())
- .append(":")
- .append(ratisPort);
- return hostPort.toString();
- }
-
-
public int getRatisPort() {
return ratisPort;
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java
index 8a4d75a31f..b3a762e2ed 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java
@@ -19,8 +19,6 @@
package org.apache.hadoop.hdds.client;
import com.google.common.base.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static org.apache.hadoop.ozone.OzoneConsts.GB;
import static org.apache.hadoop.ozone.OzoneConsts.KB;
@@ -33,8 +31,6 @@ import static org.apache.hadoop.ozone.OzoneConsts.TB;
* a storage volume.
*/
public final class OzoneQuota {
- public static final Logger LOG =
- LoggerFactory.getLogger(OzoneQuota.class);
public static final String OZONE_QUOTA_B = "B";
public static final String OZONE_QUOTA_KB = "KB";
@@ -144,16 +140,6 @@ public final class OzoneQuota {
this.quotaInBytes = rawQuotaInBytes.sizeInBytes();
}
- /**
- * Formats a quota as a string.
- *
- * @param quota the quota to format
- * @return string representation of quota
- */
- public static String formatQuota(OzoneQuota quota) {
- return String.valueOf(quota.getRawSize()) + quota.getUnit();
- }
-
/**
* Parses a user provided string space quota and returns the
* Quota Object.
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java
index bb5ff0067f..69cce8db6d 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java
@@ -101,16 +101,6 @@ public class OzoneConfiguration extends Configuration
return conf.getObject(configurationClass);
}
- /**
- * @return a new {@code OzoneConfiguration} instance set from the given
- * {@code configObject}
- */
- public static <T> OzoneConfiguration fromObject(T configObject) {
- OzoneConfiguration conf = new OzoneConfiguration();
- conf.setFromObject(configObject);
- return conf;
- }
-
public OzoneConfiguration() {
OzoneConfiguration.activate();
loadDefaults();
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/freon/FakeClusterTopology.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/freon/FakeClusterTopology.java
index ddecf1f060..2d29dc8565 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/freon/FakeClusterTopology.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/freon/FakeClusterTopology.java
@@ -52,7 +52,7 @@ public class FakeClusterTopology {
public FakeClusterTopology() {
try {
for (int i = 0; i < 9; i++) {
- datanodes.add(createDatanode(i));
+ datanodes.add(createDatanode());
if ((i + 1) % 3 == 0) {
pipelines.add(Pipeline.newBuilder()
.setId(PipelineID.randomId().getProtobuf())
@@ -69,7 +69,7 @@ public class FakeClusterTopology {
}
}
- private DatanodeDetailsProto createDatanode(int index) {
+ private DatanodeDetailsProto createDatanode() {
return DatanodeDetailsProto.newBuilder()
.setUuid(UUID.randomUUID().toString())
.setHostName("localhost")
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/function/Predicates.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/function/Predicates.java
deleted file mode 100644
index 58e79ef05e..0000000000
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/function/Predicates.java
+++ /dev/null
@@ -1,47 +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
- * <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.function;
-
-import java.util.function.BiPredicate;
-import java.util.function.Predicate;
-
-/**
- * Common predicates.
- */
-public final class Predicates {
-
- public static <T> Predicate<T> yes() {
- return x -> true;
- }
-
- public static <T> Predicate<T> no() {
- return x -> false;
- }
-
- public static <T, U> BiPredicate<T, U> yesBi() {
- return (t, u) -> true;
- }
-
- public static <T, U> BiPredicate<T, U> noBi() {
- return (t, u) -> false;
- }
-
- private Predicates() {
- // no instances
- }
-}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/function/package-info.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/function/package-info.java
deleted file mode 100644
index 915fe3557e..0000000000
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/function/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-
-/**
- * Functional interfaces for ozone, similar to java.util.function.
- */
-package org.apache.hadoop.hdds.function;
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 739f6ebd65..5b6fb6fe9b 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
@@ -21,7 +21,6 @@ package org.apache.hadoop.hdds.protocol;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
-import java.util.Objects;
import java.util.Set;
import java.util.UUID;
@@ -563,14 +562,6 @@ public class DatanodeDetails extends NodeImpl implements
return uuid.hashCode();
}
- // Skip The OpStates which may change in Runtime.
- public int getSignature() {
- return Objects
- .hash(uuid, uuidString, ipAddress, hostName, ports,
- certSerialId, version, setupTime, revision, buildDate,
- initialVersion, currentVersion);
- }
-
/**
* Returns DatanodeDetails.Builder instance.
*
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ServerNotLeaderException.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ServerNotLeaderException.java
index 5a1e2864b5..89e6a05b6b 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ServerNotLeaderException.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ServerNotLeaderException.java
@@ -28,7 +28,6 @@ import java.util.regex.Pattern;
* Exception thrown when a server is not a leader for Ratis group.
*/
public class ServerNotLeaderException extends IOException {
- private final String currentPeerId;
private final String leader;
private static final Pattern CURRENT_PEER_ID_PATTERN =
Pattern.compile("Server:(.*) is not the leader[.]+.*", Pattern.DOTALL);
@@ -39,7 +38,6 @@ public class ServerNotLeaderException extends IOException {
public ServerNotLeaderException(RaftPeerId currentPeerId) {
super("Server:" + currentPeerId + " is not the leader. Could not " +
"determine the leader node.");
- this.currentPeerId = currentPeerId.toString();
this.leader = null;
}
@@ -47,7 +45,6 @@ public class ServerNotLeaderException extends IOException {
String suggestedLeader) {
super("Server:" + currentPeerId + " is not the leader. Suggested leader is"
+ " Server:" + suggestedLeader + ".");
- this.currentPeerId = currentPeerId.toString();
this.leader = suggestedLeader;
}
@@ -57,7 +54,6 @@ public class ServerNotLeaderException extends IOException {
Matcher currentLeaderMatcher = CURRENT_PEER_ID_PATTERN.matcher(message);
if (currentLeaderMatcher.matches()) {
- this.currentPeerId = currentLeaderMatcher.group(1);
Matcher suggestedLeaderMatcher =
SUGGESTED_LEADER_PATTERN.matcher(message);
@@ -77,7 +73,6 @@ public class ServerNotLeaderException extends IOException {
this.leader = null;
}
} else {
- this.currentPeerId = null;
this.leader = null;
}
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/RemoveSCMRequest.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/RemoveSCMRequest.java
index e47411f3f3..014f62343c 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/RemoveSCMRequest.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/RemoveSCMRequest.java
@@ -35,59 +35,10 @@ public class RemoveSCMRequest {
this.ratisAddr = addr;
}
- public static RemoveSCMRequest getFromProtobuf(
- HddsProtos.RemoveScmRequestProto proto) {
- return new Builder().setClusterId(proto.getClusterId())
- .setScmId(proto.getScmId()).setRatisAddr(proto.getRatisAddr()).build();
- }
-
public HddsProtos.RemoveScmRequestProto getProtobuf() {
return
HddsProtos.RemoveScmRequestProto.newBuilder().setClusterId(clusterId)
.setScmId(scmId).setRatisAddr(ratisAddr).build();
}
- /**
- * Builder for RemoveSCMRequest.
- */
- public static class Builder {
- private String clusterId;
- private String scmId;
- private String ratisAddr;
-
-
- /**
- * sets the cluster id.
- * @param cid clusterId to be set
- * @return Builder for RemoveSCMRequest
- */
- public RemoveSCMRequest.Builder setClusterId(String cid) {
- this.clusterId = cid;
- return this;
- }
-
- /**
- * sets the scmId.
- * @param id scmId
- * @return Builder for RemoveSCMRequest
- */
- public RemoveSCMRequest.Builder setScmId(String id) {
- this.scmId = id;
- return this;
- }
-
- /**
- * Set ratis address in Scm HA.
- * @param addr address in the format of [ip|hostname]:port
- * @return Builder for RemoveSCMRequest
- */
- public RemoveSCMRequest.Builder setRatisAddr(String addr) {
- this.ratisAddr = addr;
- return this;
- }
-
- public RemoveSCMRequest build() {
- return new RemoveSCMRequest(clusterId, scmId, ratisAddr);
- }
- }
/**
* Gets the clusterId from the Version file.
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManagerReport.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManagerReport.java
index a10846bd61..df8e9d45e1 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManagerReport.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManagerReport.java
@@ -132,11 +132,6 @@ public class ReplicationManagerReport {
incrementAndSample(stat.toString(), container);
}
- public void incrementAndSample(HddsProtos.LifeCycleState stat,
- ContainerID container) {
- incrementAndSample(stat.toString(), container);
- }
-
public void setComplete() {
reportTimeStamp = System.currentTimeMillis();
}
@@ -241,10 +236,6 @@ public class ReplicationManagerReport {
containerSample.put(stat, sample);
}
- public List<ContainerID> getSample(HddsProtos.LifeCycleState stat) {
- return getSample(stat.toString());
- }
-
public List<ContainerID> getSample(HealthState stat) {
return getSample(stat.toString());
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
index 9ba766bc94..80e09af172 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
@@ -115,10 +115,6 @@ public final class SCMHAUtils {
return conf.getTrimmedStringCollection(key);
}
- public static String getLocalSCMNodeId(String scmServiceId) {
- return addSuffix(ScmConfigKeys.OZONE_SCM_NODES_KEY, scmServiceId);
- }
-
/**
* Add non empty and non null suffix to a key.
*/
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetConstants.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetConstants.java
index 633ffba9e9..8ee6decc9c 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetConstants.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetConstants.java
@@ -36,7 +36,6 @@ public final class NetConstants {
public static final int NODE_COST_DEFAULT = 0;
public static final int ANCESTOR_GENERATION_DEFAULT = 0;
public static final int ROOT_LEVEL = 1;
- public static final String NODE_COST_PREFIX = "$";
public static final String DEFAULT_RACK = "/default-rack";
public static final String DEFAULT_NODEGROUP = "/default-nodegroup";
public static final String DEFAULT_DATACENTER = "/default-datacenter";
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetUtils.java
index 7463c52e95..18c530140e 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetUtils.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetUtils.java
@@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.regex.Pattern;
/**
* Utility class to facilitate network topology functions.
@@ -35,9 +34,6 @@ public final class NetUtils {
private static final Logger LOG = LoggerFactory.getLogger(NetUtils.class);
- private static final Pattern TRAILING_PATH_SEPARATOR =
- Pattern.compile(NetConstants.PATH_SEPARATOR_STR + "+$");
-
private NetUtils() {
// Prevent instantiation
}
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 dabdc0b822..e8bddb42cf 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
@@ -55,7 +55,8 @@ import java.util.UUID;
.HDDS_SCM_KERBEROS_PRINCIPAL_KEY)
public interface StorageContainerLocationProtocol extends Closeable {
- @SuppressWarnings("checkstyle:ConstantName")
+ // Accessed and checked via reflection in Hadoop RPC - changing it is
incompatible
+ @SuppressWarnings({"checkstyle:ConstantName", "unused"})
/**
* Version 1: Initial version.
*/
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ContainerCommandResponseBuilders.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ContainerCommandResponseBuilders.java
index 7ef2196c99..73369fc9a3 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ContainerCommandResponseBuilders.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ContainerCommandResponseBuilders.java
@@ -144,17 +144,6 @@ public final class ContainerCommandResponseBuilders {
.build();
}
- /**
- * Returns successful blockResponse.
- * @param msg - Request.
- * @return Response.
- */
- public static ContainerCommandResponseProto getBlockResponseSuccess(
- ContainerCommandRequestProto msg) {
-
- return getSuccessResponse(msg);
- }
-
public static ContainerCommandResponseProto getBlockDataResponse(
ContainerCommandRequestProto msg, BlockData data) {
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/ssl/PemFileBasedKeyStoresFactory.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/ssl/PemFileBasedKeyStoresFactory.java
index 25bec2145f..9a9002195c 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/ssl/PemFileBasedKeyStoresFactory.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/ssl/PemFileBasedKeyStoresFactory.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hdds.security.ssl;
import org.apache.hadoop.hdds.annotation.InterfaceAudience;
import org.apache.hadoop.hdds.annotation.InterfaceStability;
-import org.apache.hadoop.hdds.security.SecurityConfig;
import
org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient;
import
org.apache.hadoop.hdds.security.x509.certificate.client.CertificateNotification;
import org.slf4j.Logger;
@@ -58,8 +57,7 @@ public class PemFileBasedKeyStoresFactory implements
KeyStoresFactory,
private TrustManager[] trustManagers;
private final CertificateClient caClient;
- public PemFileBasedKeyStoresFactory(SecurityConfig securityConfig,
- CertificateClient client) {
+ public PemFileBasedKeyStoresFactory(CertificateClient client) {
this.caClient = client;
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenIdentifier.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenIdentifier.java
index 16cbaf9be7..91a98b799c 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenIdentifier.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenIdentifier.java
@@ -24,7 +24,6 @@ import org.apache.hadoop.hdds.client.BlockID;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.BlockTokenSecretProto;
import
org.apache.hadoop.hdds.protocol.proto.HddsProtos.BlockTokenSecretProto.AccessModeProto;
import org.apache.hadoop.io.Text;
-import org.apache.hadoop.security.token.Token.TrivialRenewer;
import org.apache.hadoop.util.ProtobufUtils;
import java.io.DataInput;
@@ -185,17 +184,5 @@ public class OzoneBlockTokenIdentifier extends
ShortLivedTokenIdentifier {
}
return builder.build().toByteArray();
}
-
- /**
- * Default TrivialRenewer.
- */
- @InterfaceAudience.Private
- public static class Renewer extends TrivialRenewer {
-
- @Override
- protected Text getKind() {
- return KIND_NAME;
- }
- }
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenSelector.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenSelector.java
index 989c8df0fb..6f13ac34a2 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenSelector.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/token/OzoneBlockTokenSelector.java
@@ -55,25 +55,4 @@ public class OzoneBlockTokenSelector implements
}
return null;
}
-
- /**
- * Static method to avoid instantiation.
- * */
- @SuppressWarnings("unchecked")
- public static Token<OzoneBlockTokenIdentifier> selectBlockToken(Text service,
- Collection<Token<? extends TokenIdentifier>> tokens) {
- if (service == null) {
- return null;
- }
- for (Token<? extends TokenIdentifier> token : tokens) {
- if (OzoneBlockTokenIdentifier.KIND_NAME.equals(token.getKind())
- && token.getService().equals(service)) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Getting token for service:{}", service);
- }
- return (Token<OzoneBlockTokenIdentifier>) token;
- }
- }
- return null;
- }
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClient.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClient.java
index 4798244985..e196d0df9d 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClient.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClient.java
@@ -21,10 +21,8 @@ package
org.apache.hadoop.hdds.security.x509.certificate.client;
import org.apache.hadoop.hdds.security.exception.OzoneSecurityException;
import org.apache.hadoop.hdds.security.ssl.KeyStoresFactory;
-import org.apache.hadoop.hdds.security.x509.certificate.authority.CAType;
import
org.apache.hadoop.hdds.security.x509.certificate.utils.CertificateSignRequest;
import org.apache.hadoop.hdds.security.x509.exception.CertificateException;
-import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import java.io.Closeable;
import java.io.IOException;
@@ -138,17 +136,6 @@ public interface CertificateClient extends Closeable {
*/
List<String> getCAList();
- /**
- * Return the pem encoded CA certificate list.
- *
- * If list is null, fetch the list from SCM and returns the list.
- * If list is not null, return the pem encoded CA certificate list.
- *
- * @return list of pem encoded CA certificates.
- * @throws IOException
- */
- List<String> listCA() throws IOException;
-
/**
* Update and returns the pem encoded CA certificate list.
* @return list of pem encoded CA certificates.
@@ -156,16 +143,6 @@ public interface CertificateClient extends Closeable {
*/
List<String> updateCAList() throws IOException;
- /**
- * Creates digital signature over the data stream using the components
private
- * key.
- *
- * @param data data to be signed
- * @return byte array - containing the signature
- * @throws CertificateException - on Error
- */
- byte[] signData(byte[] data) throws CertificateException;
-
/**
* Verifies a digital Signature, given the signature and the certificate of
* the signer.
@@ -186,26 +163,6 @@ public interface CertificateClient extends Closeable {
CertificateSignRequest.Builder getCSRBuilder()
throws CertificateException;
- /**
- * Send request to SCM to sign the certificate and save certificates returned
- * by SCM to PEM files on disk.
- *
- * @return the serial ID of the new certificate
- */
- String signAndStoreCertificate(PKCS10CertificationRequest request)
- throws CertificateException;
-
- /**
- * Stores the Certificate for this client. Don't use this api to add
- * trusted certificates of others.
- *
- * @param pemEncodedCert - pem encoded X509 Certificate
- * @param caType - Is CA certificate.
- * @throws CertificateException - on Error.
- */
- void storeCertificate(String pemEncodedCert, CAType caType)
- throws CertificateException;
-
default void assertValidKeysAndCertificate() throws OzoneSecurityException {
try {
Objects.requireNonNull(getPublicKey());
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/utils/SelfSignedCertificate.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/utils/SelfSignedCertificate.java
index 802c3ff07e..87834cdb45 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/utils/SelfSignedCertificate.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/utils/SelfSignedCertificate.java
@@ -262,15 +262,6 @@ public final class SelfSignedCertificate {
return this;
}
- public Builder addServiceName(
- String serviceName) {
- Preconditions.checkNotNull(
- serviceName, "Service Name cannot be null");
-
- this.addAltName(GeneralName.otherName, serviceName);
- return this;
- }
-
private Builder addAltName(int tag, String name) {
if (altNames == null) {
altNames = new ArrayList<>();
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/exception/CertificateException.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/exception/CertificateException.java
index df7cdde047..208cff7c81 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/exception/CertificateException.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/security/x509/exception/CertificateException.java
@@ -88,7 +88,6 @@ public class CertificateException extends
SCMSecurityException {
BOOTSTRAP_ERROR,
CSR_ERROR,
CRYPTO_SIGNATURE_VERIFICATION_ERROR,
- CERTIFICATE_NOT_FOUND_ERROR,
RENEW_ERROR,
ROLLBACK_ERROR
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/JsonUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/JsonUtils.java
index cad0f7ffc2..d14129972c 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/JsonUtils.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/JsonUtils.java
@@ -31,7 +31,6 @@ import com.fasterxml.jackson.databind.SequenceWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
/**
@@ -74,22 +73,6 @@ public final class JsonUtils {
return MAPPER.valueToTree(next);
}
- /**
- * Deserialize a list of elements from a given string,
- * each element in the list is in the given type.
- *
- * @param str json string.
- * @param elementType element type.
- * @return List of elements of type elementType
- * @throws IOException
- */
- public static List<?> toJsonList(String str, Class<?> elementType)
- throws IOException {
- CollectionType type = MAPPER.getTypeFactory()
- .constructCollectionType(List.class, elementType);
- return MAPPER.readValue(str, type);
- }
-
/**
* Utility to sequentially write a large collection of items to a file.
*/
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java
index 6c0272e256..31aaca568e 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java
@@ -35,7 +35,6 @@ import org.apache.hadoop.ipc.Server;
import org.apache.hadoop.ozone.OzoneConfigKeys;
import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.http.client.methods.HttpRequestBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -127,17 +126,6 @@ public final class ServerUtils {
return updatedAddr;
}
-
- /**
- * Releases a http connection if the request is not null.
- * @param request
- */
- public static void releaseConnection(HttpRequestBase request) {
- if (request != null) {
- request.releaseConnection();
- }
- }
-
/**
* Get the location where SCM should store its metadata directories.
* Fall back to OZONE_METADATA_DIRS if not defined.
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/GrpcServerInterceptor.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/GrpcServerInterceptor.java
index bd35d56c77..802c153123 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/GrpcServerInterceptor.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/GrpcServerInterceptor.java
@@ -45,7 +45,7 @@ public class GrpcServerInterceptor implements
ServerInterceptor {
.importAndCreateSpan(
call.getMethodDescriptor().getFullMethodName(),
headers.get(GrpcClientInterceptor.TRACING_HEADER));
- try (Scope scope = GlobalTracer.get().activateSpan(span)) {
+ try (Scope ignored = GlobalTracer.get().activateSpan(span)) {
super.onMessage(message);
} finally {
span.finish();
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java
index d30e50f803..b968d40723 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java
@@ -149,16 +149,6 @@ public final class TracingUtil {
return executeInSpan(span, supplier);
}
- /**
- * Execute a function inside an activated new span.
- */
- public static <E extends Exception> void executeInNewSpan(String spanName,
- CheckedRunnable<E> runnable) throws E {
- Span span = GlobalTracer.get()
- .buildSpan(spanName).start();
- executeInSpan(span, runnable);
- }
-
/**
* Execute {@code supplier} in the given {@code span}.
* @return the value returned by {@code supplier}
@@ -190,15 +180,6 @@ public final class TracingUtil {
}
}
- /**
- * Execute a new function as a child span of the parent.
- */
- public static <R, E extends Exception> R executeAsChildSpan(String spanName,
- String parentName, CheckedSupplier<R, E> supplier) throws E {
- Span span = TracingUtil.importAndCreateSpan(spanName, parentName);
- return executeInSpan(span, supplier);
- }
-
/**
* Execute a new function as a child span of the parent.
*/
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/Codec.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/Codec.java
index 190768938e..46779648e6 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/Codec.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/Codec.java
@@ -42,14 +42,6 @@ public interface Codec<T> {
return false;
}
- /**
- * @return an upper bound, which should be obtained without serialization,
- * of the serialized size of the given object.
- */
- default int getSerializedSizeUpperBound(T object) {
- throw new UnsupportedOperationException();
- }
-
/**
* Serialize the given object to bytes.
*
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java
index 97311b921c..64e494a5af 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java
@@ -420,17 +420,6 @@ public class CodecBuffer implements AutoCloseable {
return this;
}
- /**
- * Similar to {@link ByteBuffer#put(byte[])}.
- *
- * @return this object.
- */
- public CodecBuffer put(byte[] array) {
- assertRefCnt(1);
- buf.writeBytes(array);
- return this;
- }
-
/**
* Similar to {@link ByteBuffer#put(ByteBuffer)}.
*
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/StringCodecBase.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/StringCodecBase.java
index f7b1247ca0..1df5523793 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/StringCodecBase.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/StringCodecBase.java
@@ -88,8 +88,7 @@ abstract class StringCodecBase implements Codec<String> {
* When {@link #isFixedLength()} is true,
* the upper bound equals to the serialized size.
*/
- @Override
- public int getSerializedSizeUpperBound(String s) {
+ private int getSerializedSizeUpperBound(String s) {
return maxBytesPerChar * s.length();
}
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 4f0f800dfd..653af11ce8 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
@@ -148,17 +148,6 @@ public final class OzoneConsts {
public static final String MULTIPART_FORM_DATA_BOUNDARY = "---XXX";
- /**
- * Supports Bucket Versioning.
- */
- public enum Versioning {
- NOT_DEFINED, ENABLED, DISABLED;
-
- public static Versioning getVersioning(boolean versioning) {
- return versioning ? ENABLED : DISABLED;
- }
- }
-
// Block ID prefixes used in datanode containers.
public static final String DELETING_KEY_PREFIX = "#deleting#";
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
index 00f2e55f97..985c238fd7 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
@@ -44,7 +44,6 @@ public enum OzoneManagerVersion implements ComponentVersion {
+ " newer and an unknown server version has arrived to the client.");
public static final OzoneManagerVersion CURRENT = latest();
- public static final int CURRENT_VERSION = CURRENT.version;
private static final Map<Integer, OzoneManagerVersion> BY_PROTO_VALUE =
Arrays.stream(values())
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 059ed650f3..f8b3febfec 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
@@ -33,8 +33,6 @@ import com.google.common.primitives.Ints;
import org.apache.hadoop.ozone.common.utils.BufferUtils;
import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
import org.apache.ratis.thirdparty.com.google.protobuf.UnsafeByteOperations;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Class to compute and verify checksums for chunks.
@@ -42,8 +40,6 @@ import org.slf4j.LoggerFactory;
* This class is not thread safe.
*/
public class Checksum {
- public static final Logger LOG = LoggerFactory.getLogger(Checksum.class);
-
private static Function<ByteBuffer, ByteString> newMessageDigestFunction(
String algorithm) {
final MessageDigest md;
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/MonotonicClock.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/MonotonicClock.java
deleted file mode 100644
index 62a323d253..0000000000
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/MonotonicClock.java
+++ /dev/null
@@ -1,81 +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.
- */
-package org.apache.hadoop.ozone.common;
-
-import org.apache.hadoop.util.Time;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneId;
-
-/**
- * This is a class which implements the Clock interface. It is a copy of the
- * Java Clock.SystemClock only it uses MonotonicNow (nanotime) rather than
- * System.currentTimeMills.
- */
-
-public final class MonotonicClock extends Clock {
-
- private final ZoneId zoneId;
-
- public MonotonicClock(ZoneId zone) {
- this.zoneId = zone;
- }
-
- @Override
- public ZoneId getZone() {
- return zoneId;
- }
-
- @Override
- public Clock withZone(ZoneId zone) {
- if (zone.equals(this.zoneId)) { // intentional NPE
- return this;
- }
- return new MonotonicClock(zone);
- }
-
- @Override
- public long millis() {
- return Time.monotonicNow();
- }
-
- @Override
- public Instant instant() {
- return Instant.ofEpochMilli(millis());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof MonotonicClock) {
- return zoneId.equals(((MonotonicClock) obj).zoneId);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return zoneId.hashCode() + 1;
- }
-
- @Override
- public String toString() {
- return "MonotonicClock[" + zoneId + "]";
- }
-
-}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/OzoneChecksumException.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/OzoneChecksumException.java
index 8ba7b6da1e..7bc7f618a3 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/OzoneChecksumException.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/OzoneChecksumException.java
@@ -18,7 +18,6 @@
package org.apache.hadoop.ozone.common;
import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
import org.apache.hadoop.hdds.annotation.InterfaceAudience;
import org.apache.hadoop.hdds.annotation.InterfaceStability;
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
@@ -46,17 +45,6 @@ public class OzoneChecksumException extends IOException {
unrecognizedChecksumType));
}
- /**
- * OzoneChecksumException to wrap around NoSuchAlgorithmException.
- * @param algorithm name of algorithm
- * @param ex original exception thrown
- */
- public OzoneChecksumException(
- String algorithm, NoSuchAlgorithmException ex) {
- super(String.format("NoSuchAlgorithmException thrown while computing " +
- "SHA-256 checksum using algorithm %s", algorithm), ex);
- }
-
/**
* OzoneChecksumException to throw with custom message.
*/
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/utils/BufferUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/utils/BufferUtils.java
index 8bfb7490c4..c6ad754f19 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/utils/BufferUtils.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/utils/BufferUtils.java
@@ -136,10 +136,4 @@ public final class BufferUtils {
}
return Math.toIntExact(n);
}
-
- public static void clearBuffers(ByteBuffer[] byteBuffers) {
- for (ByteBuffer buffer : byteBuffers) {
- buffer.clear();
- }
- }
}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/BlockData.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/BlockData.java
index 8f89be3c11..4bd170df8e 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/BlockData.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/BlockData.java
@@ -146,22 +146,6 @@ public class BlockData {
return Collections.unmodifiableMap(this.metadata);
}
- /**
- * Returns value of a key.
- */
- public synchronized String getValue(String key) {
- return metadata.get(key);
- }
-
- /**
- * Deletes a metadata entry from the map.
- *
- * @param key - Key
- */
- public synchronized void deleteKey(String key) {
- metadata.remove(key);
- }
-
@SuppressWarnings("unchecked")
private List<ContainerProtos.ChunkInfo> castChunkList() {
return (List<ContainerProtos.ChunkInfo>)chunkList;
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ChunkInfoList.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ChunkInfoList.java
index 6f31ee40c4..fdf40af9e0 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ChunkInfoList.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ChunkInfoList.java
@@ -48,10 +48,6 @@ public class ChunkInfoList {
this.chunks = Collections.unmodifiableList(chunks);
}
- public List<ContainerProtos.ChunkInfo> asList() {
- return chunks;
- }
-
/**
* @return A new {@link ChunkInfoList} created from protobuf data.
*/
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
index f2bad543a9..7dfcf3eb8c 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
@@ -282,7 +282,7 @@ public class LeaseManager<T> {
try {
// ignore return value, just used for wait
- boolean b = semaphore.tryAcquire(sleepTime, TimeUnit.MILLISECONDS);
+ boolean ignored = semaphore.tryAcquire(sleepTime,
TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
LOG.warn("Lease manager is interrupted. Shutting down...", e);
Thread.currentThread().interrupt();
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/ActiveLock.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/ActiveLock.java
deleted file mode 100644
index 2740c17790..0000000000
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/ActiveLock.java
+++ /dev/null
@@ -1,172 +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
- * <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.lock;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-/**
- * Lock implementation which also maintains counter.
- */
-public final class ActiveLock {
-
- private ReentrantReadWriteLock lock;
- private AtomicInteger count;
-
- /**
- * Use ActiveLock#newInstance to create instance.
- *
- * @param fairness - if true the lock uses a fair ordering policy, else
- * non-fair ordering.
- */
- private ActiveLock(boolean fairness) {
- this.lock = new ReentrantReadWriteLock(fairness);
- this.count = new AtomicInteger(0);
- }
-
- /**
- * Creates a new instance of ActiveLock.
- *
- * @return new ActiveLock
- */
- public static ActiveLock newInstance(boolean fairness) {
- return new ActiveLock(fairness);
- }
-
- /**
- * Acquires read lock.
- *
- * <p>Acquires the read lock if the write lock is not held by
- * another thread and returns immediately.
- *
- * <p>If the write lock is held by another thread then
- * the current thread becomes disabled for thread scheduling
- * purposes and lies dormant until the read lock has been acquired.
- */
- void readLock() {
- lock.readLock().lock();
- }
-
- /**
- * Attempts to release the read lock.
- *
- * <p>If the number of readers is now zero then the lock
- * is made available for write lock attempts.
- */
- void readUnlock() {
- lock.readLock().unlock();
- }
-
- /**
- * Acquires write lock.
- *
- * <p>Acquires the write lock if neither the read nor write lock
- * are held by another thread
- * and returns immediately, setting the write lock hold count to
- * one.
- *
- * <p>If the current thread already holds the write lock then the
- * hold count is incremented by one and the method returns
- * immediately.
- *
- * <p>If the lock is held by another thread then the current
- * thread becomes disabled for thread scheduling purposes and
- * lies dormant until the write lock has been acquired.
- */
- void writeLock() {
- lock.writeLock().lock();
- }
-
- /**
- * Attempts to release the write lock.
- *
- * <p>If the current thread is the holder of this lock then
- * the hold count is decremented. If the hold count is now
- * zero then the lock is released.
- */
- void writeUnlock() {
- lock.writeLock().unlock();
- }
-
- /**
- * Increment the active count of the lock.
- */
- void incrementActiveCount() {
- count.incrementAndGet();
- }
-
- /**
- * Decrement the active count of the lock.
- */
- void decrementActiveCount() {
- count.decrementAndGet();
- }
-
- /**
- * Returns the active count on the lock.
- *
- * @return Number of active leases on the lock.
- */
- int getActiveLockCount() {
- return count.get();
- }
-
- /**
- * Returns the number of reentrant read holds on this lock by the current
- * thread.
- *
- * @return the number of holds on the read lock by the current thread,
- * or zero if the read lock is not held by the current thread
- */
- int getReadHoldCount() {
- return lock.getReadHoldCount();
- }
-
- /**
- * Returns the number of reentrant write holds on this lock by the current
- * thread.
- *
- * @return the number of holds on the write lock by the current thread,
- * or zero if the write lock is not held by the current thread
- */
- int getWriteHoldCount() {
- return lock.getWriteHoldCount();
- }
-
- /**
- * Queries if the write lock is held by the current thread.
- *
- * @return {@code true} if the current thread holds the write lock and
- * {@code false} otherwise
- */
- boolean isWriteLockedByCurrentThread() {
- return lock.isWriteLockedByCurrentThread();
- }
-
- /**
- * Resets the active count on the lock.
- */
- void resetCounter() {
- count.set(0);
- }
-
- @Override
- public String toString() {
- return lock.toString();
- }
-}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/LockManager.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/LockManager.java
deleted file mode 100644
index 1cbe758736..0000000000
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/LockManager.java
+++ /dev/null
@@ -1,284 +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
- * <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.lock;
-
-import org.apache.commons.pool2.impl.GenericObjectPool;
-import org.apache.hadoop.hdds.conf.ConfigurationSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Consumer;
-
-/**
- * Manages the locks on a given resource. A new lock is created for each
- * and every unique resource. Uniqueness of resource depends on the
- * {@code equals} implementation of it.
- */
-public class LockManager<R> {
-
- private static final Logger LOG = LoggerFactory.getLogger(LockManager.class);
-
- private final Map<R, ActiveLock> activeLocks = new ConcurrentHashMap<>();
- private final GenericObjectPool<ActiveLock> lockPool;
-
- /**
- * Creates new LockManager instance with the given Configuration.and uses
- * non-fair mode for locks.
- *
- * @param conf Configuration object
- */
- public LockManager(final ConfigurationSource conf) {
- this(conf, false);
- }
-
-
- /**
- * Creates new LockManager instance with the given Configuration.
- *
- * @param conf Configuration object
- * @param fair - true to use fair lock ordering, else non-fair lock ordering.
- */
- public LockManager(final ConfigurationSource conf, boolean fair) {
- lockPool =
- new GenericObjectPool<>(new PooledLockFactory(fair));
- lockPool.setMaxTotal(-1);
- }
-
- /**
- * Acquires the lock on given resource.
- *
- * <p>If the lock is not available then the current thread becomes
- * disabled for thread scheduling purposes and lies dormant until the
- * lock has been acquired.
- *
- * @param resource on which the lock has to be acquired
- * @deprecated Use {@link LockManager#writeLock} instead
- */
- public void lock(final R resource) {
- writeLock(resource);
- }
-
- /**
- * Releases the lock on given resource.
- *
- * @param resource for which the lock has to be released
- * @deprecated Use {@link LockManager#writeUnlock} instead
- */
- public void unlock(final R resource) {
- writeUnlock(resource);
- }
-
- /**
- * Acquires the read lock on given resource.
- *
- * <p>Acquires the read lock on resource if the write lock is not held by
- * another thread and returns immediately.
- *
- * <p>If the write lock on resource is held by another thread then
- * the current thread becomes disabled for thread scheduling
- * purposes and lies dormant until the read lock has been acquired.
- *
- * @param resource on which the read lock has to be acquired
- */
- public void readLock(final R resource) {
- acquire(resource, ActiveLock::readLock);
- }
-
- /**
- * Releases the read lock on given resource.
- *
- * @param resource for which the read lock has to be released
- * @throws IllegalMonitorStateException if the current thread does not
- * hold this lock
- */
- public void readUnlock(final R resource) throws IllegalMonitorStateException
{
- release(resource, ActiveLock::readUnlock);
- }
-
- /**
- * Acquires the write lock on given resource.
- *
- * <p>Acquires the write lock on resource if neither the read nor write lock
- * are held by another thread and returns immediately.
- *
- * <p>If the current thread already holds the write lock then the
- * hold count is incremented by one and the method returns
- * immediately.
- *
- * <p>If the lock is held by another thread then the current
- * thread becomes disabled for thread scheduling purposes and
- * lies dormant until the write lock has been acquired.
- *
- * @param resource on which the lock has to be acquired
- */
- public void writeLock(final R resource) {
- acquire(resource, ActiveLock::writeLock);
- }
-
- /**
- * Releases the write lock on given resource.
- *
- * @param resource for which the lock has to be released
- * @throws IllegalMonitorStateException if the current thread does not
- * hold this lock
- */
- public void writeUnlock(final R resource)
- throws IllegalMonitorStateException {
- release(resource, ActiveLock::writeUnlock);
- }
-
- /**
- * Acquires the lock on given resource using the provided lock function.
- *
- * @param resource on which the lock has to be acquired
- * @param lockFn function to acquire the lock
- */
- private void acquire(final R resource, final Consumer<ActiveLock> lockFn) {
- lockFn.accept(getLockForLocking(resource));
- }
-
- /**
- * Releases the lock on given resource using the provided release function.
- *
- * @param resource for which the lock has to be released
- * @param releaseFn function to release the lock
- */
- private void release(final R resource, final Consumer<ActiveLock> releaseFn)
{
- final ActiveLock lock = getLockForReleasing(resource);
- releaseFn.accept(lock);
- decrementActiveLockCount(resource);
- }
-
- /**
- * Returns {@link ActiveLock} instance for the given resource,
- * on which the lock can be acquired.
- *
- * @param resource on which the lock has to be acquired
- * @return {@link ActiveLock} instance
- */
- private ActiveLock getLockForLocking(final R resource) {
- /*
- * While getting a lock object for locking we should
- * atomically increment the active count of the lock.
- *
- * This is to avoid cases where the selected lock could
- * be removed from the activeLocks map and returned to
- * the object pool.
- */
- return activeLocks.compute(resource, (k, v) -> {
- final ActiveLock lock;
- try {
- if (v == null) {
- lock = lockPool.borrowObject();
- } else {
- lock = v;
- }
- lock.incrementActiveCount();
- } catch (Exception ex) {
- LOG.error("Unable to obtain lock.", ex);
- throw new RuntimeException(ex);
- }
- return lock;
- });
- }
-
- /**
- * Returns {@link ActiveLock} instance for the given resource,
- * for which the lock has to be released.
- *
- * @param resource for which the lock has to be released
- * @return {@link ActiveLock} instance
- */
- private ActiveLock getLockForReleasing(final R resource) {
- if (activeLocks.containsKey(resource)) {
- return activeLocks.get(resource);
- }
- // Someone is releasing a lock which was never acquired.
- LOG.error("Trying to release the lock on {}, which was never acquired.",
- resource);
- throw new IllegalMonitorStateException("Releasing lock on resource "
- + resource + " without acquiring lock");
- }
-
- /**
- * Decrements the active lock count and returns the {@link ActiveLock}
- * object to pool if the active count is 0.
- *
- * @param resource resource to which the ActiveLock is associated
- */
- private void decrementActiveLockCount(final R resource) {
- activeLocks.computeIfPresent(resource, (k, v) -> {
- v.decrementActiveCount();
- if (v.getActiveLockCount() != 0) {
- return v;
- }
- lockPool.returnObject(v);
- return null;
- });
- }
-
- /**
- * Returns the number of reentrant read holds on this lock by the current
- * thread on a given resource.
- *
- * @param resource for which the read lock hold count has to be returned
- * @return the number of holds on the read lock by the current thread,
- * or zero if the read lock is not held by the current thread
- */
- public int getReadHoldCount(final R resource) {
- ActiveLock activeLock = activeLocks.get(resource);
- if (activeLock != null) {
- return activeLock.getReadHoldCount();
- }
- return 0;
- }
-
- /**
- * Returns the number of reentrant write holds on this lock by the current
- * thread on a given resource.
- *
- * @param resource for which the write lock hold count has to be returned
- * @return the number of holds on the write lock by the current thread,
- * or zero if the write lock is not held by the current thread
- */
- public int getWriteHoldCount(final R resource) {
- ActiveLock activeLock = activeLocks.get(resource);
- if (activeLock != null) {
- return activeLock.getWriteHoldCount();
- }
- return 0;
- }
-
- /**
- * Queries if the write lock is held by the current thread on a given
- * resource.
- *
- * @param resource for which the query has to be returned
- * @return {@code true} if the current thread holds the write lock and
- * {@code false} otherwise
- */
- public boolean isWriteLockedByCurrentThread(final R resource) {
- ActiveLock activeLock = activeLocks.get(resource);
- if (activeLock != null) {
- return activeLock.isWriteLockedByCurrentThread();
- }
- return false;
- }
-}
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/PooledLockFactory.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/PooledLockFactory.java
deleted file mode 100644
index 1e3ba05a3a..0000000000
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/PooledLockFactory.java
+++ /dev/null
@@ -1,48 +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
- * <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.lock;
-
-import org.apache.commons.pool2.BasePooledObjectFactory;
-import org.apache.commons.pool2.PooledObject;
-import org.apache.commons.pool2.impl.DefaultPooledObject;
-
-/**
- * Pool factory to create {@code ActiveLock} instances.
- */
-public class PooledLockFactory extends BasePooledObjectFactory<ActiveLock> {
-
- private boolean fairness;
-
- PooledLockFactory(boolean fair) {
- this.fairness = fair;
- }
- @Override
- public ActiveLock create() throws Exception {
- return ActiveLock.newInstance(fairness);
- }
-
- @Override
- public PooledObject<ActiveLock> wrap(ActiveLock activeLock) {
- return new DefaultPooledObject<>(activeLock);
- }
-
- @Override
- public void activateObject(PooledObject<ActiveLock> pooledObject) {
- pooledObject.getObject().resetCounter();
- }
-}
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
index fa5e9e60ab..44f0817626 100644
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
+++
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
@@ -43,7 +43,6 @@ import static
org.junit.jupiter.params.provider.Arguments.arguments;
public class TestReplicationConfig {
private static final int MB = 1024 * 1024;
- private static final int KB = 1024;
//NOTE: if a new chunkSize is used/added in the parameters other than KB or
MB
// please revisit the method createECDescriptor, to handle the new chunkSize.
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/fs/MockSpaceUsageSource.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/fs/MockSpaceUsageSource.java
index 26c861dc68..76b6a0db89 100644
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/fs/MockSpaceUsageSource.java
+++
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/fs/MockSpaceUsageSource.java
@@ -22,10 +22,6 @@ package org.apache.hadoop.hdds.fs;
*/
public final class MockSpaceUsageSource {
- public static SpaceUsageSource zero() {
- return fixed(0, 0);
- }
-
public static SpaceUsageSource unlimited() {
return fixed(Long.MAX_VALUE, Long.MAX_VALUE);
}
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/tracing/TestTracingUtil.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/tracing/TestTracingUtil.java
index 8d5c56fc0d..39884fcd5a 100644
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/tracing/TestTracingUtil.java
+++
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/tracing/TestTracingUtil.java
@@ -51,8 +51,7 @@ public class TestTracingUtil {
Configuration config = Configuration.fromEnv("testInitTracing");
JaegerTracer tracer = config.getTracerBuilder().build();
GlobalTracer.registerIfAbsent(tracer);
- try (AutoCloseable scope = TracingUtil
- .createActivatedSpan("initTracing")) {
+ try (AutoCloseable ignored =
TracingUtil.createActivatedSpan("initTracing")) {
exportCurrentSpan();
} catch (Exception e) {
fail("Should not get exception");
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java
similarity index 100%
rename from
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java
rename to
hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/NativeCheckSumCRC32.java
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChunkBuffer.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChunkBuffer.java
index 414754092f..fa8889cd10 100644
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChunkBuffer.java
+++
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/common/TestChunkBuffer.java
@@ -222,18 +222,4 @@ public class TestChunkBuffer {
assertArrayEquals(expected, output.toByteArray());
assertFalse(impl.hasRemaining());
}
-
- private static String toString(byte[] arr) {
- if (arr == null || arr.length == 0) {
- return "";
- }
-
- StringBuilder sb = new StringBuilder();
- for (byte b : arr) {
- sb.append(Character.forDigit((b >> 4) & 0xF, 16))
- .append(Character.forDigit((b & 0xF), 16))
- .append(" ");
- }
- return sb.deleteCharAt(sb.length() - 1).toString();
- }
}
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java
index e7474a0b8d..7ade596add 100644
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java
+++
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/container/ContainerTestHelper.java
@@ -442,11 +442,9 @@ public final class ContainerTestHelper {
/**
* Verify the response against the request.
*
- * @param request - Request
* @param response - Response
*/
- public static void verifyGetBlock(ContainerCommandRequestProto request,
- ContainerCommandResponseProto response, int expectedChunksCount) {
+ public static void verifyGetBlock(ContainerCommandResponseProto response,
int expectedChunksCount) {
assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
assertEquals(expectedChunksCount,
response.getGetBlock().getBlockData().getChunksCount());
@@ -495,23 +493,6 @@ public final class ContainerTestHelper {
Pipeline pipeline, long containerID) throws IOException {
return getCloseContainer(pipeline, containerID, null);
}
- /**
- * Returns a simple request without traceId.
- * @param pipeline - pipeline
- * @param containerID - ID of the container.
- * @return ContainerCommandRequestProto without traceId.
- */
- public static ContainerCommandRequestProto getRequestWithoutTraceId(
- Pipeline pipeline, long containerID) throws IOException {
- Preconditions.checkNotNull(pipeline);
- return ContainerCommandRequestProto.newBuilder()
- .setCmdType(ContainerProtos.Type.CloseContainer)
- .setContainerID(containerID)
- .setCloseContainer(
- ContainerProtos.CloseContainerRequestProto.getDefaultInstance())
- .setDatanodeUuid(pipeline.getFirstNode().getUuidString())
- .build();
- }
/**
* Returns a delete container request.
@@ -535,14 +516,6 @@ public final class ContainerTestHelper {
.build();
}
- private static void sleep(long milliseconds) {
- try {
- Thread.sleep(milliseconds);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
public static BlockID getTestBlockID(long containerID) {
return new BlockID(containerID, UniqueId.next());
}
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/lock/TestLockManager.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/lock/TestLockManager.java
deleted file mode 100644
index 62b8e6ac50..0000000000
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/lock/TestLockManager.java
+++ /dev/null
@@ -1,208 +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
- * <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.lock;
-
-import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.apache.ozone.test.GenericTestUtils;
-import org.apache.hadoop.util.Daemon;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * Test-cases to test LockManager.
- */
-class TestLockManager {
-
- @Test
- @Timeout(1)
- void testWriteLockWithDifferentResource() {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- manager.writeLock("/resourceOne");
- // This should work, as they are different resource.
- assertDoesNotThrow(() -> manager.writeLock("/resourceTwo"));
- manager.writeUnlock("/resourceOne");
- manager.writeUnlock("/resourceTwo");
- }
-
- @Test
- void testWriteLockWithSameResource() throws Exception {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- final AtomicBoolean gotLock = new AtomicBoolean(false);
- manager.writeLock("/resourceOne");
- new Thread(() -> {
- manager.writeLock("/resourceOne");
- gotLock.set(true);
- manager.writeUnlock("/resourceOne");
- }).start();
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- // Since the other thread is trying to get write lock on same object,
- // it will wait.
- assertFalse(gotLock.get());
- manager.writeUnlock("/resourceOne");
- // Since we have released the write lock, the other thread should have
- // the lock now
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- assertTrue(gotLock.get());
- }
-
- @Test
- @Timeout(1)
- void testReadLockWithDifferentResource() {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- manager.readLock("/resourceOne");
- assertDoesNotThrow(() -> manager.readLock("/resourceTwo"));
- manager.readUnlock("/resourceOne");
- manager.readUnlock("/resourceTwo");
- }
-
- @Test
- void testReadLockWithSameResource() throws Exception {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- final AtomicBoolean gotLock = new AtomicBoolean(false);
- manager.readLock("/resourceOne");
- new Thread(() -> {
- manager.readLock("/resourceOne");
- gotLock.set(true);
- manager.readUnlock("/resourceOne");
- }).start();
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- // Since the new thread is trying to get read lock, it should work.
- assertTrue(gotLock.get());
- manager.readUnlock("/resourceOne");
- }
-
- @Test
- void testWriteReadLockWithSameResource() throws Exception {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- final AtomicBoolean gotLock = new AtomicBoolean(false);
- manager.writeLock("/resourceOne");
- new Thread(() -> {
- manager.readLock("/resourceOne");
- gotLock.set(true);
- manager.readUnlock("/resourceOne");
- }).start();
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- // Since the other thread is trying to get read lock on same object,
- // it will wait.
- assertFalse(gotLock.get());
- manager.writeUnlock("/resourceOne");
- // Since we have released the write lock, the other thread should have
- // the lock now
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- assertTrue(gotLock.get());
- }
-
- @Test
- void testReadWriteLockWithSameResource() throws Exception {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- final AtomicBoolean gotLock = new AtomicBoolean(false);
- manager.readLock("/resourceOne");
- new Thread(() -> {
- manager.writeLock("/resourceOne");
- gotLock.set(true);
- manager.writeUnlock("/resourceOne");
- }).start();
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- // Since the other thread is trying to get write lock on same object,
- // it will wait.
- assertFalse(gotLock.get());
- manager.readUnlock("/resourceOne");
- // Since we have released the read lock, the other thread should have
- // the lock now
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- assertTrue(gotLock.get());
- }
-
- @Test
- void testMultiReadWriteLockWithSameResource() throws Exception {
- final LockManager<String> manager =
- new LockManager<>(new OzoneConfiguration());
- final AtomicBoolean gotLock = new AtomicBoolean(false);
- manager.readLock("/resourceOne");
- manager.readLock("/resourceOne");
- new Thread(() -> {
- manager.writeLock("/resourceOne");
- gotLock.set(true);
- manager.writeUnlock("/resourceOne");
- }).start();
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- // Since the other thread is trying to get write lock on same object,
- // it will wait.
- assertFalse(gotLock.get());
- manager.readUnlock("/resourceOne");
- //We have only released one read lock, we still hold another read lock.
- Thread.sleep(100);
- assertFalse(gotLock.get());
- manager.readUnlock("/resourceOne");
- // Since we have released the read lock, the other thread should have
- // the lock now
- // Let's give some time for the other thread to run
- Thread.sleep(100);
- assertTrue(gotLock.get());
- }
-
- @Test
- void testConcurrentWriteLockWithDifferentResource() throws Exception {
- OzoneConfiguration conf = new OzoneConfiguration();
- final int count = 100;
- final LockManager<Integer> manager = new LockManager<>(conf);
- final int sleep = 10;
- final AtomicInteger done = new AtomicInteger();
- for (int i = 0; i < count; i++) {
- final Integer id = i;
- Daemon d1 = new Daemon(() -> {
- try {
- manager.writeLock(id);
- Thread.sleep(sleep);
- } catch (InterruptedException e) {
- e.printStackTrace();
- } finally {
- manager.writeUnlock(id);
- }
- done.getAndIncrement();
- });
- d1.setName("Locker-" + i);
- d1.start();
- }
- GenericTestUtils.waitFor(() -> done.get() == count, 100,
- 10 * count * sleep);
- assertEquals(count, done.get());
- }
-}
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/lock/package-info.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/lock/package-info.java
deleted file mode 100644
index cf4eb657f2..0000000000
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/lock/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-package org.apache.hadoop.ozone.lock;
-/*
- This package contains the lock related test classes.
- */
diff --git
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/upgrade/TestLayoutVersionInstanceFactory.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/upgrade/TestLayoutVersionInstanceFactory.java
index a40eecc62b..028a82b4fc 100644
---
a/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/upgrade/TestLayoutVersionInstanceFactory.java
+++
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/ozone/upgrade/TestLayoutVersionInstanceFactory.java
@@ -169,17 +169,12 @@ public class TestLayoutVersionInstanceFactory {
* Mock Interface.
*/
interface MockInterface {
- String mockMethod();
}
/**
* Mock Impl v1.
*/
static class MockClassV1 implements MockInterface {
- @Override
- public String mockMethod() {
- return getClass().getSimpleName();
- }
}
/**
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/NativeCRC32Wrapper.java
b/hadoop-hdds/common/src/test/java/org/apache/hadoop/util/NativeCRC32Wrapper.java
similarity index 100%
rename from
hadoop-hdds/common/src/main/java/org/apache/hadoop/util/NativeCRC32Wrapper.java
rename to
hadoop-hdds/common/src/test/java/org/apache/hadoop/util/NativeCRC32Wrapper.java
diff --git
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/profile/DefaultProfile.java
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/profile/DefaultProfile.java
index d565eedae4..765cf96e2f 100644
---
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/profile/DefaultProfile.java
+++
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/profile/DefaultProfile.java
@@ -46,7 +46,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static org.apache.hadoop.hdds.function.Predicates.yesBi;
import static org.bouncycastle.asn1.x509.KeyPurposeId.id_kp_clientAuth;
import static org.bouncycastle.asn1.x509.KeyPurposeId.id_kp_serverAuth;
@@ -61,9 +60,9 @@ public class DefaultProfile implements PKIProfile {
private static final BiPredicate<Extension, PKIProfile>
VALIDATE_KEY_USAGE = DefaultProfile::validateKeyUsage;
private static final BiPredicate<Extension, PKIProfile>
- VALIDATE_AUTHORITY_KEY_IDENTIFIER = yesBi();
- private static final BiPredicate<Extension, PKIProfile> VALIDATE_LOGO_TYPE =
- yesBi();
+ VALIDATE_AUTHORITY_KEY_IDENTIFIER = (t, u) -> true;
+ private static final BiPredicate<Extension, PKIProfile> VALIDATE_LOGO_TYPE
+ = (t, u) -> true;
private static final Logger LOG =
LoggerFactory.getLogger(DefaultProfile.class);
private static final BiPredicate<Extension, PKIProfile>
diff --git
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DefaultCertificateClient.java
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DefaultCertificateClient.java
index 403295aebf..09f27e46db 100644
---
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DefaultCertificateClient.java
+++
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/DefaultCertificateClient.java
@@ -487,7 +487,6 @@ public abstract class DefaultCertificateClient implements
CertificateClient {
* @param data - Data to sign.
* @throws CertificateException - on Error.
*/
- @Override
public byte[] signData(byte[] data) throws CertificateException {
try {
Signature sign = Signature.getInstance(securityConfig.getSignatureAlgo(),
@@ -582,7 +581,6 @@ public abstract class DefaultCertificateClient implements
CertificateClient {
* @param caType - Is CA certificate.
* @throws CertificateException - on Error.
*/
- @Override
public void storeCertificate(String pemEncodedCert,
CAType caType) throws CertificateException {
CertificateCodec certificateCodec = new CertificateCodec(securityConfig,
@@ -992,7 +990,6 @@ public abstract class DefaultCertificateClient implements
CertificateClient {
}
}
- @Override
public List<String> listCA() throws IOException {
pemEncodedCACertsLock.lock();
try {
@@ -1024,8 +1021,7 @@ public abstract class DefaultCertificateClient implements
CertificateClient {
public synchronized KeyStoresFactory getServerKeyStoresFactory()
throws CertificateException {
if (serverKeyStoresFactory == null) {
- serverKeyStoresFactory = SecurityUtil.getServerKeyStoresFactory(
- securityConfig, this, true);
+ serverKeyStoresFactory = SecurityUtil.getServerKeyStoresFactory(this,
true);
}
return serverKeyStoresFactory;
}
@@ -1034,8 +1030,7 @@ public abstract class DefaultCertificateClient implements
CertificateClient {
public KeyStoresFactory getClientKeyStoresFactory()
throws CertificateException {
if (clientKeyStoresFactory == null) {
- clientKeyStoresFactory = SecurityUtil.getClientKeyStoresFactory(
- securityConfig, this, true);
+ clientKeyStoresFactory = SecurityUtil.getClientKeyStoresFactory(this,
true);
}
return clientKeyStoresFactory;
}
diff --git
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/keys/SecurityUtil.java
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/keys/SecurityUtil.java
index 5f34e8dfe0..96fb2a7fd9 100644
---
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/keys/SecurityUtil.java
+++
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/keys/SecurityUtil.java
@@ -95,10 +95,10 @@ public final class SecurityUtil {
}
public static KeyStoresFactory getServerKeyStoresFactory(
- SecurityConfig securityConfig, CertificateClient client,
+ CertificateClient client,
boolean requireClientAuth) throws CertificateException {
PemFileBasedKeyStoresFactory factory =
- new PemFileBasedKeyStoresFactory(securityConfig, client);
+ new PemFileBasedKeyStoresFactory(client);
try {
factory.init(KeyStoresFactory.Mode.SERVER, requireClientAuth);
} catch (IOException | GeneralSecurityException e) {
@@ -109,10 +109,10 @@ public final class SecurityUtil {
}
public static KeyStoresFactory getClientKeyStoresFactory(
- SecurityConfig securityConfig, CertificateClient client,
+ CertificateClient client,
boolean requireClientAuth) throws CertificateException {
PemFileBasedKeyStoresFactory factory =
- new PemFileBasedKeyStoresFactory(securityConfig, client);
+ new PemFileBasedKeyStoresFactory(client);
try {
factory.init(KeyStoresFactory.Mode.CLIENT, requireClientAuth);
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/ssl/TestPemFileBasedKeyStoresFactory.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/ssl/TestPemFileBasedKeyStoresFactory.java
index 0034890a68..6efb93c93d 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/ssl/TestPemFileBasedKeyStoresFactory.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/ssl/TestPemFileBasedKeyStoresFactory.java
@@ -74,7 +74,7 @@ public class TestPemFileBasedKeyStoresFactory {
@ParameterizedTest
public void testInit(boolean clientAuth) throws Exception {
KeyStoresFactory keyStoresFactory = new PemFileBasedKeyStoresFactory(
- secConf, caClient);
+ caClient);
try {
keyStoresFactory.init(KeyStoresFactory.Mode.CLIENT, clientAuth);
assertEquals(clientAuth, keyStoresFactory.getKeyManagers()[0]
@@ -101,13 +101,13 @@ public class TestPemFileBasedKeyStoresFactory {
ManagedChannel channel = null;
try {
// create server
- serverFactory = new PemFileBasedKeyStoresFactory(secConf, caClient);
+ serverFactory = new PemFileBasedKeyStoresFactory(caClient);
serverFactory.init(KeyStoresFactory.Mode.SERVER, true);
server = setupServer(serverFactory);
server.start();
// create client
- clientFactory = new PemFileBasedKeyStoresFactory(secConf, caClient);
+ clientFactory = new PemFileBasedKeyStoresFactory(caClient);
clientFactory.init(KeyStoresFactory.Mode.CLIENT, true);
channel = setupClient(clientFactory, server.getPort());
XceiverClientProtocolServiceStub asyncStub =
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClientTestImpl.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClientTestImpl.java
index 66d6ef893d..c322aaf2a7 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClientTestImpl.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/client/CertificateClientTestImpl.java
@@ -48,7 +48,6 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.security.ssl.KeyStoresFactory;
import org.apache.hadoop.hdds.security.SecurityConfig;
-import org.apache.hadoop.hdds.security.x509.certificate.authority.CAType;
import
org.apache.hadoop.hdds.security.x509.certificate.authority.DefaultApprover;
import
org.apache.hadoop.hdds.security.x509.certificate.authority.profile.DefaultProfile;
import
org.apache.hadoop.hdds.security.x509.certificate.utils.CertificateSignRequest;
@@ -59,7 +58,6 @@ import
org.apache.hadoop.hdds.security.x509.keys.HDDSKeyGenerator;
import org.apache.hadoop.hdds.security.x509.keys.SecurityUtil;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
-import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_X509_DEFAULT_DURATION;
import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_X509_DEFAULT_DURATION_DEFAULT;
@@ -155,9 +153,9 @@ public class CertificateClientTestImpl implements
CertificateClient {
notificationReceivers = new HashSet<>();
serverKeyStoresFactory = SecurityUtil.getServerKeyStoresFactory(
- securityConfig, this, true);
+ this, true);
clientKeyStoresFactory = SecurityUtil.getClientKeyStoresFactory(
- securityConfig, this, true);
+ this, true);
if (autoRenew) {
Duration gracePeriod = securityConfig.getRenewalGracePeriod();
@@ -221,11 +219,6 @@ public class CertificateClientTestImpl implements
CertificateClient {
return rootCert;
}
- @Override
- public byte[] signData(byte[] data) throws CertificateException {
- return new byte[0];
- }
-
@Override
public boolean verifySignature(byte[] data, byte[] signature,
X509Certificate cert) throws CertificateException {
@@ -248,17 +241,6 @@ public class CertificateClientTestImpl implements
CertificateClient {
return new CertificateSignRequest.Builder();
}
- @Override
- public String signAndStoreCertificate(PKCS10CertificationRequest request)
- throws CertificateException {
- return null;
- }
-
- @Override
- public void storeCertificate(String cert, CAType caType)
- throws CertificateException {
- }
-
@Override
public void initWithRecovery() throws IOException {
}
@@ -288,11 +270,6 @@ public class CertificateClientTestImpl implements
CertificateClient {
return null;
}
- @Override
- public List<String> listCA() throws IOException {
- return null;
- }
-
@Override
public List<String> updateCAList() throws IOException {
return null;
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
index 3a94f3410d..7e55ea9cc4 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
@@ -199,7 +199,7 @@ public class TestOzoneContainer {
response = client.sendCommand(request);
int chunksCount = putBlockRequest.getPutBlock().getBlockData().
getChunksCount();
- ContainerTestHelper.verifyGetBlock(request, response, chunksCount);
+ ContainerTestHelper.verifyGetBlock(response, chunksCount);
// Delete Block and Delete Chunk are handled by BlockDeletingService
// ContainerCommandRequestProto DeleteBlock and DeleteChunk requests
@@ -367,7 +367,7 @@ public class TestOzoneContainer {
response = client.sendCommand(request);
int chunksCount = putBlockRequest.getPutBlock().getBlockData()
.getChunksCount();
- ContainerTestHelper.verifyGetBlock(request, response, chunksCount);
+ ContainerTestHelper.verifyGetBlock(response, chunksCount);
} finally {
if (client != null) {
client.close();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]