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(core): add if_not_exist in OpWrite #5305

Merged
merged 5 commits into from
Nov 12, 2024
Merged

Conversation

kemingy
Copy link
Contributor

@kemingy kemingy commented Nov 10, 2024

Which issue does this PR close?

Closes #5286.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

Add op.write_with(path, bs).if_not_exists(true)

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thank you @kemingy for working on this.

core/src/raw/ops.rs Outdated Show resolved Hide resolved
@@ -1254,6 +1254,25 @@ impl Operator {
/// # }
/// ```
///
/// ## `if_not_exist`
///
/// Set `if_not_exist` for this `write` request. This can be treated as a simplified version
Copy link
Member

Choose a reason for hiding this comment

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

Hi, if_not_exist is not the same feature as if_none_match. For example, S3 only supports if_not_exist but not if_none_match. We should eliminate use cases like if_none_match("*") to clarify this.

All existing tests and docs should replace by if_not_exist instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with the current usage of if_none_match. I can find it in op read/stat/write.

  1. Should we keep the tests since we still allow users to use this option?
  2. Do you mean that we should delete the if_none_match from the write-op-related docs?

Copy link
Member

Choose a reason for hiding this comment

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

  1. Should we keep the tests since we still allow users to use this option?

The tests using if_none_match("*") should be removed since we can't guarantee that all services will support this.

  1. Do you mean that we should delete the if_none_match from the write-op-related docs?

We can retain this docs, but we need to remove the if_none_match("*") example. Instead, we should use an etag to clarify that we are accepting an etag.

core/src/types/operator/operator.rs Show resolved Hide resolved
Signed-off-by: Keming <[email protected]>
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thank you, mostly looks good to me now!

core/src/services/s3/backend.rs Outdated Show resolved Hide resolved
core/src/services/s3/core.rs Outdated Show resolved Hide resolved
core/src/types/operator/operator.rs Show resolved Hide resolved
Signed-off-by: Keming <[email protected]>
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thank you @kemingy for working on this, really great!

@Xuanwo Xuanwo merged commit de198cd into apache:main Nov 12, 2024
238 checks passed
@kemingy kemingy deleted the if_not_exist branch November 12, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add if_not_exists in OpWrite to make behavior more clear
2 participants