Debug: checkpoint RESTART

This commit is contained in:
M66B 2022-06-24 22:11:53 +02:00
parent fa2dbccf88
commit fe6686dda2
1 changed files with 4 additions and 2 deletions

View File

@ -2378,7 +2378,8 @@ public abstract class DB extends RoomDatabase {
long start = new Date().getTime();
StringBuilder sb = new StringBuilder();
SupportSQLiteDatabase sdb = db.getOpenHelper().getWritableDatabase();
try (Cursor cursor = sdb.query("PRAGMA wal_checkpoint(PASSIVE);")) {
String mode = (BuildConfig.DEBUG ? "RESTART" : "PASSIVE");
try (Cursor cursor = sdb.query("PRAGMA wal_checkpoint(" + mode + ");")) {
if (cursor.moveToNext()) {
for (int i = 0; i < cursor.getColumnCount(); i++) {
if (i > 0)
@ -2389,7 +2390,8 @@ public abstract class DB extends RoomDatabase {
}
long elapse = new Date().getTime() - start;
Log.i("PRAGMA wal_checkpoint=" + sb + " elapse=" + elapse);
EntityLog.log(context, EntityLog.Type.Debug,
"PRAGMA wal_checkpoint(" + mode + ")=" + sb + " elapse=" + elapse + " ms");
} catch (Throwable ex) {
Log.e(ex);
}