OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
/home/jenkins-slave/workspace/core-os-doxygen/HeavyDB.cpp File Reference
#include "DataMgr/ForeignStorage/ForeignStorageInterface.h"
#include "ThriftHandler/DBHandler.h"
#include <thrift/concurrency/PlatformThreadFactory.h>
#include <thrift/concurrency/ThreadManager.h>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TThreadedServer.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/THttpServer.h>
#include <thrift/transport/TSSLServerSocket.h>
#include <thrift/transport/TSSLSocket.h>
#include <thrift/transport/TServerSocket.h>
#include "Shared/ThriftJSONProtocolInclude.h"
#include "Logger/Logger.h"
#include "Shared/SystemParameters.h"
#include "Shared/file_delete.h"
#include "Shared/heavyai_shared_mutex.h"
#include "Shared/scope.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/filesystem.hpp>
#include <boost/locale/generator.hpp>
#include <boost/make_shared.hpp>
#include <boost/program_options.hpp>
#include <csignal>
#include <cstdlib>
#include <sstream>
#include <thread>
#include <vector>
#include "Catalog/AlterColumnRecovery.h"
#include "MigrationMgr/MigrationMgr.h"
#include "Shared/Compressor.h"
#include "ThriftHandler/ForeignTableRefreshScheduler.h"
+ Include dependency graph for HeavyDB.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{HeavyDB.cpp}
 

Functions

void anonymous_namespace{HeavyDB.cpp}::register_signal_handler (int signum, void(*handler)(int))
 
void anonymous_namespace{HeavyDB.cpp}::heavydb_signal_handler (int signum)
 
void anonymous_namespace{HeavyDB.cpp}::register_signal_handlers ()
 
void start_server (std::shared_ptr< TThreadedServer > server, const int port)
 
void releaseWarmupSession (TSessionId &sessionId, std::ifstream &query_file) noexcept
 
void run_warmup_queries (std::shared_ptr< DBHandler > handler, std::string base_path, std::string query_file_path)
 
void thrift_stop ()
 
void heartbeat ()
 
int startHeavyDBServer (CommandLineOptions &prog_config_opts, bool start_http_server=true)
 
int main (int argc, char **argv)
 

Variables

bool g_enable_thrift_logs
 
std::atomic< bool > g_running {true}
 
bool g_enable_http_binary_server
 
std::atomic< int > anonymous_namespace{HeavyDB.cpp}::g_saw_signal {-1}
 
std::shared_ptr< TThreadedServer > anonymous_namespace{HeavyDB.cpp}::g_thrift_http_server
 
std::shared_ptr< TThreadedServer > anonymous_namespace{HeavyDB.cpp}::g_thrift_http_binary_server
 
std::shared_ptr< TThreadedServer > anonymous_namespace{HeavyDB.cpp}::g_thrift_tcp_server
 
std::shared_ptr< DBHandleranonymous_namespace{HeavyDB.cpp}::g_warmup_handler
 
std::shared_ptr< DBHandleranonymous_namespace{HeavyDB.cpp}::g_db_handler
 
bool g_enable_fsi
 
bool g_enable_foreign_table_scheduled_refresh
 

Function Documentation

void heartbeat ( )

Definition at line 315 of file HeavyDB.cpp.

References g_running, anonymous_namespace{HeavyDB.cpp}::g_saw_signal, logger::INFO, LOG, run_benchmark_import::result, logger::shutdown(), thrift_stop(), and VLOG.

Referenced by startHeavyDBServer().

