We do not have data corruption recovery #729

Open
yaronyg opened this Issue Jun 3, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@yaronyg
Member

yaronyg commented Jun 3, 2016

Before gliding pass this bug you may want to stop because this is going to happen.

So the PouchDB has done a bunch of work to make itself less likely to corrupt data but in certain app/phone crashing scenarios data can be corrupted. Imagine a phone running out of battery. Or the app getting into a bad state. If the wrong thing happens at the wrong time then the data on disk will be corrupted. If we are very lucky we will just lose some data. If we are not so lucky the DB will become corrupted and we will be done.

So this brings up several problems we haven't come close to addressing:

  1. How do we detect when we have a corrupt db? My guess is that right now the app would just die horribly. Not a great user experience.
  2. How do we recover from a corrupt db? I suppose we could tell the user to uninstall and re-install the app, not much fun there.
  3. How do we deal with peers who don't know our db has lost some state or is totally corrupted? This is a really fun one to recover from. If we have just lost some data then our peers think we are farther ahead in the sequence of items than we are and we have no way to recover that lost data. Even better, the sequence ID we have recorded in the remote DB as being our last update point will, in fact, be wrong, so we will NEVER get those records back. Can you feel the joy?

@yaronyg yaronyg added this to the New Infra milestone Jun 3, 2016

@yaronyg yaronyg removed this from the New Infra milestone Jul 11, 2016

@yaronyg yaronyg added Node PouchDB and removed 0 - Icebox labels Oct 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment