SnappyDB icon indicating copy to clipboard operation
SnappyDB copied to clipboard

Weird exception

Open jophde opened this issue 10 years ago • 2 comments

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)

jophde avatar Jan 30 '15 01:01 jophde

Try clearing your app data in the AVD, or try uninstalling and reinstalling.

LouisCAD avatar Jul 06 '15 12:07 LouisCAD

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");
}

halfvector avatar Sep 29 '15 17:09 halfvector