Sqlite3: Switch to WAL

This is faster.
This commit is contained in:
Markus Goetz 2014-10-20 22:38:10 +02:00
parent 0fb779d363
commit 5d048c18bc
2 changed files with 13 additions and 1 deletions

View file

@ -632,10 +632,13 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
path = filename + ulen;
/* skip ".csync_journal.db" and ".csync_journal.db.ctmp" */
/* Isn't this done via csync_exclude already? */
if (c_streq(path, ".csync_journal.db")
|| c_streq(path, ".csync_journal.db.ctmp")
|| c_streq(path, ".csync_journal.db.ctmp-journal")
|| c_streq(path, ".csync-progressdatabase")) {
|| c_streq(path, ".csync-progressdatabase")
|| c_streq(path, ".csync_journal.db-shm")
|| c_streq(path, ".csync_journal.db-wal")) {
csync_vio_file_stat_destroy(dirent);
dirent = NULL;
SAFE_FREE(filename);

View file

@ -120,6 +120,15 @@ bool SyncJournalDb::checkConnect()
qDebug() << "sqlite3 version" << pragma1.stringValue(0);
}
pragma1.prepare("PRAGMA journal_mode=WAL;");
if (!pragma1.exec()) {
return sqlFail("Set PRAGMA synchronous", pragma1);
} else {
pragma1.next();
qDebug() << "sqlite3 journal_mode=" << pragma1.stringValue(0);
}
pragma1.prepare("PRAGMA synchronous = 1;");
if (!pragma1.exec()) {
return sqlFail("Set PRAGMA synchronous", pragma1);