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

chore(sink): validate file sink when creating #18707

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Changes from 2 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
8 changes: 7 additions & 1 deletion src/connector/src/sink/file_sink/opendal_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ impl<S: OpendalSinkBackend> Sink for FileSink<S> {
"File sink only supports `PARQUET` encode at present."
)));
}
Ok(())

match self.op.list(&self.path).await {
lmatz marked this conversation as resolved.
Show resolved Hide resolved
Ok(_) => Ok(()),
Err(e) => Err(anyhow!(e)
.context("Fail to create sink, please check your config.")
.into()),
Copy link
Member

@xxchan xxchan Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit style improvement

Suggested change
match self.op.list(&self.path).await {
Ok(_) => Ok(()),
Err(e) => Err(anyhow!(e)
.context("Fail to create sink, please check your config.")
.into()),
_ = self.op.list(&self.path).await.with_context(|| format!("failed to list path: {}", self.path))

Besides, "Fail to create sink, please check your config." doesn't provide useful information to users. If we want to add this, it should be in upper layer, e.g., CREATE SINK handler, instead of here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fail to create sink, please check your config." doesn't provide useful information to users

The specific failure reason will be output below this line, so the user can get the specific information through the error.

Caused by these errors (recent errors listed first):
  1: gRPC request to meta service failed: Internal error
  2: failed to validate sink
  3: Fail to create sink, please check your config.
  4: PermissionDenied (persistent) at List::next, context: { uri: http://127.0.0.1:9301/hummock001?delimiter=%2F&list-type=2&prefix=test2, response: Parts { status: 403, version: HTTP/1.1, headers: {“connection”: “close”, “content-length”: “407", “accept-ranges”: “bytes”, “content-type”: “application/xml”, “date”: “Thu, 26 Sep 2024 06:17:52 GMT”, “server”: “MinIO”, “strict-transport-security”: “max-age=31536000; includeSubDomains”, “vary”: “Origin”, “vary”: “Accept-Encoding”, “x-amz-id-2”: “5e0466557790194f71acb9d44341f26b381bbf7ca42536c367b0a3b121df5c06", “x-amz-request-id”: “17F8B6D2A6E07AF0", “x-content-type-options”: “nosniff”, “x-xss-protection”: “1; mode=block”} }, service: s3, path: test2, listed: 0 } => S3Error { code: “SignatureDoesNotMatch”, message: “The request signature we calculated does not match the signature you provided. Check your key and signing method.“, resource: “/hummock001”, request_id: “17F8B6D2A6E07AF0" }

Copy link
Member

@xxchan xxchan Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean this sentence "3: Fail to create sink, please check your config" doesn't add any value.

Line 2 (general message) and line 4 (specific message) are useful. Line 3 are similar to line 2

So we should either remove line 3, or merge it into line 2.

}
}

async fn new_log_sinker(
Expand Down
Loading