arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

Feature request: Buttons to reset the database or scan for corruption #35

Open KyleMaas opened 3 years ago

KyleMaas commented 3 years ago

As many times as I've managed to corrupt my local database, it would be awfully nice if there was a button I could click to scan the database and fix problems and/or a button to reset the database to clear it of anything it has synced from anywhere else leaving only my local messages, since I suspect most of the corruption I'm experiencing is due to refreshing partway through a write to the database while syncing from the pub.

KyleMaas commented 3 years ago

This would still be quite a handy thing. Would going offline, using removeDB, removeIndexes, and removeBlobs, and then going back online be a suitable way to do this? Is there any other state (EBT, etc.) that would be needed to support this?

arj03 commented 3 years ago

Sounds about right. I think you also need to remove some EBT state and I'm not sure if the removeIndexes still work.

KyleMaas commented 3 years ago

Looks like EBT might be able to be reset via onClose() (which is triggered when going offline anyway), a database clear, and then updateClock().

KyleMaas commented 3 years ago

This is somewhat blocked because (been a while, so I'm going from memory from several months ago now) some of the reset functions essentially did nothing. I'm thinking removeDB() was the main issue. See https://github.com/ssb-ngi-pointer/ssb-db2/issues/198