[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: 4680162279

Reviewed By: mbouaziz

Differential Revision: D6413384

fbshipit-source-id: 99e4650
master
Martino Luca 7 years ago committed by Facebook Github Bot
parent 7b8a5a1a2b
commit 6b363ef063

@ -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

Loading…
Cancel
Save