From e606b0e4fe7b29c28f52cc98d5c5918a65c1683f Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Tue, 11 Aug 2020 10:02:32 -0700 Subject: [PATCH] [sqlite] always enable the write daemon Summary: Since there is no discernible downside in using the write daemon unless in single-thread mode or in buck, make it only depend on these circumstances, not a command line flag. Reviewed By: skcho Differential Revision: D23004451 fbshipit-source-id: 5c1d06ed1 --- infer/man/man1/infer-full.txt | 4 ---- infer/src/IR/SourceFiles.ml | 5 +---- infer/src/base/Config.ml | 8 +++----- infer/src/base/Config.mli | 2 -- infer/src/base/DBWriter.ml | 2 +- infer/src/base/SqliteUtils.ml | 6 ------ infer/src/base/SqliteUtils.mli | 3 --- 7 files changed, 5 insertions(+), 25 deletions(-) diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 20dd2897d..7ac6f5a5c 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -1840,10 +1840,6 @@ INTERNAL OPTIONS --sqlite-vfs-reset Cancel the effect of --sqlite-vfs. - --sqlite-write-daemon - Activates: Route all DB writes through a daemon process - (Conversely: --no-sqlite-write-daemon) - --starvation-skip-analysis json Specify combinations of class/method list that should be skipped during starvation analysis diff --git a/infer/src/IR/SourceFiles.ml b/infer/src/IR/SourceFiles.ml index 54ff15c1e..3eea1f294 100644 --- a/infer/src/IR/SourceFiles.ml +++ b/infer/src/IR/SourceFiles.ml @@ -55,10 +55,7 @@ let add source_file cfg tenv integer_type_widths = (* NOTE: it's important to write attribute files to disk before writing cfgs to disk. OndemandCapture module relies on it - it uses existance of the cfg as a barrier to make sure that all attributes were written to disk (but not necessarily flushed) *) - if Config.sqlite_write_daemon then Cfg.store source_file cfg - else - SqliteUtils.with_transaction (ResultsDatabase.get_database ()) ~f:(fun () -> - Cfg.store source_file cfg ) ; + Cfg.store source_file cfg ; DBWriter.add_source_file ~source_file:(SourceFile.SQLite.serialize source_file) ~tenv:(Tenv.SQLite.serialize tenv) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 74ce06087..dc0a1cda4 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -2228,9 +2228,9 @@ and sqlite_vfs = CLOpt.mk_string_opt ?default ~long:"sqlite-vfs" "VFS for SQLite" -and sqlite_write_daemon = - CLOpt.mk_bool ~default:false "Route all DB writes through a daemon process" - ~long:"sqlite-write-daemon" +and (_ : bool ref) = + CLOpt.mk_bool ~default:false "[DEPRECATED][DOES NOTHING] option does not exist any more" + ~deprecated:["-sqlite-write-daemon"] ~deprecated_no:["-no-sqlite-write-daemon"] ~long:"" and subtype_multirange = @@ -3144,8 +3144,6 @@ and sqlite_lock_timeout = !sqlite_lock_timeout and sqlite_vfs = !sqlite_vfs -and sqlite_write_daemon = !sqlite_write_daemon - and starvation_skip_analysis = !starvation_skip_analysis and starvation_strict_mode = !starvation_strict_mode diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index b08ebf7c0..ca0dc3278 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -567,8 +567,6 @@ val sqlite_lock_timeout : int val sqlite_vfs : string option -val sqlite_write_daemon : bool - val starvation_skip_analysis : Yojson.Basic.t val starvation_strict_mode : bool diff --git a/infer/src/base/DBWriter.ml b/infer/src/base/DBWriter.ml index 37ac1208c..c8a7c271d 100644 --- a/infer/src/base/DBWriter.ml +++ b/infer/src/base/DBWriter.ml @@ -325,7 +325,7 @@ module Server = struct send Command.Handshake end -let use_daemon = Config.(sqlite_write_daemon && (not (buck || genrule_mode)) && jobs > 1) +let use_daemon = Config.((not (buck || genrule_mode)) && jobs > 1) let perform cmd = if use_daemon then Server.send cmd else Command.execute cmd diff --git a/infer/src/base/SqliteUtils.ml b/infer/src/base/SqliteUtils.ml index 376cffc1a..f3bce1aed 100644 --- a/infer/src/base/SqliteUtils.ml +++ b/infer/src/base/SqliteUtils.ml @@ -89,12 +89,6 @@ let db_close db = (Sqlite3.errmsg db))) -let with_transaction db ~f = - exec db ~log:"begin transaction" ~stmt:"BEGIN IMMEDIATE TRANSACTION" ; - f () ; - exec db ~log:"commit transaction" ~stmt:"COMMIT" - - module type Data = sig type t diff --git a/infer/src/base/SqliteUtils.mli b/infer/src/base/SqliteUtils.mli index f9bad45e4..b18ed5e29 100644 --- a/infer/src/base/SqliteUtils.mli +++ b/infer/src/base/SqliteUtils.mli @@ -60,9 +60,6 @@ val result_unit : ?finalize:bool -> Sqlite3.db -> log:string -> Sqlite3.stmt -> val db_close : Sqlite3.db -> unit (** Close the given database and asserts that it was effective. Raises {!Error} if not. *) -val with_transaction : Sqlite3.db -> f:(unit -> unit) -> unit -(** Execute [f] within an explicit sqlite transaction. *) - (** An API commonly needed to store and retrieve objects from the database *) module type Data = sig type t