Summary: Store model summaries in the `model_specs` database table instead of in spec files. This table is populated when a new database is created by loading a dump of the `specs` table in the models database. This avoids the perf and reliability implications of ATTACHing the same, non-read-only models-DB by many processes. - `BiabductionModels` is moved into `IR` so that `JsonReports` can access it. - The binary `sqlite3` is now required on the host compiling infer. Reviewed By: skcho Differential Revision: D23191601 fbshipit-source-id: 1532481eemaster
parent
cb2243741c
commit
1db53f43b5
@ -0,0 +1,25 @@
|
|||||||
|
(*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
open! IStd
|
||||||
|
|
||||||
|
let scan_model_proc_names () =
|
||||||
|
let db = ResultsDatabase.get_database () in
|
||||||
|
Sqlite3.prepare db "SELECT proc_uid FROM model_specs"
|
||||||
|
|> SqliteUtils.result_fold_single_column_rows db ~log:"scan model procnames"
|
||||||
|
~init:String.Set.empty ~f:(fun acc proc_uid_sqlite ->
|
||||||
|
let[@warning "-8"] (Sqlite3.Data.TEXT proc_uid) = proc_uid_sqlite in
|
||||||
|
String.Set.add acc proc_uid )
|
||||||
|
|
||||||
|
|
||||||
|
let models_index =
|
||||||
|
lazy (if Config.biabduction_models_mode then String.Set.empty else scan_model_proc_names ())
|
||||||
|
|
||||||
|
|
||||||
|
let mem proc_name =
|
||||||
|
let proc_uid = Procname.to_unique_id proc_name in
|
||||||
|
String.Set.mem (Lazy.force models_index) proc_uid
|
@ -1,34 +0,0 @@
|
|||||||
(*
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*)
|
|
||||||
|
|
||||||
open! IStd
|
|
||||||
|
|
||||||
let scan_models () =
|
|
||||||
let rec next_entry index dir =
|
|
||||||
match Unix.readdir_opt dir with
|
|
||||||
| None ->
|
|
||||||
Unix.closedir dir ;
|
|
||||||
index
|
|
||||||
| Some entry -> (
|
|
||||||
match String.chop_suffix entry ~suffix:Config.specs_files_suffix with
|
|
||||||
| Some file_proc_name ->
|
|
||||||
next_entry (String.Set.add index file_proc_name) dir
|
|
||||||
| None ->
|
|
||||||
next_entry index dir )
|
|
||||||
in
|
|
||||||
match Unix.opendir Config.biabduction_models_dir with
|
|
||||||
| dir ->
|
|
||||||
next_entry String.Set.empty dir
|
|
||||||
| exception Unix.Unix_error ((ENOTDIR | ENOENT), _, _) ->
|
|
||||||
String.Set.empty
|
|
||||||
|
|
||||||
|
|
||||||
let models_index =
|
|
||||||
lazy (if not Config.biabduction_models_mode then scan_models () else String.Set.empty)
|
|
||||||
|
|
||||||
|
|
||||||
let mem proc_name = String.Set.mem (Lazy.force models_index) (Procname.to_filename proc_name)
|
|
Loading…
Reference in new issue