SnappyDB
SnappyDB copied to clipboard
Weird exception
Getting this weird exception after restarting my AVD that was running tests.
Caused by: com.snappydb.SnappydbException: Failed to open/create database: Corruption: no meta-nextfile entry in descriptor at com.snappydb.internal.DBImpl.__open(Native Method) at com.snappydb.internal.DBImpl.<init>(DBImpl.java:53) at com.snappydb.DBFactory.open(DBFactory.java:40) at com.snappydb.SnappyDB$Builder.build(SnappyDB.java:95)
Try clearing your app data in the AVD, or try uninstalling and reinstalling.
Same problem here. This is a show stopper. Need an option to destroy the corrupted database and recreate it.
Proposal 1: forceful open that always succeeds (automatic lossy recovery)
DbState state = DBFactory.openOrCreate(context, "dbname");
if(state == DbState.Opened) // ...
if(state == DbState.Created) // ...
Proposal 2: a helper method (manual lossy recovery)
DBFactory.destroy(context, "dbname")
To be used like this:
try {
DBFactory.open(context, "mystore");
}
catch(SnappydbException error) {
DBFactory.destroy(context, "mystore");
DBFactory.open(context, "mystore");
}