diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java index f6be0f9e726..46972186576 100644 --- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java +++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java @@ -23,8 +23,7 @@ import org.apache.hadoop.hdds.scm.XceiverClientSpi; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; import org.apache.hadoop.hdds.scm.container.ContainerInfo; import org.apache.hadoop.hdds.scm.pipeline.Pipeline; -import org.apache.hadoop.hdds.scm.protocolPB - .StorageContainerLocationProtocolClientSideTranslatorPB; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; import org.apache.hadoop.hdds.scm.storage.ContainerProtocolCalls; import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos .ContainerDataProto; @@ -48,12 +47,12 @@ public class ContainerOperationClient implements ScmClient { private static final Logger LOG = LoggerFactory.getLogger(ContainerOperationClient.class); private static long containerSizeB = -1; - private final StorageContainerLocationProtocolClientSideTranslatorPB + private final StorageContainerLocationProtocol storageContainerLocationClient; private final XceiverClientManager xceiverClientManager; public ContainerOperationClient( - StorageContainerLocationProtocolClientSideTranslatorPB + StorageContainerLocationProtocol storageContainerLocationClient, XceiverClientManager xceiverClientManager) { this.storageContainerLocationClient = storageContainerLocationClient; diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientSpi.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientSpi.java index 0d4b3a4e9b9..aee2afd4ea1 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientSpi.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientSpi.java @@ -18,14 +18,6 @@ package org.apache.hadoop.hdds.scm; -import com.google.common.annotations.VisibleForTesting; -import org.apache.hadoop.hdds.scm.pipeline.Pipeline; -import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos - .ContainerCommandRequestProto; -import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos - .ContainerCommandResponseProto; -import org.apache.hadoop.hdds.protocol.proto.HddsProtos; - import java.io.Closeable; import java.io.IOException; import java.util.List; @@ -34,6 +26,13 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto; +import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandResponseProto; +import org.apache.hadoop.hdds.protocol.proto.HddsProtos; +import org.apache.hadoop.hdds.scm.pipeline.Pipeline; + +import com.google.common.annotations.VisibleForTesting; + /** * A Client for the storageContainer protocol. */ 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 e21bc531e58..4e85fbe0e07 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 @@ -26,6 +26,7 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.hdds.protocol.proto .StorageContainerLocationProtocolProtos.ObjectStageChangeRequestProto; +import java.io.Closeable; import java.io.IOException; import java.util.List; import org.apache.hadoop.security.KerberosInfo; @@ -35,7 +36,7 @@ import org.apache.hadoop.security.KerberosInfo; * that currently host a container. */ @KerberosInfo(serverPrincipal = ScmConfigKeys.HDDS_SCM_KERBEROS_PRINCIPAL_KEY) -public interface StorageContainerLocationProtocol { +public interface StorageContainerLocationProtocol extends Closeable { /** * Asks SCM where a container should be allocated. SCM responds with the * set of datanodes that should be used creating this container. diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java index 0cb22ad9a45..25ea3bc5293 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java @@ -552,4 +552,9 @@ public class SCMClientProtocolServer implements .withException(throwable) .build(); } + + @Override + public void close() throws IOException { + stop(); + } } diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SCMCLI.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SCMCLI.java index e385f309c0c..4e2b3841a1e 100644 --- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SCMCLI.java +++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SCMCLI.java @@ -37,9 +37,11 @@ import org.apache.hadoop.hdds.scm.cli.pipeline.ListPipelinesSubcommand; import org.apache.hadoop.hdds.scm.client.ContainerOperationClient; import org.apache.hadoop.hdds.scm.client.ScmClient; import org.apache.hadoop.hdds.scm.container.ContainerInfo; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; import org.apache.hadoop.hdds.scm.protocolPB .StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolPB; +import org.apache.hadoop.hdds.tracing.TracingUtil; import org.apache.hadoop.ipc.Client; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; @@ -134,12 +136,14 @@ public class SCMCLI extends GenericCli { RPC.setProtocolEngine(ozoneConf, StorageContainerLocationProtocolPB.class, ProtobufRpcEngine.class); - StorageContainerLocationProtocolClientSideTranslatorPB client = + StorageContainerLocationProtocol client = + TracingUtil.createProxy( new StorageContainerLocationProtocolClientSideTranslatorPB( RPC.getProxy(StorageContainerLocationProtocolPB.class, version, scmAddress, UserGroupInformation.getCurrentUser(), ozoneConf, NetUtils.getDefaultSocketFactory(ozoneConf), - Client.getRpcTimeout(ozoneConf))); + Client.getRpcTimeout(ozoneConf))), + StorageContainerLocationProtocol.class); return new ContainerOperationClient( client, new XceiverClientManager(ozoneConf)); } diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java index 59dd72b92f8..d8bfdbd127f 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java @@ -25,11 +25,11 @@ import org.apache.hadoop.hdds.client.BlockID; import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; import org.apache.hadoop.hdds.scm.pipeline.Pipeline; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; import org.apache.hadoop.ozone.om.helpers.OmKeyInfo; import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo; import org.apache.hadoop.hdds.scm.XceiverClientManager; import org.apache.hadoop.hdds.scm.XceiverClientSpi; -import org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.hdds.scm.storage.BlockInputStream; import org.apache.hadoop.hdds.scm.storage.ContainerProtocolCalls; import org.apache.hadoop.security.UserGroupInformation; @@ -263,7 +263,7 @@ public class KeyInputStream extends InputStream implements Seekable { public static LengthInputStream getFromOmKeyInfo( OmKeyInfo keyInfo, XceiverClientManager xceiverClientManager, - StorageContainerLocationProtocolClientSideTranslatorPB + StorageContainerLocationProtocol storageContainerLocationClient, String requestId, boolean verifyChecksum) throws IOException { long length = 0; diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java index d74a240a78d..3b0e51b4eba 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java @@ -26,16 +26,15 @@ import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerNotOpenException; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.om.helpers.*; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor; -import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB; +import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import org.apache.hadoop.hdds.scm.XceiverClientManager; import org.apache.hadoop.hdds.scm.container.common.helpers .StorageContainerException; -import org.apache.hadoop.hdds.scm.protocolPB - .StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.security.UserGroupInformation; import org.apache.ratis.protocol.AlreadyClosedException; import org.apache.ratis.protocol.RaftRetryFailureException; @@ -68,9 +67,8 @@ public class KeyOutputStream extends OutputStream { // array list's get(index) is O(1) private final ArrayList streamEntries; private int currentStreamIndex; - private final OzoneManagerProtocolClientSideTranslatorPB omClient; - private final - StorageContainerLocationProtocolClientSideTranslatorPB scmClient; + private final OzoneManagerProtocol omClient; + private final StorageContainerLocationProtocol scmClient; private final OmKeyArgs keyArgs; private final long openID; private final XceiverClientManager xceiverClientManager; @@ -144,8 +142,8 @@ public class KeyOutputStream extends OutputStream { @SuppressWarnings("parameternumber") public KeyOutputStream(OpenKeySession handler, XceiverClientManager xceiverClientManager, - StorageContainerLocationProtocolClientSideTranslatorPB scmClient, - OzoneManagerProtocolClientSideTranslatorPB omClient, int chunkSize, + StorageContainerLocationProtocol scmClient, + OzoneManagerProtocol omClient, int chunkSize, String requestId, ReplicationFactor factor, ReplicationType type, long bufferFlushSize, long bufferMaxSize, long size, long watchTimeout, ChecksumType checksumType, int bytesPerChecksum, @@ -572,8 +570,8 @@ public class KeyOutputStream extends OutputStream { public static class Builder { private OpenKeySession openHandler; private XceiverClientManager xceiverManager; - private StorageContainerLocationProtocolClientSideTranslatorPB scmClient; - private OzoneManagerProtocolClientSideTranslatorPB omClient; + private StorageContainerLocationProtocol scmClient; + private OzoneManagerProtocol omClient; private int chunkSize; private String requestID; private ReplicationType type; @@ -609,14 +607,13 @@ public class KeyOutputStream extends OutputStream { return this; } - public Builder setScmClient( - StorageContainerLocationProtocolClientSideTranslatorPB client) { + public Builder setScmClient(StorageContainerLocationProtocol client) { this.scmClient = client; return this; } public Builder setOmClient( - OzoneManagerProtocolClientSideTranslatorPB client) { + OzoneManagerProtocol client) { this.omClient = client; return this; } diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java index d203e54e879..0875046bda4 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java @@ -31,6 +31,8 @@ import org.apache.hadoop.hdds.protocol.StorageType; import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos .ChecksumType; import org.apache.hadoop.hdds.scm.client.HddsClientUtils; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; +import org.apache.hadoop.hdds.tracing.TracingUtil; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ipc.Client; import org.apache.hadoop.ipc.ProtobufRpcEngine; @@ -63,7 +65,7 @@ import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs; import org.apache.hadoop.ozone.om.helpers.OpenKeySession; import org.apache.hadoop.ozone.om.helpers.S3SecretValue; import org.apache.hadoop.ozone.om.helpers.ServiceInfo; -import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB; +import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolPB; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.ozone.OzoneAcl; @@ -103,11 +105,10 @@ public class RpcClient implements ClientProtocol { LoggerFactory.getLogger(RpcClient.class); private final OzoneConfiguration conf; - private final StorageContainerLocationProtocolClientSideTranslatorPB + private final StorageContainerLocationProtocol storageContainerLocationClient; private final OMProxyProvider omProxyProvider; - private final OzoneManagerProtocolClientSideTranslatorPB - ozoneManagerClient; + private final OzoneManagerProtocol ozoneManagerClient; private final XceiverClientManager xceiverClientManager; private final int chunkSize; private final ChecksumType checksumType; @@ -137,19 +138,24 @@ public class RpcClient implements ClientProtocol { RPC.setProtocolEngine(conf, OzoneManagerProtocolPB.class, ProtobufRpcEngine.class); this.omProxyProvider = new OMProxyProvider(conf, ugi); - this.ozoneManagerClient = this.omProxyProvider.getProxy(); + this.ozoneManagerClient = + TracingUtil.createProxy( + this.omProxyProvider.getProxy(), + OzoneManagerProtocol.class); long scmVersion = RPC.getProtocolVersion(StorageContainerLocationProtocolPB.class); InetSocketAddress scmAddress = getScmAddressForClient(); RPC.setProtocolEngine(conf, StorageContainerLocationProtocolPB.class, ProtobufRpcEngine.class); - this.storageContainerLocationClient = + + StorageContainerLocationProtocolClientSideTranslatorPB client = new StorageContainerLocationProtocolClientSideTranslatorPB( RPC.getProxy(StorageContainerLocationProtocolPB.class, scmVersion, scmAddress, ugi, conf, NetUtils.getDefaultSocketFactory(conf), Client.getRpcTimeout(conf))); - + this.storageContainerLocationClient = + TracingUtil.createProxy(client, StorageContainerLocationProtocol.class); this.xceiverClientManager = new XceiverClientManager(conf); int configuredChunkSize = (int) conf diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OzoneManagerProtocol.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OzoneManagerProtocol.java index df48586e7ec..2b9da1585e1 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OzoneManagerProtocol.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OzoneManagerProtocol.java @@ -34,6 +34,7 @@ import org.apache.hadoop.ozone.om.helpers.S3SecretValue; import org.apache.hadoop.ozone.om.helpers.ServiceInfo; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneAclInfo; +import java.io.Closeable; import java.io.IOException; import java.util.List; import org.apache.hadoop.security.KerberosInfo; @@ -43,7 +44,8 @@ import org.apache.hadoop.security.KerberosInfo; */ @KerberosInfo( serverPrincipal = OMConfigKeys.OZONE_OM_KERBEROS_PRINCIPAL_KEY) -public interface OzoneManagerProtocol extends OzoneManagerSecurityProtocol { +public interface OzoneManagerProtocol + extends OzoneManagerSecurityProtocol, Closeable { /** * Creates a volume. diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java index 70d3d603d83..9136d2b759f 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.ozone.om.protocolPB; -import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -112,8 +111,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; -import io.opentracing.Scope; -import io.opentracing.util.GlobalTracer; import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes; import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.TOKEN_ERROR_OTHER; import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.ACCESS_DENIED; @@ -127,7 +124,7 @@ import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos. @InterfaceAudience.Private public final class OzoneManagerProtocolClientSideTranslatorPB - implements OzoneManagerProtocol, ProtocolTranslator, Closeable { + implements OzoneManagerProtocol, ProtocolTranslator { /** * RpcController is not used and hence is set to null. @@ -194,9 +191,6 @@ public final class OzoneManagerProtocolClientSideTranslatorPB */ private OMResponse submitRequest(OMRequest omRequest) throws IOException { - Scope scope = - GlobalTracer.get().buildSpan(omRequest.getCmdType().name()) - .startActive(true); try { OMRequest payload = OMRequest.newBuilder(omRequest) .setTraceID(TracingUtil.exportCurrentSpan()) @@ -204,8 +198,6 @@ public final class OzoneManagerProtocolClientSideTranslatorPB return rpcProxy.submitRequest(NULL_RPC_CONTROLLER, payload); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); - } finally { - scope.close(); } } diff --git a/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java b/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java index c786bd04222..4963738701e 100644 --- a/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java +++ b/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java @@ -20,15 +20,18 @@ import com.sun.jersey.api.container.ContainerFactory; import com.sun.jersey.api.core.ApplicationAdapter; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolPB; import org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolPB; +import org.apache.hadoop.hdds.tracing.TracingUtil; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ipc.Client; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.net.NetUtils; +import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB; import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolPB; import org.apache.hadoop.ozone.web.ObjectStoreApplication; @@ -66,9 +69,8 @@ public final class ObjectStoreHandler implements Closeable { LoggerFactory.getLogger(ObjectStoreHandler.class); private final ObjectStoreJerseyContainer objectStoreJerseyContainer; - private final OzoneManagerProtocolClientSideTranslatorPB - ozoneManagerClient; - private final StorageContainerLocationProtocolClientSideTranslatorPB + private final OzoneManagerProtocol ozoneManagerClient; + private final StorageContainerLocationProtocol storageContainerLocationClient; private final ScmBlockLocationProtocolClientSideTranslatorPB scmBlockLocationClient; @@ -94,11 +96,14 @@ public final class ObjectStoreHandler implements Closeable { InetSocketAddress scmAddress = getScmAddressForClients(conf); this.storageContainerLocationClient = - new StorageContainerLocationProtocolClientSideTranslatorPB( - RPC.getProxy(StorageContainerLocationProtocolPB.class, scmVersion, - scmAddress, UserGroupInformation.getCurrentUser(), conf, - NetUtils.getDefaultSocketFactory(conf), - Client.getRpcTimeout(conf))); + TracingUtil.createProxy( + new StorageContainerLocationProtocolClientSideTranslatorPB( + RPC.getProxy(StorageContainerLocationProtocolPB.class, + scmVersion, + scmAddress, UserGroupInformation.getCurrentUser(), conf, + NetUtils.getDefaultSocketFactory(conf), + Client.getRpcTimeout(conf))), + StorageContainerLocationProtocol.class); InetSocketAddress scmBlockAddress = getScmAddressForBlockClients(conf); @@ -115,15 +120,18 @@ public final class ObjectStoreHandler implements Closeable { RPC.getProtocolVersion(OzoneManagerProtocolPB.class); InetSocketAddress omAddress = getOmAddress(conf); this.ozoneManagerClient = - new OzoneManagerProtocolClientSideTranslatorPB( - RPC.getProxy(OzoneManagerProtocolPB.class, omVersion, - omAddress, UserGroupInformation.getCurrentUser(), conf, - NetUtils.getDefaultSocketFactory(conf), - Client.getRpcTimeout(conf)), clientId.toString()); + TracingUtil.createProxy( + new OzoneManagerProtocolClientSideTranslatorPB( + RPC.getProxy(OzoneManagerProtocolPB.class, omVersion, + omAddress, UserGroupInformation.getCurrentUser(), conf, + NetUtils.getDefaultSocketFactory(conf), + Client.getRpcTimeout(conf)), clientId.toString()), + OzoneManagerProtocol.class); storageHandler = new DistributedStorageHandler( new OzoneConfiguration(conf), - this.storageContainerLocationClient, + TracingUtil.createProxy(storageContainerLocationClient, + StorageContainerLocationProtocol.class), this.ozoneManagerClient); ApplicationAdapter aa = new ApplicationAdapter(new ObjectStoreApplication()); diff --git a/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java b/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java index b1899d99807..f0f8a60470c 100644 --- a/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java +++ b/hadoop-ozone/objectstore-service/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java @@ -22,6 +22,7 @@ import com.google.common.base.Strings; import org.apache.hadoop.conf.StorageUnit; import org.apache.hadoop.hdds.client.ReplicationType; import org.apache.hadoop.hdds.scm.client.HddsClientUtils; +import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos @@ -35,7 +36,7 @@ import org.apache.hadoop.ozone.om.helpers.OmKeyArgs; import org.apache.hadoop.ozone.om.helpers.OmKeyInfo; import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs; import org.apache.hadoop.ozone.om.helpers.OpenKeySession; -import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB; +import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.OzoneConsts.Versioning; @@ -47,8 +48,6 @@ import org.apache.hadoop.ozone.OzoneAcl; import org.apache.hadoop.ozone.web.request.OzoneQuota; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdds.scm.XceiverClientManager; -import org.apache.hadoop.hdds.scm.protocolPB - .StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.ozone.client.rest.OzoneException; import org.apache.hadoop.ozone.web.handlers.BucketArgs; import org.apache.hadoop.ozone.web.handlers.KeyArgs; @@ -74,9 +73,9 @@ public final class DistributedStorageHandler implements StorageHandler { private static final Logger LOG = LoggerFactory.getLogger(DistributedStorageHandler.class); - private final StorageContainerLocationProtocolClientSideTranslatorPB + private final StorageContainerLocationProtocol storageContainerLocationClient; - private final OzoneManagerProtocolClientSideTranslatorPB + private final OzoneManagerProtocol ozoneManagerClient; private final XceiverClientManager xceiverClientManager; private final OzoneAcl.OzoneACLRights userRights; @@ -98,10 +97,8 @@ public final class DistributedStorageHandler implements StorageHandler { * @param ozoneManagerClient OzoneManager proxy */ public DistributedStorageHandler(OzoneConfiguration conf, - StorageContainerLocationProtocolClientSideTranslatorPB - storageContainerLocation, - OzoneManagerProtocolClientSideTranslatorPB - ozoneManagerClient) { + StorageContainerLocationProtocol storageContainerLocation, + OzoneManagerProtocol ozoneManagerClient) { this.ozoneManagerClient = ozoneManagerClient; this.storageContainerLocationClient = storageContainerLocation; this.xceiverClientManager = new XceiverClientManager(conf); diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java index 3061c960a9c..105cd98c142 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java @@ -512,6 +512,11 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl return ReflectionUtils.newInstance(clazz, conf); } + @Override + public void close() throws IOException { + stop(); + } + /** * Class which schedule saving metrics to a file. */ @@ -736,12 +741,14 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl RPC.getProtocolVersion(StorageContainerLocationProtocolPB.class); InetSocketAddress scmAddr = getScmAddressForClients( conf); - StorageContainerLocationProtocolClientSideTranslatorPB scmContainerClient = - new StorageContainerLocationProtocolClientSideTranslatorPB( + StorageContainerLocationProtocol scmContainerClient = + TracingUtil.createProxy( + new StorageContainerLocationProtocolClientSideTranslatorPB( RPC.getProxy(StorageContainerLocationProtocolPB.class, scmVersion, scmAddr, UserGroupInformation.getCurrentUser(), conf, NetUtils.getDefaultSocketFactory(conf), - Client.getRpcTimeout(conf))); + Client.getRpcTimeout(conf))), + StorageContainerLocationProtocol.class); return scmContainerClient; }