diff --git a/pom.xml b/pom.xml
index 728cfd86..19d28250 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.qcloud.cos
hadoop-cos
- 8.0.1
+ 8.0.2
jar
Apache Hadoop Tencent Qcloud COS Support
@@ -41,7 +41,7 @@
1.7
1.7
3.3.0
- 5.6.62
+ 5.6.65
24.1.1-jre
3.1
4.8
diff --git a/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java b/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
index 7b3d4ae2..1a7c09d2 100644
--- a/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
+++ b/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
@@ -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";
@@ -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;
}
diff --git a/src/main/java/org/apache/hadoop/fs/auth/EMRInstanceCredentialsProvider.java b/src/main/java/org/apache/hadoop/fs/auth/EMRInstanceCredentialsProvider.java
index 51ee16af..54e6903a 100644
--- a/src/main/java/org/apache/hadoop/fs/auth/EMRInstanceCredentialsProvider.java
+++ b/src/main/java/org/apache/hadoop/fs/auth/EMRInstanceCredentialsProvider.java
@@ -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);
}