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

Hard-DELETE invalid client records from the server #1801

Closed
linabutler opened this issue Sep 17, 2019 · 5 comments
Closed

Hard-DELETE invalid client records from the server #1801

linabutler opened this issue Sep 17, 2019 · 5 comments
Labels
good-first-issue Good for newcomers

Comments

@linabutler
Copy link
Contributor

linabutler commented Sep 17, 2019

The clients engine will currently fail the sync if it sees a tombstone in the clients collection, or any client record that it can't deserialize. Desktop DELETES these from the server if it sees them, and we should do the same.

┆Issue is synchronized with this Jira Task
┆Epic: Sync Ecosystem (backlog)

linabutler added a commit that referenced this issue Sep 17, 2019
@rfk
Copy link
Contributor

rfk commented Mar 18, 2020

This sounds like it could potentially be a good-first-issue, so attempting to summarize my understanding of the task. @linacambridge please correct me if I've misunderstood :-)

The clients sync engine has some code here which tries to read a ClientRecord from an item pulled down from the server, which will currently error out if the item can't be turned into a valid ClientRecord:

Rather than returning an error here, we should catch it and delete the corresponding item from the server.

However, I couldn't see a nice existing abstraction for hard-deleting items from the server, and the Driver::sync method above doesn't have enough info to make the deletion calls inline when it discovers the invalid records. Strawman proposal for what to do instead:

  • Add a deleted field to OutgoingChangeset in components/support/sync15-traits/src/changeset.rs, alongside the existing changes field. This would be a list of BSO ids to delete from the server, rather than a list of new/modified objects to upload.
  • Teach the CollectionUpdate struct in components/sync15/src/changeset.rs how to do deletions as well as posting updates.
  • Have the clients engine linked above, append the ids of any invalid records to the list of things to be deleted.

@linacambridge what do you think?

@mhammond
Copy link
Member

Client records have a ttl, and I believe the spanner server is going to honor them as we expect. While the approach above does seem fine in general, it's a fair bit of work for something that's going to self-destruct anyway - so another option here is probably to just ignore them?

@JN3141
Copy link
Contributor

JN3141 commented Sep 11, 2021

Hi, I was interested in trying this as a first issue, though see there's a bunch of back and forth above about what the implementation should be like. Did we want to actually just drop the record, or implement something more in-line with what @linacambridge and @rfk suggested?

@mhammond
Copy link
Member

I suspect doing the hard delete will be a fair bit of work and in practice has limited value. I think the best thing is to simply ignore such invalid records but otherwise leave them alone.

@mhammond
Copy link
Member

mhammond commented Oct 3, 2021

Fixed by #4504

@mhammond mhammond closed this as completed Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants