Skip to content

Commit ee96efb

Browse files
committed
Fixed the issue of the fluss-fs-s3 jar becoming too big due to Hadoop version upgrades.
Signed-off-by: Pei Yu <125331682@qq.com>
1 parent 864bbe6 commit ee96efb

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

fluss-filesystems/fluss-fs-s3/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@
233233
<groupId>org.slf4j</groupId>
234234
<artifactId>slf4j-reload4j</artifactId>
235235
</exclusion>
236+
<exclusion>
237+
<groupId>software.amazon.awssdk</groupId>
238+
<artifactId>bundle</artifactId>
239+
</exclusion>
236240
</exclusions>
237241
</dependency>
238242

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.fluss.fs.s3.exception;
19+
20+
/** Exception thrown when no credentials were found. */
21+
public class InvalidCredentialsException extends RuntimeException {
22+
23+
public static final String E_NO_AWS_CREDENTIALS = "No AWS Credentials";
24+
25+
public InvalidCredentialsException(String credentialProvider) {
26+
this(credentialProvider, null);
27+
}
28+
29+
public InvalidCredentialsException(String credentialProvider, Throwable throwable) {
30+
super(credentialProvider + ": " + E_NO_AWS_CREDENTIALS, throwable);
31+
}
32+
}

fluss-filesystems/fluss-fs-s3/src/main/java/org/apache/fluss/fs/s3/token/DynamicTemporaryAWSCredentialsProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
package org.apache.fluss.fs.s3.token;
1919

20+
import org.apache.fluss.fs.s3.exception.InvalidCredentialsException;
2021
import org.apache.fluss.fs.token.Credentials;
2122

2223
import com.amazonaws.auth.AWSCredentials;
2324
import com.amazonaws.auth.AWSCredentialsProvider;
2425
import com.amazonaws.auth.BasicSessionCredentials;
25-
import org.apache.hadoop.fs.s3a.auth.NoAwsCredentialsException;
2626
import org.slf4j.Logger;
2727
import org.slf4j.LoggerFactory;
2828

@@ -46,7 +46,7 @@ public AWSCredentials getCredentials() {
4646
Credentials credentials = S3DelegationTokenReceiver.getCredentials();
4747

4848
if (credentials == null) {
49-
throw new NoAwsCredentialsException(COMPONENT);
49+
throw new InvalidCredentialsException(COMPONENT);
5050
}
5151
LOG.debug("Providing session credentials");
5252
return new BasicSessionCredentials(

fluss-filesystems/fluss-fs-s3/src/main/java/org/apache/fluss/fs/s3/token/S3DelegationTokenReceiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
package org.apache.fluss.fs.s3.token;
1919

20+
import org.apache.fluss.fs.s3.exception.InvalidCredentialsException;
2021
import org.apache.fluss.fs.token.Credentials;
2122
import org.apache.fluss.fs.token.CredentialsJsonSerde;
2223
import org.apache.fluss.fs.token.ObtainedSecurityToken;
2324
import org.apache.fluss.fs.token.SecurityTokenReceiver;
2425

25-
import org.apache.hadoop.fs.s3a.auth.NoAwsCredentialsException;
2626
import org.slf4j.Logger;
2727
import org.slf4j.LoggerFactory;
2828

@@ -63,7 +63,7 @@ public static void updateHadoopConfig(org.apache.hadoop.conf.Configuration hadoo
6363
if (additionInfos == null) {
6464
// if addition info is null, it also means we have not received any token,
6565
// we throw InvalidCredentialsException
66-
throw new NoAwsCredentialsException(DynamicTemporaryAWSCredentialsProvider.COMPONENT);
66+
throw new InvalidCredentialsException(DynamicTemporaryAWSCredentialsProvider.COMPONENT);
6767
} else {
6868
for (Map.Entry<String, String> entry : additionInfos.entrySet()) {
6969
hadoopConfig.set(entry.getKey(), entry.getValue());

0 commit comments

Comments
 (0)