| 486 | } |
| 487 | |
| 488 | void impala::InitCommonRuntime(int argc, char** argv, bool init_jvm, |
| 489 | TestInfo::Mode test_mode, bool external_fe) { |
| 490 | srand(time(NULL)); |
| 491 | BlockImpalaShutdownSignal(); |
| 492 | |
| 493 | // Set the default hostname. The user can override this with the hostname flag. |
| 494 | ABORT_IF_ERROR(GetHostname(&FLAGS_hostname)); |
| 495 | |
| 496 | #ifdef NDEBUG |
| 497 | // Symbolize stacktraces by default in debug mode. |
| 498 | FLAGS_symbolize_stacktrace = false; |
| 499 | # else |
| 500 | FLAGS_symbolize_stacktrace = true; |
| 501 | #endif |
| 502 | |
| 503 | if (external_fe) { |
| 504 | // Change defaults for flags when loaded as part of external frontend. |
| 505 | // Write logs to stderr by default (otherwise logs get written to |
| 506 | // FeSupport.INFO/ERROR). |
| 507 | FLAGS_logtostderr = true; |
| 508 | // Do not redirct stdout/stderr by default. |
| 509 | FLAGS_redirect_stdout_stderr = false; |
| 510 | } |
| 511 | |
| 512 | google::SetVersionString(impala::GetBuildVersion()); |
| 513 | google::ParseCommandLineFlags(&argc, &argv, true); |
| 514 | |
| 515 | CpuInfo::Init(); |
| 516 | DiskInfo::Init(); |
| 517 | MemInfo::Init(); |
| 518 | OsInfo::Init(); |
| 519 | TestInfo::Init(test_mode); |
| 520 | |
| 521 | if (!FLAGS_redaction_rules_file.empty()) { |
| 522 | if (VLOG_ROW_IS_ON || !FLAGS_vmodule.empty()) { |
| 523 | CLEAN_EXIT_WITH_ERROR("Redaction cannot be used in combination with log level 3 or " |
| 524 | "higher or the -vmodule option because these log levels may log data in " |
| 525 | "ways redaction rules may not anticipate."); |
| 526 | } |
| 527 | const string& error_message = SetRedactionRulesFromFile(FLAGS_redaction_rules_file); |
| 528 | if (!error_message.empty()) CLEAN_EXIT_WITH_ERROR(error_message); |
| 529 | } |
| 530 | if (FLAGS_read_size < READ_SIZE_MIN_VALUE) { |
| 531 | CLEAN_EXIT_WITH_ERROR(Substitute("read_size can not be lower than $0", |
| 532 | READ_SIZE_MIN_VALUE)); |
| 533 | } |
| 534 | |
| 535 | bool is_percent = false; // not used |
| 536 | int64_t re2_mem_limit = ParseUtil::ParseMemSpec(FLAGS_re2_mem_limit, &is_percent, 0); |
| 537 | if (re2_mem_limit <= 0) { |
| 538 | CLEAN_EXIT_WITH_ERROR( |
| 539 | Substitute("Invalid mem limit for re2's regex engine: $0", FLAGS_re2_mem_limit)); |
| 540 | } else { |
| 541 | StringFunctions::SetRE2MemLimit(re2_mem_limit); |
| 542 | } |
| 543 | |
| 544 | if (FLAGS_reserved_words_version != "2.11.0" && FLAGS_reserved_words_version != "3.0.0") |
| 545 | { |
nothing calls this directly
no test coverage detected