mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Make FTS recovery more resiliant.
This commit is contained in:
committed by
Cody Henthorne
parent
5c6644d1a1
commit
850515b363
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.database.sqlite.SQLiteDatabaseCorruptException;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -40,7 +41,7 @@ public class SignalUncaughtExceptionHandler implements Thread.UncaughtExceptionH
|
||||
}
|
||||
|
||||
if (e instanceof SQLiteDatabaseCorruptException) {
|
||||
if (e.getMessage().indexOf("message_fts") >= 0) {
|
||||
if (e.getMessage() != null && e.getMessage().contains("message_fts")) {
|
||||
Log.w(TAG, "FTS corrupted! Resetting FTS index.");
|
||||
SignalDatabase.messageSearch().fullyResetTables();
|
||||
} else {
|
||||
@@ -48,6 +49,16 @@ public class SignalUncaughtExceptionHandler implements Thread.UncaughtExceptionH
|
||||
}
|
||||
}
|
||||
|
||||
if (e instanceof SQLiteException && e.getMessage() != null) {
|
||||
if (e.getMessage().contains("invalid fts5 file format")) {
|
||||
Log.w(TAG, "FTS in invalid state! Resetting FTS index.");
|
||||
SignalDatabase.messageSearch().fullyResetTables();
|
||||
} else if (e.getMessage().contains("no such table: message_fts")) {
|
||||
Log.w(TAG, "FTS table not found! Resetting FTS index.");
|
||||
SignalDatabase.messageSearch().fullyResetTables();
|
||||
}
|
||||
}
|
||||
|
||||
if (e instanceof OnErrorNotImplementedException && e.getCause() != null) {
|
||||
e = e.getCause();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user