315  {
316 #ifndef _WIN32
317  // Block all signals for this heartbeat thread, only.
318  sigset_t set;
319  sigfillset(&set);
320  int result = pthread_sigmask(SIG_BLOCK, &set, NULL);
321  if (result != 0) {
322  throw std::runtime_error("heartbeat() thread startup failed");
323  }
324 #endif
325 
326  // Sleep until heavydb_signal_handler or anything clears the g_running flag.
327  VLOG(1) << "heartbeat thread starting";
328  while (::g_running) {
329  using namespace std::chrono;
330  std::this_thread::sleep_for(1s);
331  }
332  VLOG(1) << "heartbeat thread exiting";
333 
334  // Get the signal number if there was a signal.
335  int signum = g_saw_signal;
336  if (signum >= 1 && signum != SIGTERM) {
337  LOG(INFO) << "Interrupt signal (" << signum << ") received.";
338  }
339 
340  // If dumping core, try to do some quick stuff.
341  if (signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE
342 #ifndef _WIN32
343  || signum == SIGQUIT
344 #endif
345  ) {
346  // Need to shut down calcite.
347  if (auto db_handler = g_db_handler; db_handler) {
348  db_handler->emergency_shutdown();
349  }
350  // Need to flush the logs for debugging.
352  return;
353  // Core dump should begin soon after this. See heavydb_signal_handler().
354  // We leave the rest of the server process as is for the core dump image.
355  }
356 
357  // Stopping the Thrift thread(s) will allow main() to return.
358  thrift_stop();
359 }
std::shared_ptr< DBHandler > g_db_handler
Definition: HeavyDB.cpp:98
#define LOG(tag)
Definition: Logger.h:285
std::atomic< int > g_saw_signal
Definition: HeavyDB.cpp:88
void shutdown()
Definition: Logger.cpp:401
std::atomic< bool > g_running
Definition: HeavyDB.cpp:82
#define VLOG(n)
Definition: Logger.h:388
void thrift_stop()
Definition: HeavyDB.cpp:297

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 638 of file HeavyDB.cpp.

References CommandLineOptions::parse_command_line(), startHeavyDBServer(), CommandLineOptions::validate(), and CommandLineOptions::validate_base_path().

638  {
639  bool has_clust_topo = false;
640 
641  CommandLineOptions prog_config_opts(argv[0], has_clust_topo);
642 
643  try {
644  if (auto return_code =
645  prog_config_opts.parse_command_line(argc, argv, !has_clust_topo)) {
646  return *return_code;
647  }
648 
649  if (!has_clust_topo) {
650  prog_config_opts.validate_base_path();
651  prog_config_opts.validate();
652  return (startHeavyDBServer(prog_config_opts));
653  }
654  } catch (std::runtime_error& e) {
655  std::cerr << "Server Error: " << e.what() << std::endl;
656  return 1;
657  } catch (boost::program_options::error& e) {
658  std::cerr << "Usage Error: " << e.what() << std::endl;
659  return 1;
660  }
661 }
int startHeavyDBServer(CommandLineOptions &prog_config_opts, bool start_http_server=true)
Definition: HeavyDB.cpp:385

+ Here is the call graph for this function:

void releaseWarmupSession ( TSessionId &  sessionId,
std::ifstream &  query_file 
)
noexcept

Definition at line 198 of file HeavyDB.cpp.

References logger::ERROR, and LOG.

Referenced by run_warmup_queries().

198  {
199  query_file.close();
200  if (sessionId != g_warmup_handler->getInvalidSessionId()) {
201  try {
202  g_warmup_handler->disconnect(sessionId);
203  } catch (...) {
204  LOG(ERROR) << "Failed to disconnect warmup session, possible failure to run warmup "
205  "queries.";
206  }
207  }
208 }
#define LOG(tag)
Definition: Logger.h:285
std::shared_ptr< DBHandler > g_warmup_handler
Definition: HeavyDB.cpp:94

+ Here is the caller graph for this function:

void run_warmup_queries ( std::shared_ptr< DBHandler handler,
std::string  base_path,
std::string  query_file_path 
)

Definition at line 210 of file HeavyDB.cpp.

References logger::INFO, LOG, releaseWarmupSession(), and logger::WARNING.

Referenced by startHeavyDBServer().

