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

fix(sink): fix mogodb write error handling #19869

Merged
merged 3 commits into from
Dec 24, 2024
Merged

Conversation

xxhZs
Copy link
Contributor

@xxhZs xxhZs commented Dec 20, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

in doc https://www.mongodb.com/zh-cn/docs/manual/reference/method/db.collection.bulkWrite/#mongodb-method-db.collection.bulkWrite
The correct error is writeErrors and writeConcernErrors
And you shouldn't use n to check if the write was successful, because there are times when n will be 0.
Let's say we delete a piece of mongodb non-existent data

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • My PR contains critical fixes that are necessary to be merged into the latest release.

Documentation

  • My PR needs documentation updates.
Release note

@github-actions github-actions bot added the type/fix Bug fix label Dec 20, 2024
@xxhZs xxhZs requested a review from hzxa21 December 20, 2024 02:56
@ly9chee
Copy link
Contributor

ly9chee commented Dec 20, 2024

And you shouldn't use n to check if the write was successful, because there are times when n will be 0.
Let's say we delete a piece of mongodb non-existent data

The initial implementation checks n > 0 becase we assumes ownership of the sinking collection. There should not be a case where n == 0, unless the user manually modified the collection.

Should we also check the ok status? Then we can expect the command is succeeded and without any write errors.
https://www.mongodb.com/docs/manual/reference/command/delete/#output

@xxhZs
Copy link
Contributor Author

xxhZs commented Dec 20, 2024

And you shouldn't use n to check if the write was successful, because there are times when n will be 0.
Let's say we delete a piece of mongodb non-existent data

The initial implementation checks n > 0 becase we assumes ownership of the sinking collection. There should not be a case where n == 0, unless the user manually modified the collection.

Should we also check the ok status? Then we can expect the command is succeeded and without any write errors. https://www.mongodb.com/docs/manual/reference/command/delete/#output

add ok, Please review if you have time, thanks!

@ly9chee
Copy link
Contributor

ly9chee commented Dec 20, 2024

And you shouldn't use n to check if the write was successful, because there are times when n will be 0.
Let's say we delete a piece of mongodb non-existent data

The initial implementation checks n > 0 becase we assumes ownership of the sinking collection. There should not be a case where n == 0, unless the user manually modified the collection.
Should we also check the ok status? Then we can expect the command is succeeded and without any write errors. https://www.mongodb.com/docs/manual/reference/command/delete/#output

add ok, Please review if you have time, thanks!

LGTM!

@xxhZs xxhZs requested review from chenzl25 and Li0k December 24, 2024 02:24
@xxhZs xxhZs added this pull request to the merge queue Dec 24, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 24, 2024
@xxhZs xxhZs added this pull request to the merge queue Dec 24, 2024
Merged via the queue into main with commit 1b9b5a7 Dec 24, 2024
28 of 29 checks passed
@xxhZs xxhZs deleted the xxh/fix-mongodb-sink-error branch December 24, 2024 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants