Remove enable_disk_heap setting
[hiphop-php.git] / hphp / hack / src / server / serverLocalConfig.ml
blob62961d96df32ed193053c25e31e940658394baa3
1 (*
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 open Config_file.Getters
11 module Hack_bucket = Bucket
12 open Hh_prelude
13 open Option.Monad_infix
14 module Bucket = Hack_bucket
16 module Watchman = struct
17 type t = {
18 (* use_watchman *)
19 enabled: bool;
20 (* in seconds *)
21 debug_logging: bool;
22 init_timeout: int;
23 sockname: string option;
24 subscribe: bool;
25 (* in seconds *)
26 synchronous_timeout: int;
29 let default =
31 debug_logging = false;
32 enabled = false;
33 (* buck and hgwatchman use a 10 second timeout, too *)
34 init_timeout = 10;
35 sockname = None;
36 subscribe = false;
37 synchronous_timeout = 120;
40 let load ~current_version ~default config =
41 let use_watchman =
42 bool_if_min_version
43 "use_watchman"
44 ~default:default.enabled
45 ~current_version
46 config
48 let enabled =
49 bool_if_min_version
50 "watchman_enabled"
51 ~default:use_watchman
52 ~current_version
53 config
55 let init_timeout =
56 int_ "watchman_init_timeout" ~default:default.init_timeout config
58 let sockname = string_opt "watchman_sockname" config in
59 let subscribe =
60 bool_if_min_version
61 "watchman_subscribe_v2"
62 ~default:default.subscribe
63 ~current_version
64 config
66 let synchronous_timeout =
67 int_
68 "watchman_synchronous_timeout"
69 ~default:default.synchronous_timeout
70 config
72 let debug_logging =
73 bool_if_min_version
74 "watchman_debug_logging"
75 ~default:default.debug_logging
76 ~current_version
77 config
80 debug_logging;
81 enabled;
82 init_timeout;
83 sockname;
84 subscribe;
85 synchronous_timeout;
87 end
89 module RemoteTypeCheck = struct
90 type t = {
91 (* Controls the `defer_class_declaration_threshold` setting on the remote worker *)
92 declaration_threshold: int;
93 (* A list of error phases; if, before type checking, errors in these phases
94 are present, then remote type checking will be disabled *)
95 disabled_on_errors: Errors.phase list;
96 (* Enables remote type check *)
97 enabled: bool;
98 (* A non-interactive host is, e.g., a dev host not currently associated with a user,
99 or a host used for non-interactive jobs (e.g., CI) *)
100 enabled_for_noninteractive_hosts: bool;
101 (* Indicates how long to wait between heartbeats (in seconds) *)
102 heartbeat_period: int;
103 load_naming_table_on_full_init: bool;
104 max_batch_size: int;
105 min_batch_size: int;
106 (* Dictates the number of remote type checking workers *)
107 num_workers: int;
108 (* The sandcastle tenant used to spawn remote workers *)
109 remote_worker_sandcastle_tenant: string;
110 (* Indicates whether files-to-declare should be fetched by VFS
111 (see `declaration_threshold`) *)
112 prefetch_deferred_files: bool;
113 worker_min_log_level: Hh_logger.Level.t;
114 (* Indicates the size of the job below which a virtual file system should
115 be used by the remote worker *)
116 worker_vfs_checkout_threshold: int;
117 (* File system mode used by ArtifactStore *)
118 file_system_mode: ArtifactStore.file_system_mode;
119 (* Max artifact size to use CAS; otherwise use everstore *)
120 max_cas_bytes: int;
121 (* Max artifact size to inline into transport channel *)
122 max_artifact_inline_bytes: int;
123 (* [0.0 - 1.0] ratio that specifies how much portion of the total payload
124 should be used in remote workers initial payload. Default is 0.0 which means
125 one bucket and no special bundling for initial payload *)
126 remote_initial_payload_ratio: float;
127 (* Configure remote typechecking activation threshold *)
128 remote_type_check_recheck_threshold: int;
131 let default =
133 enabled = false;
134 enabled_for_noninteractive_hosts = false;
135 declaration_threshold = 50;
136 disabled_on_errors = [];
137 (* Indicates how long to wait between heartbeats (in seconds) *)
138 heartbeat_period = 15;
139 load_naming_table_on_full_init = false;
140 max_batch_size = 25_000;
141 min_batch_size = 5_000;
142 num_workers = 4;
143 remote_worker_sandcastle_tenant = "interactive";
144 prefetch_deferred_files = false;
145 worker_min_log_level = Hh_logger.Level.Info;
146 worker_vfs_checkout_threshold = 10_000;
147 file_system_mode = ArtifactStore.Distributed;
148 max_cas_bytes = 50_000_000;
149 max_artifact_inline_bytes = 2000;
150 remote_initial_payload_ratio = 0.0;
151 remote_type_check_recheck_threshold = 1_000_000;
154 let load ~current_version ~default config =
155 let declaration_threshold =
156 int_
157 "remote_type_check_declaration_threshold"
158 ~default:default.declaration_threshold
159 config
162 let file_system_mode =
163 let open ArtifactStore in
164 let file_system_mode =
165 string_
166 "remote_type_check_file_system_mode"
167 ~default:(string_of_file_system_mode Distributed)
168 config
170 match file_system_mode_of_string file_system_mode with
171 | Some mode -> mode
172 | None -> Distributed
175 let max_cas_bytes =
176 int_
177 "remote_type_check_max_cas_bytes"
178 ~default:default.max_cas_bytes
179 config
182 let max_artifact_inline_bytes =
183 int_
184 "remote_type_check_max_artifact_inline_bytes"
185 ~default:default.max_artifact_inline_bytes
186 config
189 let enabled_on_errors =
190 string_list
191 "remote_type_check_enabled_on_errors"
192 ~default:["typing"]
193 config
194 |> List.fold ~init:[] ~f:(fun acc phase ->
195 match Errors.phase_of_string phase with
196 | Some phase -> phase :: acc
197 | None -> acc)
199 let disabled_on_errors =
200 List.filter
201 [Errors.Typing; Errors.Decl; Errors.Parsing; Errors.Init; Errors.Naming]
202 ~f:(fun phase ->
204 (List.exists enabled_on_errors ~f:(fun enabled_phase ->
205 Errors.equal_phase enabled_phase phase)))
207 let heartbeat_period =
208 int_
209 "remote_type_check_heartbeat_period"
210 ~default:default.heartbeat_period
211 config
213 let num_workers =
214 int_ "remote_type_check_num_workers" ~default:default.num_workers config
216 let remote_worker_sandcastle_tenant =
217 string_
218 "remote_worker_sandcastle_tenant"
219 ~default:default.remote_worker_sandcastle_tenant
220 config
222 let max_batch_size =
223 int_
224 "remote_type_check_max_batch_size"
225 ~default:default.max_batch_size
226 config
228 let min_batch_size =
229 int_
230 "remote_type_check_min_batch_size"
231 ~default:default.min_batch_size
232 config
234 let prefetch_deferred_files =
235 bool_if_min_version
236 "remote_type_check_prefetch_deferred_files"
237 ~default:default.prefetch_deferred_files
238 ~current_version
239 config
241 let remote_type_check_recheck_threshold =
242 int_
243 "remote_type_check_recheck_threshold"
244 ~default:default.remote_type_check_recheck_threshold
245 config
247 let remote_initial_payload_ratio =
248 float_
249 "remote_type_check_remote_initial_payload_ratio"
250 ~default:default.remote_initial_payload_ratio
251 config
253 let load_naming_table_on_full_init =
254 bool_if_min_version
255 "remote_type_check_load_naming_table_on_full_init"
256 ~default:default.load_naming_table_on_full_init
257 ~current_version
258 config
260 let enabled =
261 bool_if_min_version
262 "remote_type_check_enabled"
263 ~default:default.enabled
264 ~current_version
265 config
267 let enabled_for_noninteractive_hosts =
268 bool_if_min_version
269 "remote_type_check_enabled_for_noninteractive_hosts"
270 ~default:default.enabled_for_noninteractive_hosts
271 ~current_version
272 config
274 let worker_min_log_level =
275 match
276 Hh_logger.Level.of_enum_string
277 (String.lowercase
278 (string_
279 "remote_type_check_worker_min_log_level"
280 ~default:
281 (Hh_logger.Level.to_enum_string default.worker_min_log_level)
282 config))
283 with
284 | Some level -> level
285 | None -> Hh_logger.Level.Debug
287 let worker_vfs_checkout_threshold =
288 int_
289 "remote_type_check_worker_vfs_checkout_threshold"
290 ~default:default.worker_vfs_checkout_threshold
291 config
294 declaration_threshold;
295 disabled_on_errors;
296 enabled;
297 enabled_for_noninteractive_hosts;
298 heartbeat_period;
299 load_naming_table_on_full_init;
300 max_batch_size;
301 min_batch_size;
302 num_workers;
303 prefetch_deferred_files;
304 remote_type_check_recheck_threshold;
305 worker_min_log_level;
306 worker_vfs_checkout_threshold;
307 file_system_mode;
308 max_cas_bytes;
309 max_artifact_inline_bytes;
310 remote_initial_payload_ratio;
311 remote_worker_sandcastle_tenant;
315 module RecheckCapture = struct
316 type t = {
317 (* Enables recheck environment capture *)
318 enabled: bool;
319 (* If the error theshold is not met, then the recheck environment that
320 doesn't meet the fanout-related thresholds will not be captured. *)
321 error_threshold: int;
322 (* We will automatically capture the recheck environment if
323 the number of files to recheck exceeds this threshold.
324 The number of rechecked files is always less than or equal to
325 the fanout *)
326 fanout_threshold: int;
327 (* We will automatically capture the recheck environment if
328 the number of rechecked files exceeds this threshold *)
329 rechecked_files_threshold: int;
330 (* If set, determines the rate of sampling of rechecks regardless of
331 their fanout size. The error threshold would still apply.
332 NOTE: valid values fall between 0.0 (0%) and 1.0 (100%).
333 Values less than 0.0 will be interpreted as 0.0; values greater than
334 1.0 will be interpreted as 1.0 *)
335 sample_threshold: float;
338 let default =
340 enabled = false;
341 (* We wouldn't capture small rechecks unless they have at least
342 this many errors. *)
343 error_threshold = 1;
344 (* If capturing is enabled and the recheck fanout (pre-type-check)
345 meets this threshold, then we would snapshot the changed files. *)
346 fanout_threshold = 40_000;
347 (* If the number of files actually rechecked meets this threshold
348 and we already snapshotted the changed files based on fanout
349 size or sampling, we would capture the recheck environment. *)
350 rechecked_files_threshold = 5_000;
351 (* We wouldn't take changed files snapshots of small fanouts
352 unless they are randomly selected with the probability controlled
353 by the sample_threshold setting. By default, we don't snapshot
354 any small fanouts. *)
355 sample_threshold = 0.0;
358 let load ~current_version ~default config =
359 let enabled =
360 bool_if_min_version
361 "recheck_capture_enabled"
362 ~default:default.enabled
363 ~current_version
364 config
366 let error_threshold =
367 int_
368 "recheck_capture_error_threshold"
369 ~default:default.error_threshold
370 config
372 let fanout_threshold =
373 int_
374 "recheck_capture_fanout_threshold"
375 ~default:default.fanout_threshold
376 config
378 let rechecked_files_threshold =
379 int_
380 "recheck_capture_rechecked_files_threshold"
381 ~default:default.rechecked_files_threshold
382 config
384 let sample_threshold =
385 let sample_threshold =
386 float_
387 "recheck_capture_sample_threshold"
388 ~default:default.sample_threshold
389 config
391 if Float.(sample_threshold > 1.0) then
393 else if Float.(sample_threshold < 0.0) then
395 else
396 sample_threshold
399 enabled;
400 error_threshold;
401 fanout_threshold;
402 rechecked_files_threshold;
403 sample_threshold;
407 (** Allows to typecheck only a certain quantile of the workload. *)
408 type quantile = {
409 count: int;
410 (** The number of quantiles we want.
411 If this is n, we'll divide the workload in n groups. *)
412 index: int;
413 (** The index of the subgroup we'll process.
414 If this is i, we'll typecheck group number i out of the n groups.
415 this should be in interval [0; n] *)
418 type t = {
419 min_log_level: Hh_logger.Level.t;
420 attempt_fix_credentials: bool;
421 (** Indicates whether we attempt to fix the credentials if they're broken *)
422 log_categories: string list;
423 log_large_fanouts_threshold: int option;
424 (** If a fanout is greater than this value, log stats about that fanout. *)
425 experiments: string list;
426 (** the list of experiments from the experiments config *)
427 experiments_config_meta: string; (** a free-form diagnostic string *)
428 use_saved_state: bool;
429 (** should we attempt to load saved-state? (subject to further options) *)
430 use_saved_state_when_indexing: bool;
431 (** should we attempt to load saved-state when running glean indexing? *)
432 require_saved_state: bool;
433 (** if attempting saved-state, should we fail upon failure? *)
434 load_state_natively: bool;
435 (** make hh_server query and download saved state. *)
436 load_state_natively_download_timeout: int; (** in seconds *)
437 load_state_natively_dirty_files_timeout: int; (** in seconds *)
438 type_decl_bucket_size: int;
439 extend_defs_per_file_bucket_size: int;
440 enable_on_nfs: bool;
441 enable_fuzzy_search: bool;
442 lazy_parse: bool;
443 lazy_init: bool;
444 max_purgatory_clients: int;
445 (** Monitor: Limit the number of clients that can sit in purgatory waiting
446 for a server to be started because we don't want this to grow unbounded. *)
447 search_chunk_size: int;
448 io_priority: int;
449 cpu_priority: int;
450 shm_dirs: string list;
451 shm_use_sharded_hashtbl: bool;
452 shm_cache_size: int;
453 (** Maximum shared memory cache size for evictable data.
455 If this is set to a negative value, eviction is disabled. *)
456 max_workers: int option;
457 max_bucket_size: int;
458 (** max_bucket_size is the default bucket size for ALL users of MultiWorker unless they provide a specific override max_size *)
459 use_dummy_informant: bool; (** See HhMonitorInformant. *)
460 informant_min_distance_restart: int;
461 use_full_fidelity_parser: bool;
462 interrupt_on_watchman: bool;
463 interrupt_on_client: bool;
464 trace_parsing: bool;
465 prechecked_files: bool;
466 enable_type_check_filter_files: bool;
467 (** Let the user configure which files to type check and
468 which files to ignore. This flag is not expected to be
469 rolled out broadly, rather it is meant to be used by
470 power users only. *)
471 re_worker: bool;
472 ide_serverless: bool; (** whether clientLsp should use serverless-ide *)
473 ide_ranked_autocomplete: bool;
474 (** whether clientLsp should use ranked autocomplete *)
475 ide_max_num_decls: int; (** tuning of clientIdeDaemon local cache *)
476 ide_max_num_shallow_decls: int; (** tuning of clientIdeDaemon local cache *)
477 ide_max_num_linearizations: int; (** tuning of clientIdeDaemon local cache *)
478 ide_symbolindex_search_provider: string;
479 (** like [symbolindex_search_provider] but for IDE *)
480 ide_use_shallow_decls: bool;
481 (** use shallow decls instead folded decls in Hack IDE *)
482 predeclare_ide: bool;
483 max_typechecker_worker_memory_mb: int option;
484 (** if set, the worker will stop early at the end of a file if its heap exceeds this number *)
485 use_max_typechecker_worker_memory_for_decl_deferral: bool;
486 (** if set, the worker will perform the same check as for [max_typechecker_worker_memory_mb] after each decl
487 and, if over the limit, will defer *)
488 longlived_workers: bool;
489 hg_aware: bool;
490 hg_aware_parsing_restart_threshold: int;
491 hg_aware_redecl_restart_threshold: int;
492 hg_aware_recheck_restart_threshold: int;
493 force_remote_type_check: bool; (** forces Hulk *)
494 ide_parser_cache: bool;
495 store_decls_in_saved_state: bool;
496 (** When enabled, save hot class declarations (for now, specified in a special
497 file in the repository) when generating a saved state. *)
498 load_decls_from_saved_state: bool;
499 (** When enabled, load class declarations stored in the saved state, if any, on
500 server init. *)
501 idle_gc_slice: int;
502 (** Size of Gc.major_slice to be performed when server is idle. 0 to disable *)
503 shallow_class_decl: bool;
504 (** Look up class members lazily from shallow declarations instead of eagerly
505 computing folded declarations representing the entire class type. *)
506 force_shallow_decl_fanout: bool;
507 (** Use fanout algorithm based solely on shallow decl comparison. This is the
508 default in shallow decl mode. Use this option if using folded decls. *)
509 force_load_hot_shallow_decls: bool;
510 (** Always load hot shallow decls from saved state. *)
511 populate_member_heaps: bool;
512 (** Populate the member signature heaps.
514 If disabled, instead load lazily from shallow classes. *)
515 fetch_remote_old_decls: bool;
516 (** Option to fetch old decls from remote decl store *)
517 use_hack_64_naming_table: bool;
518 (** Load naming table from hack/64 saved state. *)
519 skip_hierarchy_checks: bool;
520 (** Skip checks on hierarchy e.g. overrides, require extend, etc.
521 Set to true only for debugging purposes! *)
522 skip_tast_checks: bool;
523 (** Skip checks implemented using TAST visitors.
524 Set to true only for debugging purposes! *)
525 num_local_workers: int option;
526 (** If None, only the type check delegate's logic will be used.
527 If the delegate fails to type check, the typing check service as a whole
528 will fail. *)
529 parallel_type_checking_threshold: int;
530 (** If the number of files to type check is fewer than this value, the files
531 will be type checked sequentially (in the master process). Otherwise,
532 the files will be type checked in parallel (in MultiWorker workers). *)
533 defer_class_declaration_threshold: int option;
534 (** If set, defers class declarations after N lazy declarations; if not set,
535 always lazily declares classes not already in cache. *)
536 prefetch_deferred_files: bool;
537 (** The whether to use the hook that prefetches files on an Eden checkout *)
538 recheck_capture: RecheckCapture.t;
539 (** Settings controlling how and whether we capture the recheck environment *)
540 recli_version: string;
541 (** The version of the Remote Execution CLI tool to use *)
542 remote_nonce: Int64.t;
543 (** The unique identifier of a particular remote typechecking run *)
544 remote_type_check: RemoteTypeCheck.t;
545 (** Remote type check settings that can be changed, e.g., by GK *)
546 remote_worker_key: string option;
547 (** If set, uses the key to fetch type checking jobs *)
548 remote_check_id: string option;
549 (** If set, uses the check ID when logging events in the context of remove init/work *)
550 remote_version_specifier_required: bool;
551 (** Indicates whether the remote version specifier is required for remote type check from non-prod server *)
552 remote_version_specifier: string option;
553 (** The version of the package the remote worker is to install *)
554 remote_transport_channel: string option;
555 (** Name of the transport channel used by remote type checking. TODO: move into remote_type_check. *)
556 remote_worker_saved_state_manifold_path: string option;
557 (** A manifold path to a naming table to be used for Hulk Lite when typechecking. *)
558 rust_provider_backend: bool;
559 (** Use Provider_backend.Rust_provider_backend as the global provider
560 * backend, servicing File_provider, Naming_provider, and Decl_provider
561 * using the hackrs implementation. *)
562 naming_sqlite_path: string option;
563 (** Enables the reverse naming table to fall back to SQLite for queries. *)
564 enable_naming_table_fallback: bool;
565 symbolindex_search_provider: string;
566 (** Selects a search provider for autocomplete and symbol search; see also [ide_symbolindex_search_provider] *)
567 symbolindex_quiet: bool;
568 symbolindex_file: string option;
569 tico_invalidate_files: bool;
570 (** Allows hh_server to invalidate units in hhvm based on local changes *)
571 tico_invalidate_smart: bool; (** Use finer grain hh_server dependencies *)
572 use_direct_decl_parser: bool;
573 (** Enable use of the direct decl parser for parsing type signatures. *)
574 per_file_profiling: HackEventLogger.PerFileProfilingConfig.t;
575 (** turns on memtrace .ctf writes to this directory *)
576 memtrace_dir: string option;
577 go_to_implementation: bool;
578 (** Allows the IDE to show the 'find all implementations' button *)
579 allow_unstable_features: bool;
580 (** Allows unstabled features to be enabled within a file via the '__EnableUnstableFeatures' attribute *)
581 watchman: Watchman.t;
582 save_and_upload_naming_table: bool;
583 (** If enabled, saves naming table into a temp folder and uploads it to the remote typechecker *)
584 log_from_client_when_slow_monitor_connections: bool;
585 (** Alerts hh users what processes are using hh_server when hh_client is slow to connect. *)
586 log_saved_state_age_and_distance: bool;
587 (** Collects the age of a saved state (in seconds) and distance (in globalrevs) for telemetry *)
588 naming_sqlite_in_hack_64: bool;
589 (** Add sqlite naming table to hack/64 ss job *)
590 workload_quantile: quantile option;
591 (** Allows to typecheck only a certain quantile of the workload. *)
592 rollout_group: string option;
593 (** A string from hh.conf, written to HackEventLogger telemetry. Before it got
594 into here, [t], it was first used as a lookup in ServerLocalConfigKnobs.
595 Intended meaning: what class of user is running hh_server, hence what experiments
596 should they be subject to. *)
597 saved_state_manifold_api_key: string option;
598 (** A string from hh.conf. The API key is used for saved state downloads
599 when we call out to manifold *)
600 hulk_strategy: HulkStrategy.hulk_mode;
602 hulk_lite: bool;
603 (** Rewrite of Hulk to be faster and simpler - Doesn't update dep graph *)
604 hulk_heavy: bool;
605 (** Rewrite of Hulk to be faster and simpler - Does update dep graph *)
607 specify_manifold_api_key: bool;
608 remote_old_decls_no_limit: bool;
609 (** Remove remote old decl fetching limit *)
610 no_marshalled_naming_table_in_saved_state: bool;
611 (** Remove marshalled naming table from saved state *)
612 no_load_two_saved_states: bool;
613 (** Stop loading hack/naming since hack/64 now has naming table *)
614 use_manifold_cython_client: bool;
615 (** Required for Hedwig support for saved state downloads *)
616 cache_remote_decls: bool;
617 (** Configure whether fetch and cache remote decls *)
618 use_shallow_decls_saved_state: bool;
619 (** (only when cache_remote_decls == true) Configure where to fetch and cache remote decls
620 true --> from saved_state hach/shallow_decls
621 false --> from remote old shallow decl service *)
622 shallow_decls_manifold_path: string option;
623 (** A manifold path to a shallow_decls to be used for Hulk Lite when typechecking. *)
624 disable_naming_table_fallback_loading: bool;
625 (** Stop loading from OCaml marshalled naming table if sqlite table is missing. *)
626 use_type_alias_heap: bool; (** optimize type alias expansions *)
629 let default =
631 min_log_level = Hh_logger.Level.Info;
632 attempt_fix_credentials = false;
633 log_categories = [];
634 log_large_fanouts_threshold = None;
635 experiments = [];
636 experiments_config_meta = "";
637 force_remote_type_check = false;
638 use_saved_state = false;
639 use_saved_state_when_indexing = false;
640 require_saved_state = false;
641 load_state_natively = false;
642 load_state_natively_download_timeout = 60;
643 load_state_natively_dirty_files_timeout = 200;
644 type_decl_bucket_size = 1000;
645 extend_defs_per_file_bucket_size = 2000;
646 enable_on_nfs = false;
647 enable_fuzzy_search = true;
648 lazy_parse = false;
649 lazy_init = false;
650 max_purgatory_clients = 400;
651 search_chunk_size = 0;
652 io_priority = 7;
653 cpu_priority = 10;
654 shm_dirs = [GlobalConfig.shm_dir; GlobalConfig.tmp_dir];
655 shm_use_sharded_hashtbl = false;
656 shm_cache_size = -1;
657 max_workers = None;
658 max_bucket_size = Bucket.max_size ();
659 use_dummy_informant = true;
660 informant_min_distance_restart = 100;
661 use_full_fidelity_parser = true;
662 interrupt_on_watchman = false;
663 interrupt_on_client = false;
664 trace_parsing = false;
665 prechecked_files = false;
666 enable_type_check_filter_files = false;
667 re_worker = false;
668 ide_serverless = false;
669 ide_ranked_autocomplete = false;
670 ide_max_num_decls = 5000;
671 ide_max_num_shallow_decls = 10000;
672 ide_max_num_linearizations = 10000;
673 ide_use_shallow_decls = true;
674 predeclare_ide = false;
675 max_typechecker_worker_memory_mb = None;
676 use_max_typechecker_worker_memory_for_decl_deferral = false;
677 longlived_workers = false;
678 hg_aware = false;
679 hg_aware_parsing_restart_threshold = 0;
680 hg_aware_redecl_restart_threshold = 0;
681 hg_aware_recheck_restart_threshold = 0;
682 ide_parser_cache = false;
683 store_decls_in_saved_state = false;
684 load_decls_from_saved_state = false;
685 idle_gc_slice = 0;
686 shallow_class_decl = false;
687 force_shallow_decl_fanout = false;
688 force_load_hot_shallow_decls = false;
689 populate_member_heaps = true;
690 fetch_remote_old_decls = false;
691 use_hack_64_naming_table = true;
692 skip_hierarchy_checks = false;
693 skip_tast_checks = false;
694 num_local_workers = None;
695 parallel_type_checking_threshold = 10;
696 defer_class_declaration_threshold = None;
697 prefetch_deferred_files = false;
698 recheck_capture = RecheckCapture.default;
699 recli_version = "STABLE";
700 remote_nonce = Int64.zero;
701 remote_type_check = RemoteTypeCheck.default;
702 remote_worker_key = None;
703 remote_check_id = None;
704 remote_version_specifier_required = true;
705 remote_version_specifier = None;
706 remote_transport_channel = None;
707 remote_worker_saved_state_manifold_path = None;
708 rust_provider_backend = false;
709 naming_sqlite_path = None;
710 enable_naming_table_fallback = false;
711 symbolindex_search_provider = "SqliteIndex";
712 (* the code actually doesn't use this default for ide_symbolindex_search_provider;
713 it defaults to whatever was computed for symbolindex_search_provider. *)
714 ide_symbolindex_search_provider = "SqliteIndex";
715 symbolindex_quiet = false;
716 symbolindex_file = None;
717 tico_invalidate_files = false;
718 tico_invalidate_smart = false;
719 use_direct_decl_parser = true;
720 per_file_profiling = HackEventLogger.PerFileProfilingConfig.default;
721 memtrace_dir = None;
722 go_to_implementation = true;
723 allow_unstable_features = false;
724 watchman = Watchman.default;
725 save_and_upload_naming_table = false;
726 log_from_client_when_slow_monitor_connections = false;
727 naming_sqlite_in_hack_64 = false;
728 workload_quantile = None;
729 rollout_group = None;
730 saved_state_manifold_api_key = None;
731 hulk_strategy = HulkStrategy.Legacy;
732 log_saved_state_age_and_distance = false;
733 specify_manifold_api_key = false;
734 remote_old_decls_no_limit = false;
735 no_marshalled_naming_table_in_saved_state = false;
736 no_load_two_saved_states = false;
737 use_manifold_cython_client = false;
738 cache_remote_decls = false;
739 use_shallow_decls_saved_state = false;
740 shallow_decls_manifold_path = None;
741 disable_naming_table_fallback_loading = false;
742 use_type_alias_heap = false;
745 let path =
746 let dir =
747 try Sys.getenv "HH_LOCALCONF_PATH" with
748 | _ -> BuildOptions.system_config_path
750 Filename.concat dir "hh.conf"
752 let apply_overrides ~silent ~current_version ~config ~overrides =
753 (* We'll apply CLI overrides now at the start so that JustKnobs and experiments_config
754 can be informed about them, e.g. "--config rollout_group=foo" will be able
755 to guide the manner in which JustKnobs picks up values, and "--config use_justknobs=false"
756 will be able to disable it. Don't worry though -- we'll apply CLI overrides again at the end,
757 so they overwrite any changes brought by JustKnobs and experiments_config. *)
758 let config = Config_file.apply_overrides ~from:None ~config ~overrides in
759 (* Now is the time for JustKnobs *)
760 let use_justknobs = bool_opt "use_justknobs" config in
761 let config =
762 match (use_justknobs, Sys_utils.deterministic_behavior_for_tests ()) with
763 | (Some false, _)
764 (* --config use_justknobs=false (or in hh.conf) will force JK off, regardless of anything else *)
765 | (None, true)
766 (* if use_justknobs isn't set, HH_TEST_MODE=1 (used in tests) will still turn JK off *)
768 config
769 | (Some true, _)
770 (* --config use_justknobs=true (or in hh.conf) will force JK on, regardless of anything else *)
771 | (None, false)
772 (* if use_justknobs isn't set, then HH_TEST_MODE unset or =0 will leave JK on *)
774 ServerLocalConfigKnobs.apply_justknobs_overrides ~silent config
776 (* Now is the time for experiments_config overrides *)
777 let experiments_enabled =
778 bool_if_min_version
779 "experiments_config_enabled"
780 ~default:false
781 ~current_version
782 config
784 let (experiments_meta, config) =
785 if experiments_enabled then begin
786 Disk.mkdir_p GlobalConfig.tmp_dir;
787 let dir =
788 string_ "experiments_config_path" ~default:GlobalConfig.tmp_dir config
790 let owner = Sys_utils.get_primary_owner () in
791 let file =
792 Filename.concat dir (Printf.sprintf "hh.%s.experiments" owner)
794 let update =
795 bool_if_min_version
796 "experiments_config_update"
797 ~default:false
798 ~current_version
799 config
801 let ttl =
802 float_of_int
803 (int_ "experiments_config_ttl_seconds" ~default:86400 config)
805 let source = string_opt "experiments_config_source" config in
806 let meta =
807 if update then
808 match Experiments_config_file.update ~silent ~file ~source ~ttl with
809 | Ok meta -> meta
810 | Error message -> message
811 else
812 "Updating experimental config not enabled"
814 if Disk.file_exists file then
815 (* Apply the experiments overrides *)
816 let experiment_overrides = Config_file.parse_local_config file in
817 let config =
818 Config_file.apply_overrides
819 ~from:(Option.some_if (not silent) "Experiment_overrides")
820 ~config
821 ~overrides:experiment_overrides
823 (meta, config)
824 else
825 ("Experimental config not found on disk", config)
826 end else
827 ("Experimental config not enabled", config)
829 (* Finally, reapply the CLI overrides, since they should take
830 precedence over the experiments_config and JustKnobs. *)
831 let config =
832 Config_file.apply_overrides
833 ~from:(Option.some_if (not silent) "--config")
834 ~config
835 ~overrides
837 (experiments_meta, config)
839 let load_ fn ~silent ~current_version overrides =
840 let config = Config_file.parse_local_config fn in
841 let (experiments_config_meta, config) =
842 apply_overrides ~silent ~current_version ~config ~overrides
844 if not silent then begin
845 Printf.eprintf "** Combined config:\n%!";
846 Config_file.print_to_stderr config;
847 Printf.eprintf "\n%!"
848 end;
850 let experiments =
851 string_list "experiments" ~default:default.experiments config
854 let log_categories =
855 string_list "log_categories" ~default:default.log_categories config
857 let log_large_fanouts_threshold =
858 int_opt "log_large_fanouts_threshold" config
860 let min_log_level =
861 match
862 Hh_logger.Level.of_enum_string
863 (String.lowercase
864 (string_
865 "min_log_level"
866 ~default:(Hh_logger.Level.to_enum_string default.min_log_level)
867 config))
868 with
869 | Some level -> level
870 | None -> Hh_logger.Level.Debug
873 let use_saved_state =
874 bool_if_min_version
875 "use_mini_state"
876 ~default:default.use_saved_state
877 ~current_version
878 config
880 let use_saved_state_when_indexing =
881 bool_if_min_version
882 "use_mini_state_when_indexing"
883 ~default:default.use_saved_state_when_indexing
884 ~current_version
885 config
887 let require_saved_state =
888 bool_if_min_version
889 "require_saved_state"
890 ~default:default.require_saved_state
891 ~current_version
892 config
894 let attempt_fix_credentials =
895 bool_if_min_version
896 "attempt_fix_credentials"
897 ~default:default.attempt_fix_credentials
898 ~current_version
899 config
901 let enable_on_nfs =
902 bool_if_min_version
903 "enable_on_nfs"
904 ~default:default.enable_on_nfs
905 ~current_version
906 config
908 let enable_fuzzy_search =
909 bool_if_min_version
910 "enable_fuzzy_search"
911 ~default:default.enable_fuzzy_search
912 ~current_version
913 config
915 let force_remote_type_check =
916 bool_if_min_version
917 "force_remote_type_check"
918 ~default:default.force_remote_type_check
919 ~current_version
920 config
922 let lazy_parse =
923 bool_if_min_version
924 "lazy_parse"
925 ~default:default.lazy_parse
926 ~current_version
927 config
929 let lazy_init =
930 bool_if_min_version
931 "lazy_init2"
932 ~default:default.lazy_init
933 ~current_version
934 config
936 let max_purgatory_clients =
937 int_ "max_purgatory_clients" ~default:default.max_purgatory_clients config
939 let search_chunk_size =
940 int_ "search_chunk_size" ~default:default.search_chunk_size config
942 let load_state_natively =
943 bool_if_min_version
944 "load_state_natively_v4"
945 ~default:default.load_state_natively
946 ~current_version
947 config
949 let load_state_natively_download_timeout =
950 int_
951 "load_state_natively_download_timeout"
952 ~default:default.load_state_natively_download_timeout
953 config
955 let load_state_natively_dirty_files_timeout =
956 int_
957 "load_state_natively_dirty_files_timeout"
958 ~default:default.load_state_natively_dirty_files_timeout
959 config
961 let use_dummy_informant =
962 bool_if_min_version
963 "use_dummy_informant"
964 ~default:default.use_dummy_informant
965 ~current_version
966 config
968 let informant_min_distance_restart =
969 int_
970 "informant_min_distance_restart"
971 ~default:default.informant_min_distance_restart
972 config
974 let type_decl_bucket_size =
975 int_ "type_decl_bucket_size" ~default:default.type_decl_bucket_size config
977 let extend_defs_per_file_bucket_size =
978 int_
979 "extend_defs_per_file_bucket_size"
980 ~default:default.extend_defs_per_file_bucket_size
981 config
983 let io_priority = int_ "io_priority" ~default:default.io_priority config in
984 let cpu_priority = int_ "cpu_priority" ~default:default.cpu_priority config in
985 let shm_dirs =
986 string_list "shm_dirs" ~default:default.shm_dirs config
987 |> List.map ~f:(fun dir -> Path.(to_string @@ make dir))
989 let shm_use_sharded_hashtbl =
990 bool_if_min_version
991 "shm_use_sharded_hashtbl"
992 ~default:default.shm_use_sharded_hashtbl
993 ~current_version
994 config
996 let shm_cache_size =
997 int_ "shm_cache_size" ~default:default.shm_cache_size config
999 let max_workers = int_opt "max_workers" config in
1000 let max_bucket_size =
1001 int_ "max_bucket_size" ~default:default.max_bucket_size config
1003 let interrupt_on_watchman =
1004 bool_if_min_version
1005 "interrupt_on_watchman"
1006 ~default:default.interrupt_on_watchman
1007 ~current_version
1008 config
1010 let interrupt_on_client =
1011 bool_if_min_version
1012 "interrupt_on_client"
1013 ~default:default.interrupt_on_client
1014 ~current_version
1015 config
1017 let use_full_fidelity_parser =
1018 bool_if_min_version
1019 "use_full_fidelity_parser"
1020 ~default:default.use_full_fidelity_parser
1021 ~current_version
1022 config
1024 let trace_parsing =
1025 bool_if_min_version
1026 "trace_parsing"
1027 ~default:default.trace_parsing
1028 ~current_version
1029 config
1031 let prechecked_files =
1032 bool_if_min_version
1033 "prechecked_files"
1034 ~default:default.prechecked_files
1035 ~current_version
1036 config
1038 let enable_type_check_filter_files =
1039 bool_if_min_version
1040 "enable_type_check_filter_files"
1041 ~default:default.enable_type_check_filter_files
1042 ~current_version
1043 config
1045 let re_worker =
1046 bool_if_min_version
1047 "re_worker"
1048 ~default:default.re_worker
1049 ~current_version
1050 config
1052 (* ide_serverless CANNOT use bool_if_min_version, since it's needed before we yet know root/version *)
1053 let ide_serverless =
1054 bool_ "ide_serverless" ~default:default.ide_serverless config
1056 (* ide_ranked_autocomplete CANNOT use bool_if_min_version, since it's needed before we yet know root/version *)
1057 let ide_ranked_autocomplete =
1058 bool_
1059 "ide_ranked_autocomplete"
1060 ~default:default.ide_ranked_autocomplete
1061 config
1063 let ide_max_num_decls =
1064 int_ "ide_max_num_decls" ~default:default.ide_max_num_decls config
1066 let ide_max_num_shallow_decls =
1067 int_
1068 "ide_max_num_shallow_decls"
1069 ~default:default.ide_max_num_shallow_decls
1070 config
1072 let ide_max_num_linearizations =
1073 int_
1074 "ide_max_num_linearizations"
1075 ~default:default.ide_max_num_linearizations
1076 config
1078 let ide_use_shallow_decls =
1079 bool_if_min_version
1080 "ide_use_shallow_decls"
1081 ~default:default.ide_use_shallow_decls
1082 ~current_version
1083 config
1085 let predeclare_ide =
1086 bool_if_min_version
1087 "predeclare_ide"
1088 ~default:default.predeclare_ide
1089 ~current_version
1090 config
1092 let max_typechecker_worker_memory_mb =
1093 int_opt "max_typechecker_worker_memory_mb" config
1095 let use_max_typechecker_worker_memory_for_decl_deferral =
1096 bool_
1097 "use_max_typechecker_worker_memory_for_decl_deferral"
1098 ~default:default.use_max_typechecker_worker_memory_for_decl_deferral
1099 config
1101 let longlived_workers =
1102 bool_if_min_version
1103 "longlived_workers"
1104 ~default:default.longlived_workers
1105 ~current_version
1106 config
1108 let hg_aware =
1109 bool_if_min_version
1110 "hg_aware"
1111 ~default:default.hg_aware
1112 ~current_version
1113 config
1115 let store_decls_in_saved_state =
1116 bool_if_min_version
1117 "store_decls_in_saved_state"
1118 ~default:default.store_decls_in_saved_state
1119 ~current_version
1120 config
1122 let load_decls_from_saved_state =
1123 bool_if_min_version
1124 "load_decls_from_saved_state"
1125 ~default:default.load_decls_from_saved_state
1126 ~current_version
1127 config
1129 let hg_aware_parsing_restart_threshold =
1130 int_
1131 "hg_aware_parsing_restart_threshold"
1132 ~default:default.hg_aware_parsing_restart_threshold
1133 config
1135 let hg_aware_redecl_restart_threshold =
1136 int_
1137 "hg_aware_redecl_restart_threshold"
1138 ~default:default.hg_aware_redecl_restart_threshold
1139 config
1141 let hg_aware_recheck_restart_threshold =
1142 int_
1143 "hg_aware_recheck_restart_threshold"
1144 ~default:default.hg_aware_recheck_restart_threshold
1145 config
1147 let ide_parser_cache =
1148 bool_if_min_version
1149 "ide_parser_cache"
1150 ~default:default.ide_parser_cache
1151 ~current_version
1152 config
1154 let idle_gc_slice =
1155 int_ "idle_gc_slice" ~default:default.idle_gc_slice config
1157 let shallow_class_decl =
1158 bool_if_min_version
1159 "shallow_class_decl"
1160 ~default:default.shallow_class_decl
1161 ~current_version
1162 config
1164 let force_shallow_decl_fanout =
1165 bool_if_min_version
1166 "force_shallow_decl_fanout"
1167 ~default:default.force_shallow_decl_fanout
1168 ~current_version
1169 config
1171 let force_load_hot_shallow_decls =
1172 bool_if_min_version
1173 "force_load_hot_shallow_decls"
1174 ~default:default.force_load_hot_shallow_decls
1175 ~current_version
1176 config
1178 let populate_member_heaps =
1179 bool_if_min_version
1180 "populate_member_heaps"
1181 ~default:default.populate_member_heaps
1182 ~current_version
1183 config
1185 let fetch_remote_old_decls =
1186 bool_if_min_version
1187 "fetch_remote_old_decls"
1188 ~default:default.fetch_remote_old_decls
1189 ~current_version
1190 config
1192 let use_hack_64_naming_table =
1193 bool_if_min_version
1194 "use_hack_64_naming_table"
1195 ~default:default.use_hack_64_naming_table
1196 ~current_version
1197 config
1199 let skip_hierarchy_checks =
1200 bool_if_min_version
1201 "skip_hierarchy_checks"
1202 ~default:default.skip_hierarchy_checks
1203 ~current_version
1204 config
1206 let skip_tast_checks =
1207 bool_if_min_version
1208 "skip_tast_checks"
1209 ~default:default.skip_tast_checks
1210 ~current_version
1211 config
1213 let parallel_type_checking_threshold =
1214 int_
1215 "parallel_type_checking_threshold"
1216 ~default:default.parallel_type_checking_threshold
1217 config
1219 let num_local_workers = int_opt "num_local_workers" config in
1220 let defer_class_declaration_threshold =
1221 int_opt "defer_class_declaration_threshold" config
1223 let prefetch_deferred_files =
1224 bool_if_min_version
1225 "prefetch_deferred_files"
1226 ~default:false
1227 ~current_version
1228 config
1230 let recheck_capture =
1231 RecheckCapture.load ~current_version ~default:default.recheck_capture config
1233 let remote_nonce =
1234 match string_opt "remote_nonce" config with
1235 | Some n -> Int64.of_string n
1236 | None -> Int64.zero
1238 let remote_type_check =
1239 RemoteTypeCheck.load
1240 ~current_version
1241 ~default:default.remote_type_check
1242 config
1244 let watchman =
1245 Watchman.load ~current_version ~default:default.watchman config
1247 let recli_version =
1248 string_ "recli_version" ~default:default.recli_version config
1250 let remote_worker_key = string_opt "remote_worker_key" config in
1251 let remote_check_id = string_opt "remote_check_id" config in
1252 let remote_version_specifier_required =
1253 bool_if_min_version
1254 "remote_version_specifier_required"
1255 ~default:default.remote_version_specifier_required
1256 ~current_version
1257 config
1259 let remote_version_specifier = string_opt "remote_version_specifier" config in
1260 let remote_transport_channel = string_opt "remote_transport_channel" config in
1261 let enable_naming_table_fallback =
1262 bool_if_min_version
1263 "enable_naming_table_fallback"
1264 ~default:default.enable_naming_table_fallback
1265 ~current_version
1266 config
1268 let naming_sqlite_path =
1269 if enable_naming_table_fallback then
1270 string_opt "naming_sqlite_path" config
1271 else
1272 None
1274 let symbolindex_search_provider =
1275 string_
1276 "symbolindex_search_provider"
1277 ~default:default.symbolindex_search_provider
1278 config
1280 let ide_symbolindex_search_provider =
1281 string_
1282 "ide_symbolindex_search_provider"
1283 ~default:symbolindex_search_provider
1284 config
1286 let symbolindex_quiet =
1287 bool_if_min_version
1288 "symbolindex_quiet"
1289 ~default:default.symbolindex_quiet
1290 ~current_version
1291 config
1293 let symbolindex_file = string_opt "symbolindex_file" config in
1294 let tico_invalidate_files =
1295 bool_if_min_version
1296 "tico_invalidate_files"
1297 ~default:default.tico_invalidate_files
1298 ~current_version
1299 config
1301 let tico_invalidate_smart =
1302 bool_if_min_version
1303 "tico_invalidate_smart"
1304 ~default:default.tico_invalidate_smart
1305 ~current_version
1306 config
1308 let use_direct_decl_parser =
1309 bool_if_min_version
1310 "use_direct_decl_parser"
1311 ~default:default.use_direct_decl_parser
1312 ~current_version
1313 config
1315 let profile_log =
1316 bool_if_min_version
1317 "profile_log"
1318 ~default:HackEventLogger.PerFileProfilingConfig.(default.profile_log)
1319 ~current_version
1320 config
1322 let profile_type_check_duration_threshold =
1323 float_
1324 "profile_type_check_duration_threshold"
1325 ~default:
1326 HackEventLogger.PerFileProfilingConfig.(
1327 default.profile_type_check_duration_threshold)
1328 config
1330 let profile_type_check_memory_threshold_mb =
1331 int_
1332 "profile_type_check_memory_threshold_mb"
1333 ~default:
1334 HackEventLogger.PerFileProfilingConfig.(
1335 default.profile_type_check_memory_threshold_mb)
1336 config
1338 let profile_type_check_twice =
1339 bool_if_min_version
1340 "profile_type_check_twice"
1341 ~default:
1342 HackEventLogger.PerFileProfilingConfig.(
1343 default.profile_type_check_twice)
1344 ~current_version
1345 config
1347 let profile_decling =
1348 match string_ "profile_decling" ~default:"off" config with
1349 | "off" -> HackEventLogger.PerFileProfilingConfig.DeclingOff
1350 | "top_counts" -> HackEventLogger.PerFileProfilingConfig.DeclingTopCounts
1351 | "all_telemetry" ->
1352 HackEventLogger.PerFileProfilingConfig.DeclingAllTelemetry
1353 { callstacks = false }
1354 | "all_telemetry_callstacks" ->
1355 HackEventLogger.PerFileProfilingConfig.DeclingAllTelemetry
1356 { callstacks = true }
1357 | _ ->
1358 failwith
1359 "profile_decling: off | top_counts | all_telemetry | all_telemetry_callstacks"
1361 let profile_owner = string_opt "profile_owner" config in
1362 let profile_desc = string_opt "profile_desc" config in
1363 let profile_slow_threshold =
1364 float_
1365 "profile_slow_threshold"
1366 ~default:
1367 HackEventLogger.PerFileProfilingConfig.(default.profile_slow_threshold)
1368 config
1370 let memtrace_dir = string_opt "memtrace_dir" config in
1371 let go_to_implementation =
1372 bool_if_min_version
1373 "go_to_implementation"
1374 ~default:default.go_to_implementation
1375 ~current_version
1376 config
1378 let allow_unstable_features =
1379 bool_if_min_version
1380 "allow_unstable_features"
1381 ~default:default.allow_unstable_features
1382 ~current_version
1383 config
1385 let save_and_upload_naming_table =
1386 bool_if_min_version
1387 "save_and_upload_naming_table"
1388 ~default:default.save_and_upload_naming_table
1389 ~current_version
1390 config
1392 let log_from_client_when_slow_monitor_connections =
1393 bool_if_min_version
1394 "log_from_client_when_slow_monitor_connections"
1395 ~default:default.log_from_client_when_slow_monitor_connections
1396 ~current_version
1397 config
1399 let log_saved_state_age_and_distance =
1400 bool_if_min_version
1401 "log_saved_state_age_and_distance"
1402 ~default:default.log_saved_state_age_and_distance
1403 ~current_version
1404 config
1406 let naming_sqlite_in_hack_64 =
1407 bool_if_min_version
1408 "naming_sqlite_in_hack_64"
1409 ~default:default.naming_sqlite_in_hack_64
1410 ~current_version
1411 config
1413 let force_shallow_decl_fanout =
1414 if force_shallow_decl_fanout && not use_direct_decl_parser then (
1415 Hh_logger.warn
1416 "You have force_shallow_decl_fanout=true but use_direct_decl_parser=false. This is incompatible. Turning off force_shallow_decl_fanout";
1417 false
1418 ) else
1419 force_shallow_decl_fanout
1421 let force_load_hot_shallow_decls =
1422 if force_load_hot_shallow_decls && not force_shallow_decl_fanout then (
1423 Hh_logger.warn
1424 "You have force_load_hot_shallow_decls=true but force_shallow_decl_fanout=false. This is incompatible. Turning off force_load_hot_shallow_decls";
1425 false
1426 ) else
1427 force_load_hot_shallow_decls
1429 let fetch_remote_old_decls =
1430 if fetch_remote_old_decls && not force_shallow_decl_fanout then (
1431 Hh_logger.warn
1432 "You have fetch_remote_old_decls=true but force_shallow_decl_fanout=false. This is incompatible. Turning off force_load_hot_shallow_decls";
1433 false
1434 ) else
1435 fetch_remote_old_decls
1437 let workload_quantile =
1438 int_list_opt "workload_quantile" config >>= fun l ->
1439 match l with
1440 | [m; n] ->
1441 if 0 <= m && m <= n then
1442 Some { count = n; index = m }
1443 else if 0 <= n && n <= m then
1444 Some { count = m; index = n }
1445 else
1446 None
1447 | _ -> None
1449 let rollout_group = string_opt "rollout_group" config in
1450 let specify_manifold_api_key =
1451 bool_if_min_version
1452 "specify_manifold_api_key"
1453 ~default:default.specify_manifold_api_key
1454 ~current_version
1455 config
1457 let remote_old_decls_no_limit =
1458 bool_if_min_version
1459 "remote_old_decls_no_limit"
1460 ~default:default.remote_old_decls_no_limit
1461 ~current_version
1462 config
1464 let no_marshalled_naming_table_in_saved_state =
1465 bool_if_min_version
1466 "no_marshalled_naming_table_in_saved_state"
1467 ~default:default.no_marshalled_naming_table_in_saved_state
1468 ~current_version
1469 config
1471 let no_load_two_saved_states =
1472 bool_if_min_version
1473 "no_load_two_saved_states"
1474 ~default:default.no_load_two_saved_states
1475 ~current_version
1476 config
1478 let saved_state_manifold_api_key =
1479 (* overriding the local_config value so consumers of saved_state_manifold_api_key
1480 * don't need to explicitly check for specify_manifold_api_key.
1482 if specify_manifold_api_key then
1483 string_opt "saved_state_manifold_api_key" config
1484 else
1485 None
1487 let hulk_lite =
1488 bool_if_min_version "hulk_lite" ~default:false ~current_version config
1490 let hulk_heavy =
1491 bool_if_min_version "hulk_heavy" ~default:false ~current_version config
1493 let hulk_mode = string_ "hulk_mode" ~default:"none" config in
1494 let hulk_strategy =
1495 HulkStrategy.config_to_strategy hulk_mode hulk_lite hulk_heavy
1497 let remote_worker_saved_state_manifold_path =
1498 string_opt "remote_worker_saved_state_manifold_path" config
1500 let rust_provider_backend =
1501 bool_if_min_version
1502 "rust_provider_backend"
1503 ~default:default.rust_provider_backend
1504 ~current_version
1505 config
1507 let rust_provider_backend =
1508 if rust_provider_backend && not use_direct_decl_parser then (
1509 Hh_logger.warn
1510 "You have rust_provider_backend=true but use_direct_decl_parser=false. This is incompatible. Turning off rust_provider_backend";
1511 false
1512 ) else
1513 rust_provider_backend
1515 let rust_provider_backend =
1516 if rust_provider_backend && not shm_use_sharded_hashtbl then (
1517 Hh_logger.warn
1518 "You have rust_provider_backend=true but shm_use_sharded_hashtbl=false. This is incompatible. Turning off rust_provider_backend";
1519 false
1520 ) else
1521 rust_provider_backend
1523 let use_manifold_cython_client =
1524 bool_if_min_version
1525 "use_manifold_cython_client"
1526 ~default:default.use_manifold_cython_client
1527 ~current_version
1528 config
1530 let cache_remote_decls =
1531 bool_if_min_version
1532 "cache_remote_decls"
1533 ~default:default.cache_remote_decls
1534 ~current_version
1535 config
1537 let use_shallow_decls_saved_state =
1538 bool_if_min_version
1539 "use_shallow_decls_saved_state"
1540 ~default:default.use_shallow_decls_saved_state
1541 ~current_version
1542 config
1544 let shallow_decls_manifold_path =
1545 string_opt "shallow_decls_manifold_path" config
1547 let disable_naming_table_fallback_loading =
1548 bool_if_min_version
1549 "disable_naming_table_fallback_loading"
1550 ~default:default.disable_naming_table_fallback_loading
1551 ~current_version
1552 config
1554 let use_type_alias_heap =
1555 bool_if_min_version
1556 "use_type_alias_heap"
1557 ~default:default.use_type_alias_heap
1558 ~current_version
1559 config
1562 min_log_level;
1563 attempt_fix_credentials;
1564 log_categories;
1565 log_large_fanouts_threshold;
1566 experiments;
1567 experiments_config_meta;
1568 use_saved_state;
1569 use_saved_state_when_indexing;
1570 require_saved_state;
1571 load_state_natively;
1572 load_state_natively_download_timeout;
1573 load_state_natively_dirty_files_timeout;
1574 max_purgatory_clients;
1575 type_decl_bucket_size;
1576 extend_defs_per_file_bucket_size;
1577 enable_on_nfs;
1578 enable_fuzzy_search;
1579 lazy_parse;
1580 lazy_init;
1581 search_chunk_size;
1582 io_priority;
1583 cpu_priority;
1584 shm_dirs;
1585 shm_use_sharded_hashtbl;
1586 shm_cache_size;
1587 max_workers;
1588 max_bucket_size;
1589 use_dummy_informant;
1590 informant_min_distance_restart;
1591 use_full_fidelity_parser;
1592 interrupt_on_watchman;
1593 interrupt_on_client;
1594 trace_parsing;
1595 prechecked_files;
1596 enable_type_check_filter_files;
1597 re_worker;
1598 ide_serverless;
1599 ide_ranked_autocomplete;
1600 ide_max_num_decls;
1601 ide_max_num_shallow_decls;
1602 ide_max_num_linearizations;
1603 ide_symbolindex_search_provider;
1604 ide_use_shallow_decls;
1605 predeclare_ide;
1606 max_typechecker_worker_memory_mb;
1607 use_max_typechecker_worker_memory_for_decl_deferral;
1608 longlived_workers;
1609 hg_aware;
1610 hg_aware_parsing_restart_threshold;
1611 hg_aware_redecl_restart_threshold;
1612 hg_aware_recheck_restart_threshold;
1613 ide_parser_cache;
1614 store_decls_in_saved_state;
1615 load_decls_from_saved_state;
1616 idle_gc_slice;
1617 shallow_class_decl;
1618 force_shallow_decl_fanout;
1619 force_load_hot_shallow_decls;
1620 populate_member_heaps;
1621 fetch_remote_old_decls;
1622 use_hack_64_naming_table;
1623 skip_hierarchy_checks;
1624 skip_tast_checks;
1625 num_local_workers;
1626 parallel_type_checking_threshold;
1627 defer_class_declaration_threshold;
1628 prefetch_deferred_files;
1629 recheck_capture;
1630 recli_version;
1631 remote_nonce;
1632 remote_type_check;
1633 remote_worker_key;
1634 remote_check_id;
1635 remote_version_specifier_required;
1636 remote_version_specifier;
1637 remote_transport_channel;
1638 remote_worker_saved_state_manifold_path;
1639 rust_provider_backend;
1640 naming_sqlite_path;
1641 enable_naming_table_fallback;
1642 symbolindex_search_provider;
1643 symbolindex_quiet;
1644 symbolindex_file;
1645 tico_invalidate_files;
1646 tico_invalidate_smart;
1647 use_direct_decl_parser;
1648 per_file_profiling =
1650 HackEventLogger.PerFileProfilingConfig.profile_log;
1651 profile_type_check_duration_threshold;
1652 profile_type_check_memory_threshold_mb;
1653 profile_type_check_twice;
1654 profile_decling;
1655 profile_owner;
1656 profile_desc;
1657 profile_slow_threshold;
1659 memtrace_dir;
1660 go_to_implementation;
1661 allow_unstable_features;
1662 watchman;
1663 force_remote_type_check;
1664 save_and_upload_naming_table;
1665 log_from_client_when_slow_monitor_connections;
1666 naming_sqlite_in_hack_64;
1667 workload_quantile;
1668 rollout_group;
1669 saved_state_manifold_api_key;
1670 hulk_strategy;
1671 log_saved_state_age_and_distance;
1672 specify_manifold_api_key;
1673 remote_old_decls_no_limit;
1674 no_marshalled_naming_table_in_saved_state;
1675 no_load_two_saved_states;
1676 use_manifold_cython_client;
1677 cache_remote_decls;
1678 use_shallow_decls_saved_state;
1679 shallow_decls_manifold_path;
1680 disable_naming_table_fallback_loading;
1681 use_type_alias_heap;
1684 (** Loads the config from [path]. Uses JustKnobs and ExperimentsConfig to override.
1685 On top of that, applies [config_overrides]. If [silent] then prints what it's doing
1686 to stderr. *)
1687 let load ~silent ~current_version config_overrides =
1688 load_ path ~silent ~current_version config_overrides
1690 let to_rollout_flags (options : t) : HackEventLogger.rollout_flags =
1691 HackEventLogger.
1693 use_direct_decl_parser = options.use_direct_decl_parser;
1694 longlived_workers = options.longlived_workers;
1695 force_shallow_decl_fanout = options.force_shallow_decl_fanout;
1696 log_from_client_when_slow_monitor_connections =
1697 options.log_from_client_when_slow_monitor_connections;
1698 log_saved_state_age_and_distance =
1699 options.log_saved_state_age_and_distance;
1700 naming_sqlite_in_hack_64 = options.naming_sqlite_in_hack_64;
1701 use_hack_64_naming_table = options.use_hack_64_naming_table;
1702 fetch_remote_old_decls = options.fetch_remote_old_decls;
1703 ide_max_num_decls = options.ide_max_num_decls;
1704 ide_max_num_shallow_decls = options.ide_max_num_shallow_decls;
1705 ide_max_num_linearizations = options.ide_max_num_linearizations;
1706 ide_use_shallow_decls = options.ide_use_shallow_decls;
1707 max_bucket_size = options.max_bucket_size;
1708 max_workers = Option.value options.max_workers ~default:(-1);
1709 max_typechecker_worker_memory_mb =
1710 Option.value options.max_typechecker_worker_memory_mb ~default:(-1);
1711 use_max_typechecker_worker_memory_for_decl_deferral =
1712 options.use_max_typechecker_worker_memory_for_decl_deferral;
1713 hulk_lite = HulkStrategy.is_hulk_lite options.hulk_strategy;
1714 hulk_heavy = HulkStrategy.is_hulk_heavy options.hulk_strategy;
1715 specify_manifold_api_key = options.specify_manifold_api_key;
1716 remote_old_decls_no_limit = options.remote_old_decls_no_limit;
1717 no_marshalled_naming_table_in_saved_state =
1718 options.no_marshalled_naming_table_in_saved_state;
1719 no_load_two_saved_states = options.no_load_two_saved_states;
1720 populate_member_heaps = options.populate_member_heaps;
1721 shm_use_sharded_hashtbl = options.shm_use_sharded_hashtbl;
1722 shm_cache_size = options.shm_cache_size;
1723 use_manifold_cython_client = options.use_manifold_cython_client;
1724 disable_naming_table_fallback_loading =
1725 options.disable_naming_table_fallback_loading;
1726 use_type_alias_heap = options.use_type_alias_heap;