OmniSciDB  c07336695a
MapDProgramOptions Class Reference

#include <MapDProgramOptions.h>

+ Inheritance diagram for MapDProgramOptions:
+ Collaboration diagram for MapDProgramOptions:

Public Member Functions

 MapDProgramOptions (char const *argv0)
 
boost::optional< int > parse_command_line (int argc, char const *const *argv)
 
 MapDProgramOptions ()
 
bool parse_command_line (int argc, char **argv, int &return_code)
 

Public Attributes

int http_port = 6278
 
size_t reserved_gpu_mem = 1 << 27
 
std::string base_path
 
std::string config_file = {"mapd.conf"}
 
std::string cluster_file = {"cluster.conf"}
 
std::string license_path = {""}
 
bool cpu_only = false
 
bool flush_log = true
 
bool verbose_logging = false
 
bool jit_debug = false
 
bool intel_jit_profile = false
 
bool allow_multifrag = true
 
bool read_only = false
 
bool allow_loop_joins = false
 
bool enable_legacy_syntax = true
 
AuthMetadata authMetadata
 
MapDParameters mapd_parameters
 
bool enable_rendering = false
 
bool enable_spirv = false
 
bool enable_auto_clear_render_mem = false
 
int render_oom_retry_threshold = 0
 
size_t render_mem_bytes = 500000000
 
size_t render_poly_cache_bytes = 300000000
 
bool enable_runtime_udf = false
 
bool enable_watchdog = true
 
bool enable_dynamic_watchdog = false
 
unsigned dynamic_watchdog_time_limit = 10000
 
int num_gpus = -1
 
int start_gpu = 0
 
size_t num_reader_threads = 0
 
std::string db_query_file = {""}
 
int idle_session_duration = kMinsPerHour
 
int max_session_duration = kMinsPerMonth
 
std::string udf_file_name = {""}
 
std::vector< LeafHostInfodb_leaves
 
std::vector< LeafHostInfostring_leaves
 

Private Member Functions

void fillOptions ()
 
void fillAdvancedOptions ()
 
void temporarily_support_deprecated_log_options_201904 ()
 
void fillOptions (boost::program_options::options_description &desc)
 
void fillAdvancedOptions (boost::program_options::options_description &desc_adv)
 

Private Attributes

po::options_description help_desc
 
po::options_description developer_desc
 
logger::LogOptions log_options_
 
po::variables_map vm
 
boost::program_options::variables_map vm
 

Detailed Description

Definition at line 242 of file MapDServer.cpp.

Constructor & Destructor Documentation

◆ MapDProgramOptions() [1/2]

MapDProgramOptions::MapDProgramOptions ( char const *  argv0)
inline

Definition at line 244 of file MapDServer.cpp.

References fillAdvancedOptions(), and fillOptions().

244  : log_options_(argv0) {
245  fillOptions();
247  }
void fillAdvancedOptions()
Definition: MapDServer.cpp:540
logger::LogOptions log_options_
Definition: MapDServer.cpp:313
+ Here is the call graph for this function:

◆ MapDProgramOptions() [2/2]

MapDProgramOptions::MapDProgramOptions ( )

Member Function Documentation

◆ fillAdvancedOptions() [1/2]

void MapDProgramOptions::fillAdvancedOptions ( boost::program_options::options_description &  desc_adv)
private

◆ fillAdvancedOptions() [2/2]

void MapDProgramOptions::fillAdvancedOptions ( )
private

Definition at line 540 of file MapDServer.cpp.

References allow_multifrag, developer_desc, MapDParameters::enable_calcite_view_optimize, enable_legacy_syntax, g_enable_bump_allocator, g_enable_columnar_output, g_enable_smem_group_by, g_enable_window_functions, g_max_memory_allocation_size, g_min_memory_allocation_size, g_skip_intermediate_count, g_strip_join_covered_quals, intel_jit_profile, jit_debug, mapd_parameters, MapDParameters::ssl_cert_file, MapDParameters::ssl_key_file, MapDParameters::ssl_keystore, MapDParameters::ssl_keystore_password, MapDParameters::ssl_trust_password, MapDParameters::ssl_trust_store, and udf_file_name.

Referenced by MapDProgramOptions().

540  {
541  developer_desc.add_options()("dev-options", "Print internal developer options.");
542  developer_desc.add_options()(
543  "enable-calcite-view-optimize",
546  ->implicit_value(true),
547  "Enable additional calcite (query plan) optimizations when a view is part of the "
548  "query.");
549  developer_desc.add_options()(
550  "enable-columnar-output",
551  po::value<bool>(&g_enable_columnar_output)
552  ->default_value(g_enable_columnar_output)
553  ->implicit_value(true),
554  "Enable columnar output for intermediate/final query steps.");
555  developer_desc.add_options()("enable-legacy-syntax",
556  po::value<bool>(&enable_legacy_syntax)
557  ->default_value(enable_legacy_syntax)
558  ->implicit_value(true),
559  "Enable legacy syntax.");
560  developer_desc.add_options()(
561  "enable-multifrag",
562  po::value<bool>(&allow_multifrag)
563  ->default_value(allow_multifrag)
564  ->implicit_value(true),
565  "Enable execution over multiple fragments in a single round-trip to GPU.");
566  developer_desc.add_options()(
567  "enable-shared-mem-group-by",
568  po::value<bool>(&g_enable_smem_group_by)
569  ->default_value(g_enable_smem_group_by)
570  ->implicit_value(true),
571  "Enable using GPU shared memory for some GROUP BY queries.");
572  developer_desc.add_options()("enable-window-functions",
573  po::value<bool>(&g_enable_window_functions)
574  ->default_value(g_enable_window_functions)
575  ->implicit_value(true),
576  "Enable experimental window function support.");
577  developer_desc.add_options()(
578  "jit-debug-ir",
579  po::value<bool>(&jit_debug)->default_value(jit_debug)->implicit_value(true),
580  "Enable runtime debugger support for the JIT. Note that this flag is incompatible "
581  "with the `ENABLE_JIT_DEBUG` build flag. The generated code can be found at "
582  "`/tmp/mapdquery`.");
583  developer_desc.add_options()(
584  "intel-jit-profile",
585  po::value<bool>(&intel_jit_profile)
586  ->default_value(intel_jit_profile)
587  ->implicit_value(true),
588  "Enable runtime support for the JIT code profiling using Intel VTune.");
589  developer_desc.add_options()(
590  "skip-intermediate-count",
591  po::value<bool>(&g_skip_intermediate_count)
592  ->default_value(g_skip_intermediate_count)
593  ->implicit_value(true),
594  "Skip pre-flight counts for intermediate projections with no filters.");
595  developer_desc.add_options()(
596  "strip-join-covered-quals",
597  po::value<bool>(&g_strip_join_covered_quals)
598  ->default_value(g_strip_join_covered_quals)
599  ->implicit_value(true),
600  "Remove quals from the filtered count if they are covered by a "
601  "join condition (currently only ST_Contains).");
602  developer_desc.add_options()(
603  "max-output-projection-allocation-bytes",
604  po::value<size_t>(&g_max_memory_allocation_size)
605  ->default_value(g_max_memory_allocation_size),
606  "Maximum allocation size for a fixed output buffer allocation for projection "
607  "queries with no pre-flight count. Default is the maximum slab size (sizes greater "
608  "than the maximum slab size have no affect). Requires bump allocator.");
609  developer_desc.add_options()(
610  "min-output-projection-allocation-bytes",
611  po::value<size_t>(&g_min_memory_allocation_size)
612  ->default_value(g_min_memory_allocation_size),
613  "Minimum allocation size for a fixed output buffer allocation for projection "
614  "queries with no pre-flight count. If an allocation of this size cannot be "
615  "obtained, the query will be retried with different execution parameters and/or on "
616  "CPU (if allow-cpu-retry is enabled). Requires bump allocator.");
617  developer_desc.add_options()(
618  "enable-bump-allocator",
619  po::value<bool>(&g_enable_bump_allocator)
620  ->default_value(g_enable_bump_allocator)
621  ->implicit_value(true),
622  "Enable the bump allocator for projection queries on GPU. The bump allocator will "
623  "allocate a fixed size buffer for each query, track the number of rows passing the "
624  "kernel during query execution, and copy back only the rows that passed the kernel "
625  "to CPU after execution. When disabled, pre-flight count queries are used to size "
626  "the output buffer for projection queries.");
627  developer_desc.add_options()("ssl-cert",
628  po::value<std::string>(&mapd_parameters.ssl_cert_file)
629  ->default_value(std::string("")),
630  "SSL Validated public certficate.");
631  developer_desc.add_options()("ssl-private-key",
632  po::value<std::string>(&mapd_parameters.ssl_key_file)
633  ->default_value(std::string("")),
634  "SSL private key file.");
635  // Note ssl_trust_store is passed through to Calcite via mapd_parameters
636  // todo(jack): add ensure ssl-trust-store exists if cert and private key in use
637  developer_desc.add_options()("ssl-trust-store",
638  po::value<std::string>(&mapd_parameters.ssl_trust_store)
639  ->default_value(std::string("")),
640  "SSL Validated public cert as a java trust store.");
641  developer_desc.add_options()("ssl-trust-password",
642  po::value<std::string>(&mapd_parameters.ssl_trust_password)
643  ->default_value(std::string("")),
644  "SSL java trust store password.");
645 
646  developer_desc.add_options()("ssl-keystore",
647  po::value<std::string>(&mapd_parameters.ssl_keystore)
648  ->default_value(std::string("")),
649  "SSL server credentials as a java key store.");
650  developer_desc.add_options()(
651  "ssl-keystore-password",
652  po::value<std::string>(&mapd_parameters.ssl_keystore_password)
653  ->default_value(std::string("")),
654  "SSL server keystore password.");
655  developer_desc.add_options()(
656  "udf",
657  po::value<std::string>(&udf_file_name),
658  "Load user defined extension functions from this file at startup. The file is "
659  "expected to be a C/C++ file with extension .cpp.");
660 };
bool g_enable_smem_group_by
bool enable_calcite_view_optimize
bool g_enable_bump_allocator
Definition: Execute.cpp:96
bool g_strip_join_covered_quals
Definition: Execute.cpp:88
std::string ssl_key_file
std::string ssl_trust_store
std::string udf_file_name
Definition: MapDServer.cpp:302
size_t g_max_memory_allocation_size
Definition: Execute.cpp:92
bool g_enable_columnar_output
Definition: Execute.cpp:84
MapDParameters mapd_parameters
Definition: MapDServer.cpp:265
po::options_description developer_desc
Definition: MapDServer.cpp:312
size_t g_min_memory_allocation_size
Definition: Execute.cpp:93
std::string ssl_keystore
std::string ssl_keystore_password
std::string ssl_trust_password
std::string ssl_cert_file
bool g_enable_window_functions
Definition: Execute.cpp:91
bool g_skip_intermediate_count
+ Here is the caller graph for this function:

◆ fillOptions() [1/2]

void MapDProgramOptions::fillOptions ( boost::program_options::options_description &  desc)
private

◆ fillOptions() [2/2]

void MapDProgramOptions::fillOptions ( )
private

Definition at line 323 of file MapDServer.cpp.

References allow_loop_joins, base_path, MapDParameters::calcite_max_mem, MapDParameters::calcite_port, config_file, MapDParameters::cpu_buffer_mem_bytes, cpu_only, MapDParameters::cuda_block_size, MapDParameters::cuda_grid_size, db_query_file, dynamic_watchdog_time_limit, enable_dynamic_watchdog, enable_runtime_udf, enable_watchdog, flush_log, g_allow_cpu_retry, g_bigint_count, g_cache_string_hash, g_enable_debug_timer, g_enable_filter_push_down, g_enable_overlaps_hashjoin, g_enable_thrift_logs, g_filter_push_down_high_frac, g_filter_push_down_low_frac, g_filter_push_down_passing_row_ubound, g_from_table_reordering, g_hll_precision_bits, g_inner_join_fragment_skipping, g_null_div_by_zero, g_overlaps_max_table_size_bytes, g_trivial_loop_join_threshold, logger::LogOptions::get_options(), MapDParameters::gpu_buffer_mem_bytes, MapDParameters::gpu_input_mem_limit, help_desc, http_port, idle_session_duration, log_options_, mapd_parameters, max_session_duration, num_gpus, num_reader_threads, MapDParameters::omnisci_server_port, read_only, run-benchmark-import::required, reserved_gpu_mem, start_gpu, and verbose_logging.

Referenced by MapDProgramOptions().

323  {
324  help_desc.add_options()("help,h", "Show available options.");
325  help_desc.add_options()(
326  "allow-cpu-retry",
327  po::value<bool>(&g_allow_cpu_retry)
328  ->default_value(g_allow_cpu_retry)
329  ->implicit_value(true),
330  R"(Allow the queries which failed on GPU to retry on CPU, even when watchdog is enabled.)");
331  help_desc.add_options()("allow-loop-joins",
332  po::value<bool>(&allow_loop_joins)
333  ->default_value(allow_loop_joins)
334  ->implicit_value(true),
335  "Enable loop joins.");
336  help_desc.add_options()("bigint-count",
337  po::value<bool>(&g_bigint_count)
338  ->default_value(g_bigint_count)
339  ->implicit_value(false),
340  "Use 64-bit count.");
341  help_desc.add_options()("calcite-max-mem",
342  po::value<size_t>(&mapd_parameters.calcite_max_mem)
343  ->default_value(mapd_parameters.calcite_max_mem),
344  "Max memory available to calcite JVM.");
345  help_desc.add_options()("calcite-port",
346  po::value<int>(&mapd_parameters.calcite_port)
347  ->default_value(mapd_parameters.calcite_port),
348  "Calcite port number.");
349  help_desc.add_options()("config",
350  po::value<std::string>(&config_file),
351  "Path to server configuration file.");
352  help_desc.add_options()("cpu-buffer-mem-bytes",
353  po::value<size_t>(&mapd_parameters.cpu_buffer_mem_bytes)
354  ->default_value(mapd_parameters.cpu_buffer_mem_bytes),
355  "Size of memory reserved for CPU buffers, in bytes.");
356  help_desc.add_options()(
357  "cpu-only",
358  po::value<bool>(&cpu_only)->default_value(cpu_only)->implicit_value(true),
359  "Run on CPU only, even if GPUs are available.");
360  help_desc.add_options()("cuda-block-size",
361  po::value<size_t>(&mapd_parameters.cuda_block_size)
362  ->default_value(mapd_parameters.cuda_block_size),
363  "Size of block to use on GPU.");
364  help_desc.add_options()("cuda-grid-size",
365  po::value<size_t>(&mapd_parameters.cuda_grid_size)
366  ->default_value(mapd_parameters.cuda_grid_size),
367  "Size of grid to use on GPU.");
368  help_desc.add_options()(
369  "data",
370  po::value<std::string>(&base_path)->required()->default_value("data"),
371  "Directory path to OmniSci data storage (catalogs, raw data, log files, etc).");
372  help_desc.add_options()("db-query-list",
373  po::value<std::string>(&db_query_file),
374  "Path to file containing OmniSci warmup queries.");
375  help_desc.add_options()("dynamic-watchdog-time-limit",
376  po::value<unsigned>(&dynamic_watchdog_time_limit)
377  ->default_value(dynamic_watchdog_time_limit)
378  ->implicit_value(10000),
379  "Dynamic watchdog time limit, in milliseconds.");
380  help_desc.add_options()("enable-debug-timer",
381  po::value<bool>(&g_enable_debug_timer)
382  ->default_value(g_enable_debug_timer)
383  ->implicit_value(true),
384  "Enable debug timer logging.");
385  help_desc.add_options()("enable-dynamic-watchdog",
386  po::value<bool>(&enable_dynamic_watchdog)
387  ->default_value(enable_dynamic_watchdog)
388  ->implicit_value(true),
389  "Enable dynamic watchdog.");
390  help_desc.add_options()("enable-filter-push-down",
391  po::value<bool>(&g_enable_filter_push_down)
392  ->default_value(g_enable_filter_push_down)
393  ->implicit_value(true),
394  "Enable filter push down through joins.");
395  help_desc.add_options()("enable-overlaps-hashjoin",
396  po::value<bool>(&g_enable_overlaps_hashjoin)
397  ->default_value(g_enable_overlaps_hashjoin)
398  ->implicit_value(true),
399  "Enable the overlaps hash join framework allowing for range "
400  "join (e.g. spatial overlaps) computation using a hash table.");
401  help_desc.add_options()(
402  "enable-string-dict-hash-cache",
403  po::value<bool>(&g_cache_string_hash)
404  ->default_value(g_cache_string_hash)
405  ->implicit_value(true),
406  "Cache string hash values in the string dictionary server during import.");
407  help_desc.add_options()(
408  "enable-thrift-logs",
409  po::value<bool>(&g_enable_thrift_logs)
410  ->default_value(g_enable_thrift_logs)
411  ->implicit_value(true),
412  "Enable writing messages directly from thrift to stdout/stderr.");
413  help_desc.add_options()("enable-watchdog",
414  po::value<bool>(&enable_watchdog)
415  ->default_value(enable_watchdog)
416  ->implicit_value(true),
417  "Enable watchdog.");
418  help_desc.add_options()(
419  "filter-push-down-low-frac",
420  po::value<float>(&g_filter_push_down_low_frac)
421  ->default_value(g_filter_push_down_low_frac)
422  ->implicit_value(g_filter_push_down_low_frac),
423  "Lower threshold for selectivity of filters that are pushed down.");
424  help_desc.add_options()(
425  "filter-push-down-high-frac",
426  po::value<float>(&g_filter_push_down_high_frac)
427  ->default_value(g_filter_push_down_high_frac)
428  ->implicit_value(g_filter_push_down_high_frac),
429  "Higher threshold for selectivity of filters that are pushed down.");
430  help_desc.add_options()("filter-push-down-passing-row-ubound",
431  po::value<size_t>(&g_filter_push_down_passing_row_ubound)
433  ->implicit_value(g_filter_push_down_passing_row_ubound),
434  "Upperbound on the number of rows that should pass the filter "
435  "if the selectivity is less than "
436  "the high fraction threshold.");
437  help_desc.add_options()("from-table-reordering",
438  po::value<bool>(&g_from_table_reordering)
439  ->default_value(g_from_table_reordering)
440  ->implicit_value(true),
441  "Enable automatic table reordering in FROM clause.");
442  help_desc.add_options()("gpu-buffer-mem-bytes",
443  po::value<size_t>(&mapd_parameters.gpu_buffer_mem_bytes)
444  ->default_value(mapd_parameters.gpu_buffer_mem_bytes),
445  "Size of memory reserved for GPU buffers, in bytes, per GPU.");
446  help_desc.add_options()("gpu-input-mem-limit",
447  po::value<double>(&mapd_parameters.gpu_input_mem_limit)
448  ->default_value(mapd_parameters.gpu_input_mem_limit),
449  "Force query to CPU when input data memory usage exceeds this "
450  "percentage of available GPU memory.");
451  help_desc.add_options()(
452  "hll-precision-bits",
453  po::value<int>(&g_hll_precision_bits)
454  ->default_value(g_hll_precision_bits)
455  ->implicit_value(g_hll_precision_bits),
456  "Number of bits used from the hash value used to specify the bucket number.");
457  help_desc.add_options()("http-port",
458  po::value<int>(&http_port)->default_value(http_port),
459  "HTTP port number.");
460  help_desc.add_options()(
461  "idle-session-duration",
462  po::value<int>(&idle_session_duration)->default_value(idle_session_duration),
463  "Maximum duration of idle session.");
464  help_desc.add_options()("inner-join-fragment-skipping",
465  po::value<bool>(&g_inner_join_fragment_skipping)
466  ->default_value(g_inner_join_fragment_skipping)
467  ->implicit_value(true),
468  "Enable/disable inner join fragment skipping. This feature is "
469  "considered stable and is enabled by default. This "
470  "parameter will be removed in a future release.");
471  help_desc.add_options()(
472  "max-session-duration",
473  po::value<int>(&max_session_duration)->default_value(max_session_duration),
474  "Maximum duration of active session.");
475  help_desc.add_options()(
476  "null-div-by-zero",
477  po::value<bool>(&g_null_div_by_zero)
478  ->default_value(g_null_div_by_zero)
479  ->implicit_value(true),
480  "Return null on division by zero instead of throwing an exception.");
481  help_desc.add_options()(
482  "num-reader-threads",
483  po::value<size_t>(&num_reader_threads)->default_value(num_reader_threads),
484  "Number of reader threads to use.");
485  help_desc.add_options()(
486  "overlaps-max-table-size-bytes",
487  po::value<size_t>(&g_overlaps_max_table_size_bytes)
488  ->default_value(g_overlaps_max_table_size_bytes),
489  "The maximum size in bytes of the hash table for an overlaps hash join.");
490  help_desc.add_options()("port,p",
491  po::value<int>(&mapd_parameters.omnisci_server_port)
492  ->default_value(mapd_parameters.omnisci_server_port),
493  "TCP Port number.");
494  help_desc.add_options()("num-gpus",
495  po::value<int>(&num_gpus)->default_value(num_gpus),
496  "Number of gpus to use.");
497  help_desc.add_options()(
498  "read-only",
499  po::value<bool>(&read_only)->default_value(read_only)->implicit_value(true),
500  "Enable read-only mode.");
501  help_desc.add_options()(
502  "res-gpu-mem",
503  po::value<size_t>(&reserved_gpu_mem)->default_value(reserved_gpu_mem),
504  "Reduces GPU memory available to the OmniSci allocator by this amount. Used for "
505  "compiled code cache and ancillary GPU functions and other processes that may also "
506  "be using the GPU concurrent with OmniSciDB.");
507  help_desc.add_options()("start-gpu",
508  po::value<int>(&start_gpu)->default_value(start_gpu),
509  "First gpu to use.");
510  help_desc.add_options()("trivial-loop-join-threshold",
511  po::value<unsigned>(&g_trivial_loop_join_threshold)
512  ->default_value(g_trivial_loop_join_threshold)
513  ->implicit_value(1000),
514  "The maximum number of rows in the inner table of a loop join "
515  "considered to be trivially small.");
516  help_desc.add_options()("verbose",
517  po::value<bool>(&verbose_logging)
518  ->default_value(verbose_logging)
519  ->implicit_value(true),
520  "Write additional debug log messages to server logs.");
521  help_desc.add_options()(
522  "enable-runtime-udf",
523  po::value<bool>(&enable_runtime_udf)
524  ->default_value(enable_runtime_udf)
525  ->implicit_value(true),
526  "Enable runtime UDF registration by passing signatures and corresponding LLVM IR "
527  "to the `register_runtime_udf` endpoint. For use with the Python Remote Backend "
528  "Compiler server, packaged separately.");
529  help_desc.add_options()("version,v", "Print Version Number.");
530 
531  help_desc.add_options()(
532  "flush-log",
533  po::value<bool>(&flush_log)->default_value(flush_log)->implicit_value(true),
534  R"(DEPRECATED - Immediately flush logs to disk. Set to false if this is a performance bottleneck.)"
535  " Replaced by log-auto-flush.");
536 
538 }
float g_filter_push_down_low_frac
Definition: Execute.cpp:81
bool g_cache_string_hash
Definition: Execute.cpp:86
size_t gpu_buffer_mem_bytes
boost::program_options::options_description const & get_options() const
Definition: Logger.cpp:112
size_t g_filter_push_down_passing_row_ubound
Definition: Execute.cpp:83
unsigned g_trivial_loop_join_threshold
Definition: Execute.cpp:74
int g_hll_precision_bits
size_t cuda_block_size
po::options_description help_desc
Definition: MapDServer.cpp:311
bool g_enable_overlaps_hashjoin
Definition: Execute.cpp:85
bool g_enable_debug_timer
Definition: Execute.cpp:68
bool g_inner_join_fragment_skipping
Definition: Execute.cpp:76
bool g_null_div_by_zero
Definition: Execute.cpp:73
MapDParameters mapd_parameters
Definition: MapDServer.cpp:265
bool g_from_table_reordering
Definition: Execute.cpp:75
unsigned dynamic_watchdog_time_limit
Definition: MapDServer.cpp:277
size_t cuda_grid_size
float g_filter_push_down_high_frac
Definition: Execute.cpp:82
bool g_bigint_count
std::string base_path
Definition: MapDServer.cpp:250
size_t g_overlaps_max_table_size_bytes
Definition: Execute.cpp:87
std::string config_file
Definition: MapDServer.cpp:251
size_t calcite_max_mem
std::string db_query_file
Definition: MapDServer.cpp:292
double gpu_input_mem_limit
size_t cpu_buffer_mem_bytes
bool g_enable_filter_push_down
Definition: Execute.cpp:80
bool g_allow_cpu_retry
Definition: Execute.cpp:72
bool g_enable_thrift_logs
Definition: MapDServer.cpp:67
logger::LogOptions log_options_
Definition: MapDServer.cpp:313
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_command_line() [1/2]

bool MapDProgramOptions::parse_command_line ( int  argc,
char **  argv,
int &  return_code 
)

◆ parse_command_line() [2/2]

boost::optional< int > MapDProgramOptions::parse_command_line ( int  argc,
char const *const *  argv 
)

Definition at line 690 of file MapDServer.cpp.

References AuthMetadata::allowLocalAuthFallback, authMetadata, base_path, MapDParameters::calcite_max_mem, MapDParameters::calcite_port, File_Namespace::close(), config_file, MapDParameters::cuda_block_size, MapDParameters::cuda_grid_size, db_query_file, logger::DEBUG1, developer_desc, AuthMetadata::distinguishedName, dynamic_watchdog_time_limit, MapDParameters::enable_calcite_view_optimize, enable_dynamic_watchdog, enable_runtime_udf, enable_watchdog, logger::ERROR, g_dynamic_watchdog_time_limit, g_enable_debug_timer, g_enable_dynamic_watchdog, g_enable_filter_push_down, g_enable_watchdog, g_from_table_reordering, MapDParameters::ha_brokers, MapDParameters::ha_group_id, MapDParameters::ha_shared_data, MapDParameters::ha_unique_server_id, help_desc, idle_session_duration, logger::INFO, logger::init(), AuthMetadata::ldapQueryUrl, AuthMetadata::ldapRoleRegex, AuthMetadata::ldapSuperUserRole, LOG, log_options_, mapd_parameters, MAPD_RELEASE, max_session_duration, MapDParameters::omnisci_server_port, OMNISCI_SYSTEM_CATALOG, File_Namespace::open(), AuthMetadata::restToken, AuthMetadata::restUrl, run, anonymous_namespace{MapDServer.cpp}::sanitize_config_file(), logger::LogOptions::set_base_path(), logger::LogOptions::severity_, MapDParameters::ssl_cert_file, MapDParameters::ssl_key_file, MapDParameters::ssl_keystore, MapDParameters::ssl_trust_store, temporarily_support_deprecated_log_options_201904(), to_string(), anonymous_namespace{MapDServer.cpp}::trim_and_check_file_exists(), udf_file_name, AuthMetadata::uri, verbose_logging, vm, and File_Namespace::write().

Referenced by main().

691  {
692  po::positional_options_description positional_options;
693  positional_options.add("data", 1);
694 
695  po::options_description all_desc("All options");
696  all_desc.add(help_desc).add(developer_desc);
697 
698  try {
699  po::store(po::command_line_parser(argc, argv)
700  .options(all_desc)
701  .positional(positional_options)
702  .run(),
703  vm);
704  po::notify(vm);
705 
706  if (vm.count("config")) {
707  std::ifstream settings_file(config_file);
708 
709  auto sanitized_settings = sanitize_config_file(settings_file);
710 
711  po::store(po::parse_config_file(sanitized_settings, all_desc, false), vm);
712  po::notify(vm);
713  settings_file.close();
714  }
715 
717  return 1;
718  }
720  return 1;
721  }
723  return 1;
724  }
726  return 1;
727  }
728 
729  if (vm.count("help")) {
730  std::cout << "Usage: omnisci_server <data directory path> [-p <port number>] "
731  "[--http-port <http port number>] [--flush-log] [--version|-v]"
732  << std::endl
733  << std::endl;
734  std::cout << help_desc << std::endl;
735  return 0;
736  }
737  if (vm.count("dev-options")) {
738  std::cout << "Usage: omnisci_server <data directory path> [-p <port number>] "
739  "[--http-port <http port number>] [--flush-log] [--version|-v]"
740  << std::endl
741  << std::endl;
742  std::cout << developer_desc << std::endl;
743  return 0;
744  }
745  if (vm.count("version")) {
746  std::cout << "OmniSci Version: " << MAPD_RELEASE << std::endl;
747  return 0;
748  }
749 
753  } catch (po::error& e) {
754  std::cerr << "Usage Error: " << e.what() << std::endl;
755  return 1;
756  }
757 
758  if (g_hll_precision_bits < 1 || g_hll_precision_bits > 16) {
759  std::cerr << "hll-precision-bits must be between 1 and 16." << std::endl;
760  return 1;
761  }
762 
763  boost::algorithm::trim_if(base_path, boost::is_any_of("\"'"));
764  const auto data_path = boost::filesystem::path(base_path) / "mapd_data";
765  if (!boost::filesystem::exists(data_path)) {
766  std::cerr << "OmniSci data directory does not exist at '" << base_path
767  << "'. Run initdb " << base_path << std::endl;
768  return 1;
769  }
770 
771  const auto lock_file = boost::filesystem::path(base_path) / "omnisci_server_pid.lck";
772  auto pid = std::to_string(getpid());
773  int pid_fd = open(lock_file.c_str(), O_RDWR | O_CREAT, 0644);
774  if (pid_fd == -1) {
775  auto err = std::string("Failed to open PID file ") + std::string(lock_file.c_str()) +
776  std::string(". ") + strerror(errno) + ".";
777  std::cerr << err << std::endl;
778  return 1;
779  }
780  if (lockf(pid_fd, F_TLOCK, 0) == -1) {
781  auto err = std::string("Another OmniSci Server is using data directory ") +
782  base_path + std::string(".");
783  std::cerr << err << std::endl;
784  close(pid_fd);
785  return 1;
786  }
787  if (ftruncate(pid_fd, 0) == -1) {
788  auto err = std::string("Failed to truncate PID file ") +
789  std::string(lock_file.c_str()) + std::string(". ") + strerror(errno) +
790  std::string(".");
791  std::cerr << err << std::endl;
792  close(pid_fd);
793  return 1;
794  }
795  if (write(pid_fd, pid.c_str(), pid.length()) == -1) {
796  auto err = std::string("Failed to write PID file ") + std::string(lock_file.c_str()) +
797  ". " + strerror(errno) + ".";
798  std::cerr << err << std::endl;
799  close(pid_fd);
800  return 1;
801  }
802 
806  }
809 
810  boost::algorithm::trim_if(db_query_file, boost::is_any_of("\"'"));
811  if (db_query_file.length() > 0 && !boost::filesystem::exists(db_query_file)) {
812  LOG(ERROR) << "File containing DB queries " << db_query_file << " does not exist.";
813  return 1;
814  }
815  const auto db_file =
816  boost::filesystem::path(base_path) / "mapd_catalogs" / OMNISCI_SYSTEM_CATALOG;
817  if (!boost::filesystem::exists(db_file)) {
818  { // check old system catalog existsense
819  const auto db_file = boost::filesystem::path(base_path) / "mapd_catalogs/mapd";
820  if (!boost::filesystem::exists(db_file)) {
821  LOG(ERROR) << "OmniSci system catalog " << OMNISCI_SYSTEM_CATALOG
822  << " does not exist.";
823  return 1;
824  }
825  }
826  }
827  // add all parameters to be displayed on startup
828  LOG(INFO) << "OmniSci started with data directory at '" << base_path << "'";
829  LOG(INFO) << " Watchdog is set to " << enable_watchdog;
830  LOG(INFO) << " Dynamic Watchdog is set to " << enable_dynamic_watchdog;
832  LOG(INFO) << " Dynamic Watchdog timeout is set to " << dynamic_watchdog_time_limit;
833  }
834 
835  LOG(INFO) << " Debug Timer is set to " << g_enable_debug_timer;
836 
837  LOG(INFO) << " Maximum Idle session duration " << idle_session_duration;
838 
839  LOG(INFO) << " Maximum active session duration " << max_session_duration;
840 
842  LOG(INFO) << " From clause table reordering is disabled";
843  }
844 
846  LOG(INFO) << " Filter push down for JOIN is enabled";
847  }
848 
849  if (vm.count("udf")) {
850  boost::algorithm::trim_if(udf_file_name, boost::is_any_of("\"'"));
851 
852  if (!boost::filesystem::exists(udf_file_name)) {
853  LOG(ERROR) << " User defined function file " << udf_file_name << " does not exist.";
854  return 1;
855  }
856 
857  LOG(INFO) << " User provided extension functions loaded from " << udf_file_name;
858  }
859 
860  if (enable_runtime_udf) {
861  LOG(INFO) << " Runtime user defined extension functions enabled globally.";
862  }
863 
864  boost::algorithm::trim_if(mapd_parameters.ha_brokers, boost::is_any_of("\"'"));
865  boost::algorithm::trim_if(mapd_parameters.ha_group_id, boost::is_any_of("\"'"));
866  boost::algorithm::trim_if(mapd_parameters.ha_shared_data, boost::is_any_of("\"'"));
867  boost::algorithm::trim_if(mapd_parameters.ha_unique_server_id, boost::is_any_of("\"'"));
868 
869  if (!mapd_parameters.ha_group_id.empty()) {
870  LOG(INFO) << " HA group id " << mapd_parameters.ha_group_id;
871  if (mapd_parameters.ha_unique_server_id.empty()) {
872  LOG(ERROR) << "Starting server in HA mode --ha-unique-server-id must be set ";
873  return 5;
874  } else {
875  LOG(INFO) << " HA unique server id " << mapd_parameters.ha_unique_server_id;
876  }
877  if (mapd_parameters.ha_brokers.empty()) {
878  LOG(ERROR) << "Starting server in HA mode --ha-brokers must be set ";
879  return 6;
880  } else {
881  LOG(INFO) << " HA brokers " << mapd_parameters.ha_brokers;
882  }
883  if (mapd_parameters.ha_shared_data.empty()) {
884  LOG(ERROR) << "Starting server in HA mode --ha-shared-data must be set ";
885  return 7;
886  } else {
887  LOG(INFO) << " HA shared data is " << mapd_parameters.ha_shared_data;
888  }
889  }
890  LOG(INFO) << " cuda block size " << mapd_parameters.cuda_block_size;
891  LOG(INFO) << " cuda grid size " << mapd_parameters.cuda_grid_size;
892  LOG(INFO) << " calcite JVM max memory " << mapd_parameters.calcite_max_mem;
893  LOG(INFO) << " OmniSci Server Port " << mapd_parameters.omnisci_server_port;
894  LOG(INFO) << " OmniSci Calcite Port " << mapd_parameters.calcite_port;
895  LOG(INFO) << " Enable Calcite view optimize "
897 
898  LOG(INFO) << " Allow Local Auth Fallback: "
899  << (authMetadata.allowLocalAuthFallback ? "enabled" : "disabled");
900 
901  boost::algorithm::trim_if(authMetadata.distinguishedName, boost::is_any_of("\"'"));
902  boost::algorithm::trim_if(authMetadata.uri, boost::is_any_of("\"'"));
903  boost::algorithm::trim_if(authMetadata.ldapQueryUrl, boost::is_any_of("\"'"));
904  boost::algorithm::trim_if(authMetadata.ldapRoleRegex, boost::is_any_of("\"'"));
905  boost::algorithm::trim_if(authMetadata.ldapSuperUserRole, boost::is_any_of("\"'"));
906  boost::algorithm::trim_if(authMetadata.restToken, boost::is_any_of("\"'"));
907  boost::algorithm::trim_if(authMetadata.restUrl, boost::is_any_of("\"'"));
908 
909  return boost::none;
910 }
std::string distinguishedName
Definition: AuthMetadata.h:26
std::string ldapQueryUrl
Definition: AuthMetadata.h:27
bool enable_calcite_view_optimize
std::string ssl_key_file
#define LOG(tag)
Definition: Logger.h:182
std::string ldapRoleRegex
Definition: AuthMetadata.h:28
void temporarily_support_deprecated_log_options_201904()
Definition: MapDServer.cpp:917
std::string ssl_trust_store
const std::string OMNISCI_SYSTEM_CATALOG
Definition: SysCatalog.h:57
std::string udf_file_name
Definition: MapDServer.cpp:302
bool g_enable_dynamic_watchdog
Definition: Execute.cpp:70
size_t cuda_block_size
po::options_description help_desc
Definition: MapDServer.cpp:311
std::string to_string(char const *&&v)
bool g_enable_debug_timer
Definition: Execute.cpp:68
std::string ha_shared_data
std::string restToken
Definition: AuthMetadata.h:32
MapDParameters mapd_parameters
Definition: MapDServer.cpp:265
po::options_description developer_desc
Definition: MapDServer.cpp:312
bool g_from_table_reordering
Definition: Execute.cpp:75
std::string ssl_keystore
void init(LogOptions const &log_opts)
Definition: Logger.cpp:260
std::string restUrl
Definition: AuthMetadata.h:31
unsigned dynamic_watchdog_time_limit
Definition: MapDServer.cpp:277
size_t cuda_grid_size
std::string uri
Definition: AuthMetadata.h:25
std::string base_path
Definition: MapDServer.cpp:250
std::string ssl_cert_file
std::string config_file
Definition: MapDServer.cpp:251
po::variables_map vm
Definition: MapDServer.cpp:314
size_t calcite_max_mem
std::string ldapSuperUserRole
Definition: AuthMetadata.h:29
bool trim_and_check_file_exists(std::string &filename, const std::string desc)
Definition: MapDServer.cpp:677
std::string ha_brokers
AuthMetadata authMetadata
Definition: MapDServer.cpp:263
std::string db_query_file
Definition: MapDServer.cpp:292
std::stringstream sanitize_config_file(std::ifstream &in)
Definition: MapDServer.cpp:664
Severity severity_
Definition: Logger.h:113
bool g_enable_filter_push_down
Definition: Execute.cpp:80
FILE * open(int fileId)
Opens/creates the file with the given id; returns NULL on error.
Definition: File.cpp:83
bool allowLocalAuthFallback
Definition: AuthMetadata.h:33
size_t write(FILE *f, const size_t offset, const size_t size, int8_t *buf)
Writes the specified number of bytes to the offset position in file f from buf.
Definition: File.cpp:121
void set_base_path(std::string const &base_path)
Definition: Logger.cpp:126
void close(FILE *f)
Closes the file pointed to by the FILE pointer.
Definition: File.cpp:102
bool g_enable_watchdog
Definition: Execute.cpp:69
std::string ha_group_id
static const std::string MAPD_RELEASE
Definition: release.h:43
static bool run
unsigned g_dynamic_watchdog_time_limit
Definition: Execute.cpp:71
logger::LogOptions log_options_
Definition: MapDServer.cpp:313
std::string ha_unique_server_id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ temporarily_support_deprecated_log_options_201904()

