-
Notifications
You must be signed in to change notification settings - Fork 591
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
base: main
Are you sure you want to change the base?
Conversation
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. |
add ok, Please review if you have time, thanks! |
) | ||
})?; | ||
if n < 1 { | ||
if let Ok(write_concern_error) = result.get_array("writeConcernError") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the MongoDB documentation, the field name should be writeConcernErrors
(plural) rather than writeConcernError
. This mismatch will prevent proper error detection.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
LGTM! |
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
andwriteConcernErrors
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
Documentation
Release note