Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL cache: enable WAL (Write Ahead Logging) by default #5843

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ actual class SqlNormalizedCacheFactory actual constructor(
/**
* @param [name] Name of the database file, or null for an in-memory database (as per Android framework implementation).
* @param [factory] Factory class to create instances of [SupportSQLiteOpenHelper]
* @param [configure] Optional callback, called when the database connection is being configured, to enable features such as
* @param [configure] Optional callback, called when the database connection is being configured, to configure features such as
* write-ahead logging or foreign key support. It should not modify the database except to configure it.
* @param [useNoBackupDirectory] Sets whether to use a no backup directory or not.
* @param [windowSizeBytes] Size of cursor window in bytes, per [android.database.CursorWindow] (Android 28+ only), or null to use the default.
Expand All @@ -43,6 +43,7 @@ actual class SqlNormalizedCacheFactory actual constructor(
object : AndroidSqliteDriver.Callback(getSchema(withDates)) {
override fun onConfigure(db: SupportSQLiteDatabase) {
super.onConfigure(db)
db.enableWriteAheadLogging()
configure?.invoke(db)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ actual class SqlNormalizedCacheFactory internal constructor(
/**
* @param [name] Name of the database file, or null for an in-memory database (as per Android framework implementation).
* @param [factory] Factory class to create instances of [SupportSQLiteOpenHelper]
* @param [configure] Optional callback, called when the database connection is being configured, to enable features such as
* @param [configure] Optional callback, called when the database connection is being configured, to configure features such as
* write-ahead logging or foreign key support. It should not modify the database except to configure it.
* @param [useNoBackupDirectory] Sets whether to use a no backup directory or not.
* @param [windowSizeBytes] Size of cursor window in bytes, per [android.database.CursorWindow] (Android 28+ only), or null to use the default.
Expand All @@ -41,6 +41,7 @@ actual class SqlNormalizedCacheFactory internal constructor(
object : AndroidSqliteDriver.Callback(getSchema()) {
override fun onConfigure(db: SupportSQLiteDatabase) {
super.onConfigure(db)
db.enableWriteAheadLogging()
configure?.invoke(db)
}
},
Expand Down