void MapDProgramOptions::temporarily_support_deprecated_log_options_201904 ( )
private

Definition at line 917 of file MapDServer.cpp.

References logger::LogOptions::auto_flush_, flush_log, and log_options_.

Referenced by parse_command_line().

917  {
918  if (!flush_log) {
919  log_options_.auto_flush_ = false;
920  }
921 }
logger::LogOptions log_options_
Definition: MapDServer.cpp:313
+ Here is the caller graph for this function:

Member Data Documentation

◆ allow_loop_joins

bool MapDProgramOptions::allow_loop_joins = false

Definition at line 261 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ allow_multifrag

bool MapDProgramOptions::allow_multifrag = true

Definition at line 259 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), and main().

◆ authMetadata

AuthMetadata MapDProgramOptions::authMetadata

Definition at line 263 of file MapDServer.cpp.

Referenced by main(), and parse_command_line().

◆ base_path

std::string MapDProgramOptions::base_path

Definition at line 250 of file MapDServer.cpp.

Referenced by fillOptions(), main(), and parse_command_line().

◆ cluster_file

std::string MapDProgramOptions::cluster_file = {"cluster.conf"}

Definition at line 252 of file MapDServer.cpp.

◆ config_file

std::string MapDProgramOptions::config_file = {"mapd.conf"}

