syncstorage-rs icon indicating copy to clipboard operation
syncstorage-rs copied to clipboard

one_or_none produces errors on one column results

Open data-sync-user opened this issue 2 years ago • 1 comments

The one_or_none method occasionally emits errors on SQL that can only produce at most one result.

Seeing this occur from update_user_collection_quotas, get_storage_timestamp and lock_for_write_async

https://sentry.io/organizations/mozilla/issues/3517020595/?environment=prod&project=6316464&query=is%3Aunresolved

https://sentry.io/organizations/mozilla/issues/3514687669/?environment=prod&project=6316464&query=is%3Aunresolved

https://sentry.io/organizations/mozilla/issues/3516548273/?environment=prod&project=6316464&query=is%3Aunresolved

I believe the issue here is a bug in one_or_none: it doesn’t notice its second call to next_async could potentially be an Error. It should always propagate errors from next_async before validating its result (always call next_async().transpose()?).

This was easy to miss because next_async returns Option<Result> (vs Result<Option>) to match poll_next (which it may rewritten into at some point).

┆Issue is synchronized with this Jira Task

data-sync-user avatar Aug 23 '22 19:08 data-sync-user

The JIRA sync mistakenly closed this

pjenvey avatar Oct 18 '23 22:10 pjenvey