Search in sources :

Example 1 with SCMSecurityProtocolFailoverProxyProvider

use of org.apache.hadoop.hdds.scm.proxy.SCMSecurityProtocolFailoverProxyProvider in project ozone by apache.

the class HddsServerUtil method getScmSecurityClientWithFixedDuration.

public static SCMSecurityProtocolClientSideTranslatorPB getScmSecurityClientWithFixedDuration(OzoneConfiguration conf) throws IOException {
    // As for OM during init, we need to wait for specific duration so that
    // we can give response to user performed operation init in a definite
    // period, instead of stuck for ever.
    OzoneConfiguration configuration = new OzoneConfiguration(conf);
    long duration = conf.getTimeDuration(OZONE_SCM_INFO_WAIT_DURATION, OZONE_SCM_INFO_WAIT_DURATION_DEFAULT, TimeUnit.SECONDS);
    SCMClientConfig scmClientConfig = conf.getObject(SCMClientConfig.class);
    int retryCount = (int) (duration / (scmClientConfig.getRetryInterval() / 1000));
    // retry count.
    if (retryCount > scmClientConfig.getRetryCount()) {
        scmClientConfig.setRetryCount(retryCount);
        configuration.setFromObject(scmClientConfig);
    }
    return new SCMSecurityProtocolClientSideTranslatorPB(new SCMSecurityProtocolFailoverProxyProvider(configuration, UserGroupInformation.getCurrentUser()));
}
Also used : SCMClientConfig(org.apache.hadoop.hdds.scm.proxy.SCMClientConfig) SCMSecurityProtocolClientSideTranslatorPB(org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB) SCMSecurityProtocolFailoverProxyProvider(org.apache.hadoop.hdds.scm.proxy.SCMSecurityProtocolFailoverProxyProvider) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) DBCheckpoint(org.apache.hadoop.hdds.utils.db.DBCheckpoint)

Example 2 with SCMSecurityProtocolFailoverProxyProvider

use of org.apache.hadoop.hdds.scm.proxy.SCMSecurityProtocolFailoverProxyProvider in project ozone by apache.

the class HddsServerUtil method getScmSecurityClientWithMaxRetry.

public static SCMSecurityProtocolClientSideTranslatorPB getScmSecurityClientWithMaxRetry(OzoneConfiguration conf) throws IOException {
    // Certificate from SCM is required for DN startup to succeed, so retry
    // for ever. In this way DN start up is resilient to SCM service running
    // status.
    OzoneConfiguration configuration = new OzoneConfiguration(conf);
    SCMClientConfig scmClientConfig = conf.getObject(SCMClientConfig.class);
    int retryCount = Integer.MAX_VALUE;
    scmClientConfig.setRetryCount(retryCount);
    configuration.setFromObject(scmClientConfig);
    return new SCMSecurityProtocolClientSideTranslatorPB(new SCMSecurityProtocolFailoverProxyProvider(configuration, UserGroupInformation.getCurrentUser()));
}
Also used : SCMClientConfig(org.apache.hadoop.hdds.scm.proxy.SCMClientConfig) SCMSecurityProtocolClientSideTranslatorPB(org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB) SCMSecurityProtocolFailoverProxyProvider(org.apache.hadoop.hdds.scm.proxy.SCMSecurityProtocolFailoverProxyProvider) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) DBCheckpoint(org.apache.hadoop.hdds.utils.db.DBCheckpoint)

Aggregations

OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)2 SCMSecurityProtocolClientSideTranslatorPB (org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB)2 SCMClientConfig (org.apache.hadoop.hdds.scm.proxy.SCMClientConfig)2 SCMSecurityProtocolFailoverProxyProvider (org.apache.hadoop.hdds.scm.proxy.SCMSecurityProtocolFailoverProxyProvider)2 DBCheckpoint (org.apache.hadoop.hdds.utils.db.DBCheckpoint)2