Definition at line 251 of file MapDServer.cpp.

Referenced by fillOptions(), and parse_command_line().

◆ cpu_only

bool MapDProgramOptions::cpu_only = false

Definition at line 254 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ db_leaves

std::vector< LeafHostInfo > MapDProgramOptions::db_leaves

Definition at line 317 of file MapDServer.cpp.

Referenced by main().

◆ db_query_file

std::string MapDProgramOptions::db_query_file = {""}

path to file containing warmup queries list

Definition at line 292 of file MapDServer.cpp.

Referenced by fillOptions(), main(), and parse_command_line().

◆ developer_desc

po::options_description MapDProgramOptions::developer_desc
private

Definition at line 312 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), and parse_command_line().

◆ dynamic_watchdog_time_limit

unsigned MapDProgramOptions::dynamic_watchdog_time_limit = 10000

Definition at line 277 of file MapDServer.cpp.

Referenced by fillOptions(), and parse_command_line().

◆ enable_auto_clear_render_mem

bool MapDProgramOptions::enable_auto_clear_render_mem = false

Definition at line 268 of file MapDServer.cpp.

Referenced by main().

◆ enable_dynamic_watchdog

bool MapDProgramOptions::enable_dynamic_watchdog = false

Definition at line 276 of file MapDServer.cpp.

Referenced by fillOptions(), and parse_command_line().

◆ enable_legacy_syntax

bool MapDProgramOptions::enable_legacy_syntax = true

Definition at line 262 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), and main().

◆ enable_rendering

bool MapDProgramOptions::enable_rendering = false

Definition at line 266 of file MapDServer.cpp.

Referenced by main().

◆ enable_runtime_udf

bool MapDProgramOptions::enable_runtime_udf = false

Definition at line 273 of file MapDServer.cpp.

Referenced by fillOptions(), main(), and parse_command_line().

◆ enable_spirv

bool MapDProgramOptions::enable_spirv = false

Definition at line 267 of file MapDServer.cpp.

Referenced by main().

◆ enable_watchdog

bool MapDProgramOptions::enable_watchdog = true

Definition at line 275 of file MapDServer.cpp.

Referenced by fillOptions(), and parse_command_line().

◆ flush_log

bool MapDProgramOptions::flush_log = true

◆ help_desc

po::options_description MapDProgramOptions::help_desc
private

Definition at line 311 of file MapDServer.cpp.

Referenced by fillOptions(), and parse_command_line().

◆ http_port

int MapDProgramOptions::http_port = 6278

Definition at line 248 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ idle_session_duration

int MapDProgramOptions::idle_session_duration = kMinsPerHour

Inactive session tolerance in mins (60 mins)

Definition at line 296 of file MapDServer.cpp.

Referenced by fillOptions(), main(), and parse_command_line().

◆ intel_jit_profile

bool MapDProgramOptions::intel_jit_profile = false

Definition at line 258 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), and main().

◆ jit_debug

bool MapDProgramOptions::jit_debug = false

Definition at line 257 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), and main().

◆ license_path

std::string MapDProgramOptions::license_path = {""}

Definition at line 253 of file MapDServer.cpp.

◆ log_options_

logger::LogOptions MapDProgramOptions::log_options_
private

◆ mapd_parameters

MapDParameters MapDProgramOptions::mapd_parameters

Definition at line 265 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), fillOptions(), main(), and parse_command_line().

◆ max_session_duration

int MapDProgramOptions::max_session_duration = kMinsPerMonth

Maximum session life in mins (43,200 mins == 30 Days) (https://pages.nist.gov/800-63-3/sp800-63b.html#aal3reauth)

Definition at line 301 of file MapDServer.cpp.

Referenced by fillOptions(), main(), and parse_command_line().

◆ num_gpus

int MapDProgramOptions::num_gpus = -1

Can be used to override the number of gpus detected on the system -1 means do not override

Definition at line 283 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ num_reader_threads

size_t MapDProgramOptions::num_reader_threads = 0

Number of threads used when loading data

Definition at line 288 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ read_only

bool MapDProgramOptions::read_only = false

Definition at line 260 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ render_mem_bytes

size_t MapDProgramOptions::render_mem_bytes = 500000000

Definition at line 270 of file MapDServer.cpp.

Referenced by main().

◆ render_oom_retry_threshold

int MapDProgramOptions::render_oom_retry_threshold = 0

Definition at line 269 of file MapDServer.cpp.

Referenced by main().

◆ render_poly_cache_bytes

size_t MapDProgramOptions::render_poly_cache_bytes = 300000000

Definition at line 271 of file MapDServer.cpp.

◆ reserved_gpu_mem

size_t MapDProgramOptions::reserved_gpu_mem = 1 << 27

Definition at line 249 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ start_gpu

int MapDProgramOptions::start_gpu = 0

Definition at line 284 of file MapDServer.cpp.

Referenced by fillOptions(), and main().

◆ string_leaves

std::vector< LeafHostInfo > MapDProgramOptions::string_leaves

Definition at line 318 of file MapDServer.cpp.

Referenced by main().

◆ udf_file_name

std::string MapDProgramOptions::udf_file_name = {""}

Definition at line 302 of file MapDServer.cpp.

Referenced by fillAdvancedOptions(), main(), and parse_command_line().

◆ verbose_logging

bool MapDProgramOptions::verbose_logging = false

Definition at line 256 of file MapDServer.cpp.

Referenced by fillOptions(), and parse_command_line().

◆ vm [1/2]

boost::program_options::variables_map MapDProgramOptions::vm
private

Definition at line 73 of file MapDProgramOptions.h.

◆ vm [2/2]

po::variables_map MapDProgramOptions::vm
private

Definition at line 314 of file MapDServer.cpp.

Referenced by parse_command_line().


The documentation for this class was generated from the following files: