From 6b363ef0636f07d3333b17b802592c61545deb39 Mon Sep 17 00:00:00 2001 From: Martino Luca Date: Thu, 30 Nov 2017 04:35:53 -0800 Subject: [PATCH] [SQLite] Set the synchronous flag to OFF Summary: On spinning disks the performance of commits are worse when `synchronous=NORMAL`. Reading the documentation of SQLite, when `synchronous=OFF` there's a risk of DB corruption when the operating system crashes or the computer loses power before that data has been written to the disk surface; on the other hand, a crash in Infer should keep data in the DB in a sound state. Buck reached the same conclusions too: https://github.com/facebook/buck/commit/468016227960ad73779334e995c34f285ad335ae Reviewed By: mbouaziz Differential Revision: D6413384 fbshipit-source-id: 99e4650 --- infer/src/base/ResultsDatabase.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infer/src/base/ResultsDatabase.ml b/infer/src/base/ResultsDatabase.ml index 8b7d759a4..334b8f8e2 100644 --- a/infer/src/base/ResultsDatabase.ml +++ b/infer/src/base/ResultsDatabase.ml @@ -114,7 +114,7 @@ let new_database_connection () = database_fullpath in Sqlite3.busy_timeout db 10_000 ; - SqliteUtils.exec db ~log:"synchronous=NORMAL" ~stmt:"PRAGMA synchronous=NORMAL" ; + SqliteUtils.exec db ~log:"synchronous=OFF" ~stmt:"PRAGMA synchronous=OFF" ; database := Some db ; List.iter ~f:(fun callback -> callback db) !new_db_callbacks