MXS-1924: Enable WAL mode for sqlite

The mysqlauth SQLite database is now opened in WAL mode if possible. This
should prevent lockups of the database when the list of users is updated.

Also moved the starting of the SQLite transaction one level up to also
include the delete part in it. This should further reduce the effects of
updating users.
This commit is contained in:
Markus Mäkelä
2018-06-15 01:12:24 +03:00
parent 53177c30de
commit 856d513040
3 changed files with 33 additions and 17 deletions

View File

@ -58,7 +58,8 @@ static const char databases_create_sql[] =
"CREATE TABLE IF NOT EXISTS " MYSQLAUTH_DATABASES_TABLE_NAME "(db varchar(255))";
/** PRAGMA configuration options for SQLite */
static const char pragma_sql[] = "PRAGMA JOURNAL_MODE=MEMORY";
static const char pragma_sql[] = "PRAGMA journal_mode=WAL";
static const char old_pragma_sql[] = "PRAGMA journal_mode=MEMORY";
/** Query that checks if there's a grant for the user being authenticated */
static const char mysqlauth_validate_user_query[] =