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

bug: add secondary_write for channels #597

Merged
merged 21 commits into from
Feb 13, 2024
Merged

Conversation

jrconlin
Copy link
Member

@jrconlin jrconlin commented Feb 1, 2024

  • also set the default write_to_secondary to true

Closes SYNC-4121

@jrconlin jrconlin requested a review from pjenvey February 1, 2024 23:53
@jrconlin
Copy link
Member Author

jrconlin commented Feb 1, 2024

There are a few extra debug and trace bits in there to help me identify a problem with my local testing.

@jrconlin jrconlin changed the title Bug/sync 4121 secondary bug: add secondary_write for channels Feb 1, 2024
Copy link
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

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

couple things:

  • save_message and save_messages are missing the metrics on ignoring the secondary error
  • another thing we should fix while we're in here: get_channels has an inaccurate comment about having to copy over channels, this is probably from before we added the add_channels copying in get_user. Also I would argue that it's unique in that it doesn't need to check secondary at all, ever? So it would probably make sense to remove that block entirely? (It certainly shouldn't need to check secondary when channels.is_empty() I would more strongly argue)

autopush-common/src/db/dual/mod.rs Outdated Show resolved Hide resolved
autopush-common/src/db/dual/mod.rs Outdated Show resolved Hide resolved
autopush-common/src/db/dual/mod.rs Outdated Show resolved Hide resolved
@pjenvey
Copy link
Member

pjenvey commented Feb 8, 2024

  • another thing we should fix while we're in here: get_channels has an inaccurate comment about having to copy over channels, this is probably from before we added the add_channels copying in get_user. Also I would argue that it's unique in that it doesn't need to check secondary at all, ever? So it would probably make sense to remove that block entirely? (It certainly shouldn't need to check secondary when channels.is_empty() I would more strongly argue)

though I suppose we could always have an edge case where node A migrates the user record, then node B reads it and the channels from bigtable before node A migrates the channels.. (even though bigtable keeps it all in the same row we write it separately)

@jrconlin
Copy link
Member Author

jrconlin commented Feb 9, 2024

* save_message and save_messages are missing the metrics on ignoring the secondary error

Both of those return DbResult<()> so we're passing the errors up. I figured we don't need to capture metrics for those because we're not eating the errors.
We are eating the Ok, but then it's just returning () anyway.

@jrconlin
Copy link
Member Author

jrconlin commented Feb 9, 2024

though I suppose we could always have an edge case where node A migrates the user record, then node B reads it and the channels from bigtable before node A migrates the channels..

That comment and the code pre-date your change to the channels, so it's fair to just drop it. I think the edge case is fairly minor and at worst would result in the client rebuilding it's list (if it's mobile, at least). We might also hit an equally edge case of an endpoint fetching the User Record and not finding a channel, then returning a 404 response, but that may also be temporary since we know providers don't generally pay attention to return codes.

@jrconlin jrconlin requested a review from pjenvey February 9, 2024 20:58
@pjenvey
Copy link
Member

pjenvey commented Feb 13, 2024

Both of those return DbResult<()> so we're passing the errors up. I figured we don't need to capture metrics for those because we're not eating the errors.
We are eating the Ok, but then it's just returning () anyway.

ah, my mistake 👍

@jrconlin jrconlin merged commit 37b377a into master Feb 13, 2024
1 check passed
@jrconlin jrconlin deleted the bug/SYNC-4121_secondary branch February 13, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants