fapifta commented on a change in pull request #95: HDDS-2373 Move isUseRatis getFactor and getType from XCeiverClientManager URL: https://github.com/apache/hadoop-ozone/pull/95#discussion_r339914849
########## File path: hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java ########## @@ -32,60 +39,108 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.hdds.protocol.proto .StorageContainerLocationProtocolProtos.ObjectStageChangeRequestProto; +import org.apache.hadoop.hdds.security.x509.SecurityConfig; +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; +import org.apache.hadoop.net.NetUtils; +import org.apache.hadoop.ozone.OzoneSecurityUtil; +import org.apache.hadoop.security.UserGroupInformation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.net.SocketFactory; import java.io.IOException; +import java.net.InetSocketAddress; import java.util.List; +import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForClients; +import static org.apache.hadoop.hdds.HddsUtils.getScmSecurityClient; +import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_CONTAINER_SIZE; +import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_CONTAINER_SIZE_DEFAULT; + /** * This class provides the client-facing APIs of container operations. */ public class ContainerOperationClient implements ScmClient { private static final Logger LOG = LoggerFactory.getLogger(ContainerOperationClient.class); - private static long containerSizeB = -1; + private final long containerSizeB; + private final HddsProtos.ReplicationFactor replicationFactor; + private final HddsProtos.ReplicationType replicationType; private final StorageContainerLocationProtocol storageContainerLocationClient; private final XceiverClientManager xceiverClientManager; - public ContainerOperationClient( - StorageContainerLocationProtocol - storageContainerLocationClient, - XceiverClientManager xceiverClientManager) { - this.storageContainerLocationClient = storageContainerLocationClient; - this.xceiverClientManager = xceiverClientManager; + public ContainerOperationClient(Configuration conf) throws IOException { + storageContainerLocationClient = newContainerRpcClient(conf); + xceiverClientManager = newXCeiverClientManager(conf); + containerSizeB = (int) conf.getStorageSize(OZONE_SCM_CONTAINER_SIZE, + OZONE_SCM_CONTAINER_SIZE_DEFAULT, StorageUnit.BYTES); + boolean useRatis = conf.getBoolean( + ScmConfigKeys.DFS_CONTAINER_RATIS_ENABLED_KEY, Review comment: I am unsure whether we still need STANDALONE for replication factor one, but as the aim here is to refactor the code I would not change this in this functionality at the moment. To remove STANDALONE and make this logic simpler I would suggest to have a new JIRA to track it separately. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org