Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(s3stream): show s3 configure in DefaultS3Operator; add S3Utils #840

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.automq.stream.utils.ThreadUtils;
import com.automq.stream.utils.Threads;
import com.automq.stream.utils.Utils;
import com.automq.stream.utils.S3Utils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;
Expand Down Expand Up @@ -121,8 +122,16 @@ public DefaultS3Operator(String endpoint, String region, String bucket, boolean
this.bucket = bucket;
scheduler.scheduleWithFixedDelay(this::tryMergeRead, 1, 1, TimeUnit.MILLISECONDS);
checkConfig();
S3Utils.S3Context s3Context = S3Utils.S3Context.builder()
.setEndpoint(endpoint)
.setRegion(region)
.setBucketName(bucket)
.setForcePathStyle(forcePathStyle)
.setAccessKey(accessKey)
.setSecretKey(secretKey)
.build();
LOGGER.info("You are using s3Context: {}", s3Context);
checkAvailable();
LOGGER.info("S3Operator init with endpoint={} region={} bucket={}, read data sparsity rate={}", endpoint, region, bucket, this.maxMergeReadSparsityRate);
}

public static Builder builder() {
Expand Down Expand Up @@ -585,8 +594,8 @@ private void checkAvailable() {
read.release();
this.delete(multipartPath).get(30, TimeUnit.SECONDS);
} catch (Throwable e) {
LOGGER.error("Try connect s3 fail, please re-check the server configs", e);
throw new IllegalArgumentException("Try connect s3 fail, please re-check the server configs", e);
LOGGER.error("Try to write/read/delete object to S3 fail ", e);
throw new RuntimeException("Try connect s3 fail, please re-check the server configs", e);
}
}

Expand Down
Loading
Loading