OmniSciDB  a5dc49c757
 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/misc.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)
 
void log_startup_info ()
 
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 320 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().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void log_startup_info ( )

Definition at line 643 of file HeavyDB.cpp.

References VLOG.

Referenced by main().

643  {
644 #ifdef __linux__
645  VLOG(1) << "sysconf(_SC_PAGE_SIZE): " << sysconf(_SC_PAGE_SIZE);
646  VLOG(1) << "/proc/buddyinfo: " << shared::FileContentsEscaper{"/proc/buddyinfo"};
647  VLOG(1) << "/proc/meminfo: " << shared::FileContentsEscaper{"/proc/meminfo"};
648 #endif
649 }
#define VLOG(n)
Definition: Logger.h:388

+ Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 651 of file HeavyDB.cpp.

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

651  {
652  bool has_clust_topo = false;
653 
654  CommandLineOptions prog_config_opts(argv[0], has_clust_topo);
655 
656  try {
657  if (auto return_code =
658  prog_config_opts.parse_command_line(argc, argv, !has_clust_topo)) {
659  return *return_code;
660  }
661 
662  if (!has_clust_topo) {
663  prog_config_opts.validate_base_path();
664  prog_config_opts.validate();
666  return (startHeavyDBServer(prog_config_opts));
667  }
668  } catch (std::runtime_error& e) {
669  std::cerr << "Server Error: " << e.what() << std::endl;
670  return 1;
671  } catch (boost::program_options::error& e) {
672  std::cerr << "Usage Error: " << e.what() << std::endl;
673  return 1;
674  }
675 }
int startHeavyDBServer(CommandLineOptions &prog_config_opts, bool start_http_server=true)
Definition: HeavyDB.cpp:390
void log_startup_info()
Definition: HeavyDB.cpp:643

+ Here is the call graph for this function:

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

Definition at line 203 of file HeavyDB.cpp.

References logger::ERROR, and LOG.

Referenced by run_warmup_queries().

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

+ 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 215 of file HeavyDB.cpp.

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

Referenced by startHeavyDBServer().

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

+ 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 191 of file HeavyDB.cpp.

References logger::ERROR, and LOG.

Referenced by startHeavyDBServer().

191  {
192  try {
193  server->serve();
194  if (errno != 0) {
195  throw std::runtime_error(std::string("Thrift server exited: ") +
196  std::strerror(errno));
197  }
198  } catch (std::exception& e) {
199  LOG(ERROR) << "Exception: " << e.what() << ": port " << port << std::endl;
200  }
201 }
#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 390 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().

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

Referenced by heartbeat(), and startHeavyDBServer().

302  {
303  if (auto thrift_http_server = g_thrift_http_server; thrift_http_server) {
304  thrift_http_server->stop();
305  }
306  g_thrift_http_server.reset();
307 
308  if (auto thrift_http_binary_server = g_thrift_http_binary_server;
309  thrift_http_binary_server) {
310  thrift_http_binary_server->stop();
311  }
313 
314  if (auto thrift_tcp_server = g_thrift_tcp_server; thrift_tcp_server) {
315  thrift_tcp_server->stop();
316  }
317  g_thrift_tcp_server.reset();
318 }
std::shared_ptr< TThreadedServer > g_thrift_http_binary_server
Definition: HeavyDB.cpp:96
std::shared_ptr< TThreadedServer > g_thrift_http_server
Definition: HeavyDB.cpp:95
std::shared_ptr< TThreadedServer > g_thrift_tcp_server
Definition: HeavyDB.cpp:97

+ 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 298 of file HeavyDB.cpp.

std::atomic<bool> g_running {true}