Skip to content

Commit

Permalink
alignment to inner version 8.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vintmd committed Jan 20, 2022
1 parent 63b20f1 commit cc3ff57
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.qcloud.cos</groupId>
<artifactId>hadoop-cos</artifactId>
<version>8.0.1</version>
<version>8.0.2</version>
<packaging>jar</packaging>

<name>Apache Hadoop Tencent Qcloud COS Support</name>
Expand Down Expand Up @@ -41,7 +41,7 @@
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<hadoop.version>3.3.0</hadoop.version>
<cos_api.version>5.6.62</cos_api.version>
<cos_api.version>5.6.65</cos_api.version>
<google.guava.version>24.1.1-jre</google.guava.version>
<commons_lang3.version>3.1</commons_lang3.version>
<junit.version>4.8</junit.version>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@InterfaceStability.Unstable
public class CosNConfigKeys extends CommonConfigurationKeys {
public static final String USER_AGENT = "fs.cosn.user.agent";
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.0.1";
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.0.2";

public static final String TENCENT_EMR_VERSION_KEY = "fs.emr.version";

Expand Down Expand Up @@ -125,4 +125,8 @@ public class CosNConfigKeys extends CommonConfigurationKeys {
"org.apache.hadoop.fs.cosn.ranger.client.RangerQcloudObjectStorageClientImpl";
public static final String COSN_CLIENT_SOCKET_TIMEOUTSEC = "fs.cosn.client.socket.timeoutsec";
public static final int DEFAULT_CLIENT_SOCKET_TIMEOUTSEC = 30;

// default disable emr v2 instance url.
public static final String COSN_EMRV2_INSTANCE_PROVIDER_ENABLED = "fs.cosn.emrv2.instance.provider.enabled";
public static final boolean DEFAULT_COSN_EMRV2_INSTANCE_PROVIDER_ENABLED = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,24 @@ public class EMRInstanceCredentialsProvider extends AbstractCOSCredentialProvide

private String appId;
private final COSCredentialsProvider cosCredentialsProvider;
private boolean emrV2InstanceEnabled;

public EMRInstanceCredentialsProvider(@Nullable URI uri, Configuration conf) {
super(uri, conf);
if (null != conf) {
this.appId = conf.get(CosNConfigKeys.COSN_APPID_KEY);
this.emrV2InstanceEnabled = conf.getBoolean(CosNConfigKeys.COSN_EMRV2_INSTANCE_PROVIDER_ENABLED,
CosNConfigKeys.DEFAULT_COSN_EMRV2_INSTANCE_PROVIDER_ENABLED);
}

InstanceMetadataCredentialsEndpointProvider endpointProvider;
if (emrV2InstanceEnabled) {
endpointProvider = new InstanceMetadataCredentialsEndpointProvider(
InstanceMetadataCredentialsEndpointProvider.Instance.EMRV2);
} else {
endpointProvider = new InstanceMetadataCredentialsEndpointProvider(
InstanceMetadataCredentialsEndpointProvider.Instance.EMR);
}
InstanceMetadataCredentialsEndpointProvider endpointProvider =
new InstanceMetadataCredentialsEndpointProvider(
InstanceMetadataCredentialsEndpointProvider.Instance.EMR);
InstanceCredentialsFetcher instanceCredentialsFetcher = new InstanceCredentialsFetcher(endpointProvider);
this.cosCredentialsProvider = new InstanceCredentialsProvider(instanceCredentialsFetcher);
}
Expand Down

0 comments on commit cc3ff57

Please sign in to comment.