212  {
213  // run warmup queries to load cache if requested
214  if (query_file_path.empty()) {
215  return;
216  }
217  if (handler->isAggregator()) {
218  LOG(INFO) << "Skipping warmup query execution on the aggregator, queries should be "
219  "run directly on the leaf nodes.";
220  return;
221  }
222 
223  LOG(INFO) << "Running DB warmup with queries from " << query_file_path;
224  try {
225  g_warmup_handler = handler;
226  std::string db_info;
227  std::string user_keyword, user_name, db_name;
228  std::ifstream query_file;
231  TSessionId sessionId = g_warmup_handler->getInvalidSessionId();
232 
233  ScopeGuard session_guard = [&] { releaseWarmupSession(sessionId, query_file); };
234  query_file.open(query_file_path);
235  while (std::getline(query_file, db_info)) {
236  if (db_info.length() == 0) {
237  continue;
238  }
239  std::istringstream iss(db_info);
240  iss >> user_keyword >> user_name >> db_name;
241  if (user_keyword.compare(0, 4, "USER") == 0) {
242  // connect to DB for given user_name/db_name with super_user_rights (without
243  // password), & start session
244  g_warmup_handler->super_user_rights_ = true;
245  g_warmup_handler->connect(sessionId, user_name, "", db_name);
246  g_warmup_handler->super_user_rights_ = false;
247 
248  // read and run one query at a time for the DB with the setup connection
249  TQueryResult ret;
250  std::string single_query;
251  while (std::getline(query_file, single_query)) {
252  boost::algorithm::trim(single_query);
253  if (single_query.length() == 0 || single_query[0] == '-') {
254  continue;
255  }
256  if (single_query[0] == '}') {
257  single_query.clear();
258  break;
259  }
260  if (single_query.find(';') == single_query.npos) {
261  std::string multiline_query;
262  std::getline(query_file, multiline_query, ';');
263  single_query += multiline_query;
264  }
265 
266  try {
267  g_warmup_handler->sql_execute(ret, sessionId, single_query, true, "", -1, -1);
268  } catch (...) {
269  LOG(WARNING) << "Exception while executing '" << single_query
270  << "', ignoring";
271  }
272  single_query.clear();
273  }
274 
275  // stop session and disconnect from the DB
276  g_warmup_handler->disconnect(sessionId);
277  sessionId = g_warmup_handler->getInvalidSessionId();
278  } else {
279  LOG(WARNING) << "\nSyntax error in the file: " << query_file_path.c_str()
280  << " Missing expected keyword USER. Following line will be ignored: "
281  << db_info.c_str() << std::endl;
282  }
283  db_info.clear();
284  }
285  } catch (const std::exception& e) {
286  LOG(WARNING)
287  << "Exception while executing warmup queries. "
288  << "Warmup may not be fully completed. Will proceed nevertheless.\nError was: "
289  << e.what();
290  }
291 }
#define LOG(tag)
Definition: Logger.h:285
std::shared_ptr< DBHandler > g_warmup_handler
Definition: HeavyDB.cpp:94
void releaseWarmupSession(TSessionId &sessionId, std::ifstream &query_file) noexcept
Definition: HeavyDB.cpp:198

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void start_server ( std::shared_ptr< TThreadedServer >  server,
const int  port 
)

Definition at line 186 of file HeavyDB.cpp.

References logger::ERROR, and LOG.

Referenced by startHeavyDBServer().

186  {
187  try {
188  server->serve();
189  if (errno != 0) {
190  throw std::runtime_error(std::string("Thrift server exited: ") +
191  std::strerror(errno));
192  }
193  } catch (std::exception& e) {
194  LOG(ERROR) << "Exception: " << e.what() << ": port " << port << std::endl;
195  }
196 }
#define LOG(tag)
Definition: Logger.h:285

+ Here is the caller graph for this function:

int startHeavyDBServer ( CommandLineOptions prog_config_opts,
bool  start_http_server = true 
)

Definition at line 385 of file HeavyDB.cpp.

References CommandLineOptions::allow_loop_joins, CommandLineOptions::allow_multifrag, CommandLineOptions::authMetadata, CommandLineOptions::base_path, Catalog_Namespace::SysCatalog::checkDropRenderGroupColumnsMigration(), cpu_threads(), CommandLineOptions::db_leaves, CommandLineOptions::db_query_file, CommandLineOptions::disk_cache_config, CommandLineOptions::enable_auto_clear_render_mem, CommandLineOptions::enable_legacy_syntax, CommandLineOptions::enable_rendering, CommandLineOptions::exit_after_warmup, logger::FATAL, file_delete(), anonymous_namespace{HeavyDB.cpp}::g_db_handler, g_enable_http_binary_server, g_running, anonymous_namespace{HeavyDB.cpp}::g_saw_signal, threading_tbb::g_tbb_arena, heartbeat(), CommandLineOptions::http_binary_port, CommandLineOptions::http_port, CommandLineOptions::idle_session_duration, logger::INFO, heavydb_aws_sdk::init_sdk(), Catalog_Namespace::SysCatalog::instance(), CommandLineOptions::intel_jit_profile, CommandLineOptions::jit_debug, shared::kDataDirectoryName, LOG, CommandLineOptions::log_user_origin, SystemParameters::master_address, CommandLineOptions::max_concurrent_render_sessions, CommandLineOptions::max_session_duration, CommandLineOptions::num_reader_threads, SystemParameters::omnisci_server_port, CommandLineOptions::read_only, anonymous_namespace{HeavyDB.cpp}::register_signal_handlers(), CommandLineOptions::render_compositor_use_last_gpu, CommandLineOptions::render_mem_bytes, CommandLineOptions::render_oom_retry_threshold, CommandLineOptions::renderer_enable_slab_allocation, CommandLineOptions::renderer_prefer_igpu, CommandLineOptions::renderer_use_parallel_executors, CommandLineOptions::renderer_vulkan_timeout_ms, CommandLineOptions::reserved_gpu_mem, AlterTableAlterColumnCommandRecoveryMgr::resolveIncompleteAlterColumnCommandsForAllCatalogs(), run_warmup_queries(), logger::shutdown(), heavydb_aws_sdk::shutdown_sdk(), SystemParameters::ssl_cert_file, SystemParameters::ssl_key_file, SystemParameters::ssl_transport_client_auth, foreign_storage::ForeignTableRefreshScheduler::start(), start_server(), foreign_storage::ForeignTableRefreshScheduler::stop(), CommandLineOptions::string_leaves, CommandLineOptions::system_parameters, thrift_stop(), CommandLineOptions::udf_compiler_options, CommandLineOptions::udf_compiler_path, CommandLineOptions::udf_file_name, and logger::WARNING.

Referenced by main().

386  {
387  // Prepare to launch the Thrift server.
388  LOG(INFO) << "HeavyDB starting up";
390 #ifdef ENABLE_TBB
391  auto num_cpu_threads = cpu_threads();
392  LOG(INFO) << "Initializing TBB with " << num_cpu_threads << " threads.";
393  tbb::global_control tbb_control(tbb::global_control::max_allowed_parallelism,
394  num_cpu_threads);
395  threading_tbb::g_tbb_arena.initialize(num_cpu_threads);
396  const int32_t tbb_max_concurrency{threading_tbb::g_tbb_arena.max_concurrency()};
397  LOG(INFO) << "TBB max concurrency: " << tbb_max_concurrency << " threads.";
398 #endif // ENABLE_TBB
399 #ifdef HAVE_AWS_S3
401 #endif // HAVE_AWS_S3
402  std::set<std::unique_ptr<std::thread>> server_threads;
403  auto wait_for_server_threads = [&] {
404  for (auto& th : server_threads) {
405  try {
406  th->join();
407  } catch (const std::system_error& e) {
408  if (e.code() != std::errc::invalid_argument) {
409  LOG(WARNING) << "std::thread join failed: " << e.what();
410  }
411  } catch (const std::exception& e) {
412  LOG(WARNING) << "std::thread join failed: " << e.what();
413  } catch (...) {
414  LOG(WARNING) << "std::thread join failed";
415  }
416  }
417  };
418  ScopeGuard server_shutdown_guard = [&] {
419  // This function will never be called by exit(), but we shouldn't ever be calling
420  // exit(), we should be setting g_running to false instead.
421  LOG(INFO) << "HeavyDB shutting down";
422 
423  g_running = false;
424 
425  thrift_stop();
426 
427  if (g_enable_fsi) {
429  }
430 
431  g_db_handler.reset();
432 
433  wait_for_server_threads();
434 
435 #ifdef HAVE_AWS_S3
437 #endif // HAVE_AWS_S3
438 
439  // Flush the logs last to capture maximum debugging information.
441  };
442 
443  // start background thread to clean up _DELETE_ME files
444  const unsigned int wait_interval =
445  3; // wait time in secs after looking for deleted file before looking again
446  server_threads.insert(std::make_unique<std::thread>(
447  file_delete,
448  std::ref(g_running),
449  wait_interval,
450  prog_config_opts.base_path + "/" + shared::kDataDirectoryName));
451  server_threads.insert(std::make_unique<std::thread>(heartbeat));
452 
453  if (!g_enable_thrift_logs) {
454  apache::thrift::GlobalOutput.setOutputFunction([](const char* msg) {});
455  }
456 
457  // Thrift event handler for database server setup.
458  try {
459  if (prog_config_opts.system_parameters.master_address.empty()) {
460  // Handler for a single database server. (DBHandler)
461  g_db_handler =
462  std::make_shared<DBHandler>(prog_config_opts.db_leaves,
463  prog_config_opts.string_leaves,
464  prog_config_opts.base_path,
465  prog_config_opts.allow_multifrag,
466  prog_config_opts.jit_debug,
467  prog_config_opts.intel_jit_profile,
468  prog_config_opts.read_only,
469  prog_config_opts.allow_loop_joins,
470  prog_config_opts.enable_rendering,
471  prog_config_opts.renderer_prefer_igpu,
472  prog_config_opts.renderer_vulkan_timeout_ms,
473  prog_config_opts.renderer_use_parallel_executors,
474  prog_config_opts.enable_auto_clear_render_mem,
475  prog_config_opts.render_oom_retry_threshold,
476  prog_config_opts.render_mem_bytes,
477  prog_config_opts.max_concurrent_render_sessions,
478  prog_config_opts.reserved_gpu_mem,
479  prog_config_opts.render_compositor_use_last_gpu,
480  prog_config_opts.renderer_enable_slab_allocation,
481  prog_config_opts.num_reader_threads,
482  prog_config_opts.authMetadata,
483  prog_config_opts.system_parameters,
484  prog_config_opts.enable_legacy_syntax,
485  prog_config_opts.idle_session_duration,
486  prog_config_opts.max_session_duration,
487  prog_config_opts.udf_file_name,
488  prog_config_opts.udf_compiler_path,
489  prog_config_opts.udf_compiler_options,
490 #ifdef ENABLE_GEOS
491  prog_config_opts.libgeos_so_filename,
492 #endif
493 #ifdef HAVE_TORCH_TFS
494  prog_config_opts.torch_lib_path,
495 #endif
496  prog_config_opts.disk_cache_config,
497  false);
498  } else { // running ha server
499  LOG(FATAL)
500  << "No High Availability module available, please contact OmniSci support";
501  }
502  } catch (const std::exception& e) {
503  LOG(FATAL) << "Failed to initialize service handler: " << e.what();
504  }
505 
506  // do the drop render group columns migration here too
507  // @TODO make a single entry point in MigrationMgr that will do these two and futures
509 
510  // Recover from any partially complete alter table alter column commands
513 
516  }
517 
518  // TCP port setup. We use Thrift both for a TCP socket and for an optional HTTP socket.
519  std::shared_ptr<TServerSocket> tcp_socket;
520  std::shared_ptr<TServerSocket> http_socket;
521  std::shared_ptr<TServerSocket> http_binary_socket;
522 
523  if (!prog_config_opts.system_parameters.ssl_cert_file.empty() &&
524  !prog_config_opts.system_parameters.ssl_key_file.empty()) {
525  // SSL port setup.
526  auto sslSocketFactory = std::make_shared<TSSLSocketFactory>(SSLProtocol::SSLTLS);
527  sslSocketFactory->loadCertificate(
528  prog_config_opts.system_parameters.ssl_cert_file.c_str());
529  sslSocketFactory->loadPrivateKey(
530  prog_config_opts.system_parameters.ssl_key_file.c_str());
531  if (prog_config_opts.system_parameters.ssl_transport_client_auth) {
532  sslSocketFactory->authenticate(true);
533  } else {
534  sslSocketFactory->authenticate(false);
535  }
536  sslSocketFactory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
537  tcp_socket = std::make_shared<TSSLServerSocket>(
538  prog_config_opts.system_parameters.omnisci_server_port, sslSocketFactory);
539  if (start_http_server) {
540  http_socket = std::make_shared<TSSLServerSocket>(prog_config_opts.http_port,
541  sslSocketFactory);
542  }
544  http_binary_socket = std::make_shared<TSSLServerSocket>(
545  prog_config_opts.http_binary_port, sslSocketFactory);
546  }
547  LOG(INFO) << " HeavyDB server using encrypted connection. Cert file ["
548  << prog_config_opts.system_parameters.ssl_cert_file << "], key file ["
549  << prog_config_opts.system_parameters.ssl_key_file << "]";
550 
551  } else {
552  // Non-SSL port setup.
553  LOG(INFO) << " HeavyDB server using unencrypted connection";
554  tcp_socket = std::make_shared<TServerSocket>(
555  prog_config_opts.system_parameters.omnisci_server_port);
556  if (start_http_server) {
557  http_socket = std::make_shared<TServerSocket>(prog_config_opts.http_port);
558  }
560  http_binary_socket =
561  std::make_shared<TServerSocket>(prog_config_opts.http_binary_port);
562  }
563  }
564 
565  // Thrift uses the same processor for both the TCP port and the HTTP port.
566  std::shared_ptr<TProcessor> processor{std::make_shared<TrackingProcessor>(
567  g_db_handler, prog_config_opts.log_user_origin)};
568 
569  // Thrift TCP server launch.
570  std::shared_ptr<TServerTransport> tcp_st = tcp_socket;
571 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
572  std::shared_ptr<TTransportFactory> tcp_tf{
573  std::make_shared<UnboundedTBufferedTransportFactory>()};
574 #else
575  std::shared_ptr<TTransportFactory> tcp_tf{
576  std::make_shared<TBufferedTransportFactory>()};
577 #endif
578  std::shared_ptr<TProtocolFactory> tcp_pf{std::make_shared<TBinaryProtocolFactory>()};
579  g_thrift_tcp_server.reset(new TThreadedServer(processor, tcp_st, tcp_tf, tcp_pf));
580  server_threads.insert(std::make_unique<std::thread>(
581  start_server,
583  prog_config_opts.system_parameters.omnisci_server_port));
584 
585  // Thrift HTTP server launch.
586  if (start_http_server) {
587  std::shared_ptr<TServerTransport> http_st = http_socket;
588 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
589  std::shared_ptr<TTransportFactory> http_tf{
590  std::make_shared<UnboundedTHttpServerTransportFactory>()};
591 #else
592  std::shared_ptr<TTransportFactory> http_tf{
593  std::make_shared<THttpServerTransportFactory>()};
594 #endif
595  std::shared_ptr<TProtocolFactory> http_pf{std::make_shared<TJSONProtocolFactory>()};
596  g_thrift_http_server.reset(new TThreadedServer(processor, http_st, http_tf, http_pf));
597  server_threads.insert(std::make_unique<std::thread>(
598  start_server, g_thrift_http_server, prog_config_opts.http_port));
599  }
600 
601  // Thrift HTTP binary protocol server launch.
603  std::shared_ptr<TServerTransport> http_binary_st = http_binary_socket;
604 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
605  std::shared_ptr<TTransportFactory> http_binary_tf{
606  std::make_shared<UnboundedTHttpServerTransportFactory>()};
607 #else
608  std::shared_ptr<TTransportFactory> http_binary_tf{
609  std::make_shared<THttpServerTransportFactory>()};
610 #endif
611  std::shared_ptr<TProtocolFactory> http_binary_pf{
612  std::make_shared<TBinaryProtocolFactory>()};
614  new TThreadedServer(processor, http_binary_st, http_binary_tf, http_binary_pf));
615  server_threads.insert(std::make_unique<std::thread>(
617  }
618 
619  // Run warm up queries if any exist.
621  g_db_handler, prog_config_opts.base_path, prog_config_opts.db_query_file);
622  if (prog_config_opts.exit_after_warmup) {
623  g_running = false;
624  }
625 
626  // Main thread blocks for as long as the servers are running.
627  wait_for_server_threads();
628 
629  // Clean shutdown.
630  int signum = g_saw_signal;
631  if (signum <= 0 || signum == SIGTERM) {
632  return 0;
633  } else {
634  return signum;
635  }
636 }
const std::string kDataDirectoryName
void run_warmup_queries(std::shared_ptr< DBHandler > handler, std::string base_path, std::string query_file_path)
Definition: HeavyDB.cpp:210
unsigned renderer_vulkan_timeout_ms
std::vector< LeafHostInfo > string_leaves
std::string udf_compiler_path
std::shared_ptr< DBHandler > g_db_handler
Definition: HeavyDB.cpp:98
#define LOG(tag)
Definition: Logger.h:285
void heartbeat()
Definition: HeavyDB.cpp:315
void start_server(std::shared_ptr< TThreadedServer > server, const int port)
Definition: HeavyDB.cpp:186
void checkDropRenderGroupColumnsMigration() const
std::shared_ptr< TThreadedServer > g_thrift_http_binary_server
Definition: HeavyDB.cpp:91
std::atomic< int > g_saw_signal
Definition: HeavyDB.cpp:88
size_t max_concurrent_render_sessions
static SysCatalog & instance()
Definition: SysCatalog.h:343
tbb::task_arena g_tbb_arena
std::vector< LeafHostInfo > db_leaves
bool g_enable_http_binary_server
std::shared_ptr< TThreadedServer > g_thrift_http_server
Definition: HeavyDB.cpp:90
std::string ssl_key_file
AuthMetadata authMetadata
static void start(std::atomic< bool > &is_program_running)
void shutdown()
Definition: Logger.cpp:401
std::vector< std::string > udf_compiler_options
bool g_enable_foreign_table_scheduled_refresh
std::atomic< bool > g_running
Definition: HeavyDB.cpp:82
File_Namespace::DiskCacheConfig disk_cache_config
void file_delete(std::atomic< bool > &program_is_running, const unsigned int wait_interval_seconds, const std::string base_path)
Definition: File.cpp:272
bool g_enable_fsi
Definition: Catalog.cpp:96
int cpu_threads()
Definition: thread_count.h:25
bool g_enable_thrift_logs
Definition: HeavyDB.cpp:293
void thrift_stop()
Definition: HeavyDB.cpp:297
std::string master_address
std::shared_ptr< TThreadedServer > g_thrift_tcp_server
Definition: HeavyDB.cpp:92
SystemParameters system_parameters
std::string ssl_cert_file

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void thrift_stop ( )

Definition at line 297 of file HeavyDB.cpp.

Referenced by heartbeat(), and startHeavyDBServer().

297  {
298  if (auto thrift_http_server = g_thrift_http_server; thrift_http_server) {
299  thrift_http_server->stop();
300  }
301  g_thrift_http_server.reset();
302 
303  if (auto thrift_http_binary_server = g_thrift_http_binary_server;
304  thrift_http_binary_server) {
305  thrift_http_binary_server->stop();
306  }
308 
309  if (auto thrift_tcp_server = g_thrift_tcp_server; thrift_tcp_server) {
310  thrift_tcp_server->stop();
311  }
312  g_thrift_tcp_server.reset();
313 }
std::shared_ptr< TThreadedServer > g_thrift_http_binary_server
Definition: HeavyDB.cpp:91
std::shared_ptr< TThreadedServer > g_thrift_http_server
Definition: HeavyDB.cpp:90
std::shared_ptr< TThreadedServer > g_thrift_tcp_server
Definition: HeavyDB.cpp:92

+ Here is the caller graph for this function:

Variable Documentation

bool g_enable_foreign_table_scheduled_refresh
bool g_enable_fsi

Definition at line 96 of file Catalog.cpp.

bool g_enable_http_binary_server
bool g_enable_thrift_logs

Definition at line 293 of file HeavyDB.cpp.

std::atomic<bool> g_running {true}