OmniSciDB  bf83d84833
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
/home/jenkins-slave/workspace/core-os-doxygen/MapDServer.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/protocol/TJSONProtocol.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 "Archive/S3Archive.h"
#include "Logger/Logger.h"
#include "Shared/SystemParameters.h"
#include "Shared/file_delete.h"
#include "Shared/mapd_shared_mutex.h"
#include "Shared/mapd_shared_ptr.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 "DataMgr/ForeignStorage/ForeignTableRefresh.h"
#include "MapDRelease.h"
#include "Shared/Compressor.h"
+ Include dependency graph for MapDServer.cpp:

Go to the source code of this file.

Functions

void shutdown_handler ()
 
void register_signal_handler (int signum, void(*handler)(int))
 
void omnisci_signal_handler (int signum)
 
void register_signal_handlers ()
 
void start_server (TThreadedServer &server, const int port)
 
void releaseWarmupSession (TSessionId &sessionId, std::ifstream &query_file)
 
void run_warmup_queries (mapd::shared_ptr< DBHandler > handler, std::string base_path, std::string query_file_path)
 
void heartbeat ()
 
int startMapdServer (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}
 
std::atomic< int > g_saw_signal {-1}
 
mapd_shared_mutex g_thrift_mutex
 
TThreadedServer * g_thrift_http_server {nullptr}
 
TThreadedServer * g_thrift_buf_server {nullptr}
 
mapd::shared_ptr< DBHandlerg_warmup_handler
 
mapd::shared_ptr< DBHandlerg_mapd_handler = 0
 
std::once_flag g_shutdown_once_flag
 

Function Documentation

void heartbeat ( )

Definition at line 256 of file MapDServer.cpp.

References g_mapd_handler, g_running, g_saw_signal, g_shutdown_once_flag, g_thrift_buf_server, g_thrift_http_server, g_thrift_mutex, logger::INFO, LOG, run_benchmark_import::result, logger::shutdown(), and VLOG.

Referenced by startMapdServer().

256  {
257  // Block all signals for this heartbeat thread, only.
258  sigset_t set;
259  sigfillset(&set);
260  int result = pthread_sigmask(SIG_BLOCK, &set, NULL);
261  if (result != 0) {
262  throw std::runtime_error("heartbeat() thread startup failed");
263  }
264 
265  // Sleep until omnisci_signal_handler or anything clears the g_running flag.
266  VLOG(1) << "heartbeat thread starting";
267  while (::g_running) {
268  using namespace std::chrono;
269  std::this_thread::sleep_for(1s);
270  }
271  VLOG(1) << "heartbeat thread exiting";
272 
273  // Get the signal number if there was a signal.
274  int signum = g_saw_signal;
275  if (signum >= 1 && signum != SIGTERM) {
276  LOG(INFO) << "Interrupt signal (" << signum << ") received.";
277  }
278 
279  // if dumping core, try to do some quick stuff
280  if (signum == SIGQUIT || signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE) {
281  if (g_mapd_handler) {
282  std::call_once(g_shutdown_once_flag,
283  []() { g_mapd_handler->emergency_shutdown(); });
284  }
286  return;
287  // core dump should begin soon after this, see omnisci_signal_handler()
288  }
289 
290  // trigger an orderly shutdown by telling Thrift to stop serving
291  {
292  mapd_shared_lock<mapd_shared_mutex> read_lock(g_thrift_mutex);
293  auto httpserv = g_thrift_http_server;
294  if (httpserv) {
295  httpserv->stop();
296  }
297  auto bufserv = g_thrift_buf_server;
298  if (bufserv) {
299  bufserv->stop();
300  }
301  // main() should return soon after this
302  }
303 }
mapd_shared_mutex g_thrift_mutex
Definition: MapDServer.cpp:76
TThreadedServer * g_thrift_buf_server
Definition: MapDServer.cpp:78
std::once_flag g_shutdown_once_flag
Definition: MapDServer.cpp:84
#define LOG(tag)
Definition: Logger.h:188
TThreadedServer * g_thrift_http_server
Definition: MapDServer.cpp:77
mapd::shared_ptr< DBHandler > g_mapd_handler
Definition: MapDServer.cpp:83
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:74
void shutdown()
Definition: Logger.cpp:314
std::atomic< bool > g_running
Definition: MapDServer.cpp:73
mapd_shared_lock< mapd_shared_mutex > read_lock
#define VLOG(n)
Definition: Logger.h:291

+ 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 492 of file MapDServer.cpp.

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

492  {
493  bool has_clust_topo = false;
494 
495  CommandLineOptions prog_config_opts(argv[0], has_clust_topo);
496 
497  try {
498  if (auto return_code =
499  prog_config_opts.parse_command_line(argc, argv, !has_clust_topo)) {
500  return *return_code;
501  }
502 
503  if (!has_clust_topo) {
504  prog_config_opts.validate_base_path();
505  prog_config_opts.validate();
506  return (startMapdServer(prog_config_opts));
507  }
508  } catch (std::runtime_error& e) {
509  std::cerr << "Can't start: " << e.what() << std::endl;
510  return 1;
511  } catch (boost::program_options::error& e) {
512  std::cerr << "Usage Error: " << e.what() << std::endl;
513  return 1;
514  }
515 }
int startMapdServer(CommandLineOptions &prog_config_opts, bool start_http_server=true)
Definition: MapDServer.cpp:305

+ Here is the call graph for this function:

void omnisci_signal_handler ( int  signum)

Definition at line 109 of file MapDServer.cpp.

References g_running, g_saw_signal, and register_signal_handler().

Referenced by register_signal_handlers().

109  {
110  // Record the signal number for logging during shutdown.
111  // Only records the first signal if called more than once.
112  int expected_signal{-1};
113  if (!g_saw_signal.compare_exchange_strong(expected_signal, signum)) {
114  return; // this wasn't the first signal
115  }
116 
117  // This point should never be reached more than once.
118 
119  // Tell heartbeat() to shutdown by unsetting the 'g_running' flag.
120  // If 'g_running' is already false, this has no effect and the
121  // shutdown is already in progress.
122  g_running = false;
123 
124  // Handle core dumps specially by pausing inside this signal handler
125  // because on some systems, some signals will execute their default
126  // action immediately when and if the signal handler returns.
127  // We would like to do some emergency cleanup before core dump.
128  if (signum == SIGQUIT || signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE) {
129  // Wait briefly to give heartbeat() a chance to flush the logs and
130  // do any other emergency shutdown tasks.
131  sleep(2);
132 
133  // Explicitly trigger whatever default action this signal would
134  // have done, such as terminate the process or dump core.
135  // Signals are currently blocked so this new signal will be queued
136  // until this signal handler returns.
137  register_signal_handler(signum, SIG_DFL);
138  kill(getpid(), signum);
139  sleep(5);
140 
141 #ifndef __APPLE__
142  // as a last resort, abort
143  // primary used in Docker environments, where we can end up with PID 1 and fail to
144  // catch unix signals
145  quick_exit(signum);
146 #endif
147  }
148 }
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:74
std::atomic< bool > g_running
Definition: MapDServer.cpp:73
void register_signal_handler(int signum, void(*handler)(int))
Definition: MapDServer.cpp:92

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void register_signal_handler ( int  signum,
void(*)(int)  handler 
)

Definition at line 92 of file MapDServer.cpp.

Referenced by omnisci_signal_handler(), and register_signal_handlers().

92  {
93  struct sigaction act;
94  memset(&act, 0, sizeof(act));
95  if (handler != SIG_DFL && handler != SIG_IGN) {
96  // block all signal deliveries while inside the signal handler
97  sigfillset(&act.sa_mask);
98  }
99  act.sa_handler = handler;
100  sigaction(signum, &act, NULL);
101 }

+ Here is the caller graph for this function:

void register_signal_handlers ( )

Definition at line 150 of file MapDServer.cpp.

References omnisci_signal_handler(), and register_signal_handler().

Referenced by startMapdServer().

150  {
157  // Thrift secure socket can cause problems with SIGPIPE
158  register_signal_handler(SIGPIPE, SIG_IGN);
159 }
void register_signal_handler(int signum, void(*handler)(int))
Definition: MapDServer.cpp:92
void omnisci_signal_handler(int signum)
Definition: MapDServer.cpp:109

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 173 of file MapDServer.cpp.

References g_warmup_handler.

Referenced by run_warmup_queries().

173  {
174  query_file.close();
175  if (sessionId != g_warmup_handler->getInvalidSessionId()) {
176  g_warmup_handler->disconnect(sessionId);
177  }
178 }
mapd::shared_ptr< DBHandler > g_warmup_handler
Definition: MapDServer.cpp:80

+ Here is the caller graph for this function:

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

Definition at line 180 of file MapDServer.cpp.

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

Referenced by startMapdServer().

182  {
183  // run warmup queries to load cache if requested
184  if (query_file_path.empty()) {
185  return;
186  }
187  LOG(INFO) << "Running DB warmup with queries from " << query_file_path;
188  try {
189  g_warmup_handler = handler;
190  std::string db_info;
191  std::string user_keyword, user_name, db_name;
192  std::ifstream query_file;
195  TSessionId sessionId = g_warmup_handler->getInvalidSessionId();
196 
197  ScopeGuard session_guard = [&] { releaseWarmupSession(sessionId, query_file); };
198  query_file.open(query_file_path);
199  while (std::getline(query_file, db_info)) {
200  if (db_info.length() == 0) {
201  continue;
202  }
203  std::istringstream iss(db_info);
204  iss >> user_keyword >> user_name >> db_name;
205  if (user_keyword.compare(0, 4, "USER") == 0) {
206  // connect to DB for given user_name/db_name with super_user_rights (without
207  // password), & start session
208  g_warmup_handler->super_user_rights_ = true;
209  g_warmup_handler->connect(sessionId, user_name, "", db_name);
210  g_warmup_handler->super_user_rights_ = false;
211 
212  // read and run one query at a time for the DB with the setup connection
213  TQueryResult ret;
214  std::string single_query;
215  while (std::getline(query_file, single_query)) {
216  boost::algorithm::trim(single_query);
217  if (single_query.length() == 0 || single_query[0] == '-') {
218  continue;
219  }
220  if (single_query[0] == '}') {
221  single_query.clear();
222  break;
223  }
224  if (single_query.find(';') == single_query.npos) {
225  std::string multiline_query;
226  std::getline(query_file, multiline_query, ';');
227  single_query += multiline_query;
228  }
229 
230  try {
231  g_warmup_handler->sql_execute(ret, sessionId, single_query, true, "", -1, -1);
232  } catch (...) {
233  LOG(WARNING) << "Exception while executing '" << single_query
234  << "', ignoring";
235  }
236  single_query.clear();
237  }
238 
239  // stop session and disconnect from the DB
240  g_warmup_handler->disconnect(sessionId);
241  sessionId = g_warmup_handler->getInvalidSessionId();
242  } else {
243  LOG(WARNING) << "\nSyntax error in the file: " << query_file_path.c_str()
244  << " Missing expected keyword USER. Following line will be ignored: "
245  << db_info.c_str() << std::endl;
246  }
247  db_info.clear();
248  }
249  } catch (...) {
250  LOG(WARNING) << "Exception while executing warmup queries. "
251  << "Warmup may not be fully completed. Will proceed nevertheless."
252  << std::endl;
253  }
254 }
mapd::shared_ptr< DBHandler > g_warmup_handler
Definition: MapDServer.cpp:80
#define LOG(tag)
Definition: Logger.h:188
void releaseWarmupSession(TSessionId &sessionId, std::ifstream &query_file)
Definition: MapDServer.cpp:173

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void shutdown_handler ( )

Definition at line 86 of file MapDServer.cpp.

References g_mapd_handler, and g_shutdown_once_flag.

Referenced by startMapdServer().

86  {
87  if (g_mapd_handler) {
88  std::call_once(g_shutdown_once_flag, []() { g_mapd_handler->shutdown(); });
89  }
90 }
std::once_flag g_shutdown_once_flag
Definition: MapDServer.cpp:84
mapd::shared_ptr< DBHandler > g_mapd_handler
Definition: MapDServer.cpp:83

+ Here is the caller graph for this function:

void start_server ( TThreadedServer &  server,
const int  port 
)

Definition at line 161 of file MapDServer.cpp.

References logger::ERROR, and LOG.

Referenced by startMapdServer().

161  {
162  try {
163  server.serve();
164  if (errno != 0) {
165  throw std::runtime_error(std::string("Thrift server exited: ") +
166  std::strerror(errno));
167  }
168  } catch (std::exception& e) {
169  LOG(ERROR) << "Exception: " << e.what() << ": port " << port << std::endl;
170  }
171 }
#define LOG(tag)
Definition: Logger.h:188

+ Here is the caller graph for this function:

int startMapdServer ( CommandLineOptions prog_config_opts,
bool  start_http_server = true 
)

Definition at line 305 of file MapDServer.cpp.

References CommandLineOptions::allow_loop_joins, CommandLineOptions::allow_multifrag, CommandLineOptions::authMetadata, CommandLineOptions::base_path, CommandLineOptions::cpu_only, CommandLineOptions::db_leaves, CommandLineOptions::db_query_file, ForeignStorageInterface::destroy(), CommandLineOptions::disk_cache_config, CommandLineOptions::enable_auto_clear_render_mem, CommandLineOptions::enable_legacy_syntax, CommandLineOptions::enable_rendering, CommandLineOptions::enable_runtime_udf, CommandLineOptions::exit_after_warmup, logger::FATAL, file_delete(), g_enable_experimental_string_functions, g_enable_fsi, g_enable_thrift_logs, g_mapd_handler, g_running, g_saw_signal, g_thrift_buf_server, g_thrift_http_server, g_thrift_mutex, SystemParameters::ha_group_id, heartbeat(), CommandLineOptions::http_port, CommandLineOptions::idle_session_duration, logger::INFO, CommandLineOptions::intel_jit_profile, CommandLineOptions::jit_debug, LOG, CommandLineOptions::log_user_origin, CommandLineOptions::max_concurrent_render_sessions, CommandLineOptions::max_session_duration, CommandLineOptions::num_gpus, CommandLineOptions::num_reader_threads, SystemParameters::omnisci_server_port, CommandLineOptions::read_only, register_signal_handlers(), CommandLineOptions::render_compositor_use_last_gpu, CommandLineOptions::render_mem_bytes, CommandLineOptions::render_oom_retry_threshold, CommandLineOptions::renderer_use_vulkan_driver, CommandLineOptions::reserved_gpu_mem, run_warmup_queries(), logger::shutdown(), shutdown_handler(), SystemParameters::ssl_cert_file, SystemParameters::ssl_key_file, SystemParameters::ssl_transport_client_auth, foreign_storage::ForeignTableRefreshScheduler::start(), CommandLineOptions::start_gpu, start_server(), foreign_storage::ForeignTableRefreshScheduler::stop(), CommandLineOptions::string_leaves, CommandLineOptions::system_parameters, CommandLineOptions::udf_compiler_options, CommandLineOptions::udf_compiler_path, and CommandLineOptions::udf_file_name.

Referenced by main().

305  {
306  // try to enforce an orderly shutdown even after a signal
308 
309  // register shutdown procedures for when a normal shutdown happens
310  // be aware that atexit() functions run in reverse order
311  atexit(&logger::shutdown);
312  atexit(&shutdown_handler);
313 
314 #ifdef HAVE_AWS_S3
315  // hold a s3 archive here to survive from a segfault that happens on centos
316  // when s3 transactions and others openssl-ed sessions are interleaved...
317  auto s3_survivor = std::make_unique<S3Archive>("s3://omnisci/s3_survivor.txt", true);
318 #endif
319 
320  // start background thread to clean up _DELETE_ME files
321  const unsigned int wait_interval =
322  3; // wait time in secs after looking for deleted file before looking again
323  std::thread file_delete_thread(file_delete,
324  std::ref(g_running),
325  wait_interval,
326  prog_config_opts.base_path + "/mapd_data");
327  std::thread heartbeat_thread(heartbeat);
328 
329  if (!g_enable_thrift_logs) {
330  apache::thrift::GlobalOutput.setOutputFunction([](const char* msg) {});
331  }
332 
334  // Use the locale setting of the server by default. The generate parameter can be
335  // updated appropriately if a locale override option is ever supported.
336  boost::locale::generator generator;
337  std::locale::global(generator.generate(""));
338  }
339 
340  try {
342  mapd::make_shared<DBHandler>(prog_config_opts.db_leaves,
343  prog_config_opts.string_leaves,
344  prog_config_opts.base_path,
345  prog_config_opts.cpu_only,
346  prog_config_opts.allow_multifrag,
347  prog_config_opts.jit_debug,
348  prog_config_opts.intel_jit_profile,
349  prog_config_opts.read_only,
350  prog_config_opts.allow_loop_joins,
351  prog_config_opts.enable_rendering,
352  prog_config_opts.renderer_use_vulkan_driver,
353  prog_config_opts.enable_auto_clear_render_mem,
354  prog_config_opts.render_oom_retry_threshold,
355  prog_config_opts.render_mem_bytes,
356  prog_config_opts.max_concurrent_render_sessions,
357  prog_config_opts.num_gpus,
358  prog_config_opts.start_gpu,
359  prog_config_opts.reserved_gpu_mem,
360  prog_config_opts.render_compositor_use_last_gpu,
361  prog_config_opts.num_reader_threads,
362  prog_config_opts.authMetadata,
363  prog_config_opts.system_parameters,
364  prog_config_opts.enable_legacy_syntax,
365  prog_config_opts.idle_session_duration,
366  prog_config_opts.max_session_duration,
367  prog_config_opts.enable_runtime_udf,
368  prog_config_opts.udf_file_name,
369  prog_config_opts.udf_compiler_path,
370  prog_config_opts.udf_compiler_options,
371 #ifdef ENABLE_GEOS
372  prog_config_opts.libgeos_so_filename,
373 #endif
374  prog_config_opts.disk_cache_config);
375  } catch (const std::exception& e) {
376  LOG(FATAL) << "Failed to initialize service handler: " << e.what();
377  }
378 
379  if (g_enable_fsi) {
381  }
382 
383  mapd::shared_ptr<TServerSocket> serverSocket;
384  mapd::shared_ptr<TServerSocket> httpServerSocket;
385  if (!prog_config_opts.system_parameters.ssl_cert_file.empty() &&
386  !prog_config_opts.system_parameters.ssl_key_file.empty()) {
387  mapd::shared_ptr<TSSLSocketFactory> sslSocketFactory;
388  sslSocketFactory =
389  mapd::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory(SSLProtocol::SSLTLS));
390  sslSocketFactory->loadCertificate(
391  prog_config_opts.system_parameters.ssl_cert_file.c_str());
392  sslSocketFactory->loadPrivateKey(
393  prog_config_opts.system_parameters.ssl_key_file.c_str());
394  if (prog_config_opts.system_parameters.ssl_transport_client_auth) {
395  sslSocketFactory->authenticate(true);
396  } else {
397  sslSocketFactory->authenticate(false);
398  }
399  sslSocketFactory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
400  serverSocket = mapd::shared_ptr<TServerSocket>(new TSSLServerSocket(
401  prog_config_opts.system_parameters.omnisci_server_port, sslSocketFactory));
402  httpServerSocket = mapd::shared_ptr<TServerSocket>(
403  new TSSLServerSocket(prog_config_opts.http_port, sslSocketFactory));
404  LOG(INFO) << " OmniSci server using encrypted connection. Cert file ["
405  << prog_config_opts.system_parameters.ssl_cert_file << "], key file ["
406  << prog_config_opts.system_parameters.ssl_key_file << "]";
407  } else {
408  LOG(INFO) << " OmniSci server using unencrypted connection";
409  serverSocket = mapd::shared_ptr<TServerSocket>(
410  new TServerSocket(prog_config_opts.system_parameters.omnisci_server_port));
411  httpServerSocket =
412  mapd::shared_ptr<TServerSocket>(new TServerSocket(prog_config_opts.http_port));
413  }
414 
415  ScopeGuard pointer_to_thrift_guard = [] {
416  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
418  };
419 
420  if (prog_config_opts.system_parameters.ha_group_id.empty()) {
421  mapd::shared_ptr<TProcessor> processor(
422  new TrackingProcessor(g_mapd_handler, prog_config_opts.log_user_origin));
423  mapd::shared_ptr<TTransportFactory> bufTransportFactory(
424  new TBufferedTransportFactory());
425  mapd::shared_ptr<TProtocolFactory> bufProtocolFactory(new TBinaryProtocolFactory());
426 
427  mapd::shared_ptr<TServerTransport> bufServerTransport(serverSocket);
428  TThreadedServer bufServer(
429  processor, bufServerTransport, bufTransportFactory, bufProtocolFactory);
430  {
431  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
432  g_thrift_buf_server = &bufServer;
433  }
434 
435  std::thread bufThread(start_server,
436  std::ref(bufServer),
437  prog_config_opts.system_parameters.omnisci_server_port);
438 
439  // TEMPORARY
440  auto warmup_queries = [&prog_config_opts]() {
441  // run warm up queries if any exists
443  g_mapd_handler, prog_config_opts.base_path, prog_config_opts.db_query_file);
444  if (prog_config_opts.exit_after_warmup) {
445  g_running = false;
446  }
447  };
448 
449  mapd::shared_ptr<TServerTransport> httpServerTransport(httpServerSocket);
450  mapd::shared_ptr<TTransportFactory> httpTransportFactory(
451  new THttpServerTransportFactory());
452  mapd::shared_ptr<TProtocolFactory> httpProtocolFactory(new TJSONProtocolFactory());
453  TThreadedServer httpServer(
454  processor, httpServerTransport, httpTransportFactory, httpProtocolFactory);
455  if (start_http_server) {
456  {
457  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
458  g_thrift_http_server = &httpServer;
459  }
460  std::thread httpThread(
461  start_server, std::ref(httpServer), prog_config_opts.http_port);
462 
463  warmup_queries();
464 
465  bufThread.join();
466  httpThread.join();
467  } else {
468  warmup_queries();
469  bufThread.join();
470  }
471  } else { // running ha server
472  LOG(FATAL) << "No High Availability module available, please contact OmniSci support";
473  }
474 
475  g_running = false;
476  file_delete_thread.join();
477  heartbeat_thread.join();
479 
480  if (g_enable_fsi) {
482  }
483 
484  int signum = g_saw_signal;
485  if (signum <= 0 || signum == SIGTERM) {
486  return 0;
487  } else {
488  return signum;
489  }
490 }
mapd_shared_mutex g_thrift_mutex
Definition: MapDServer.cpp:76
TThreadedServer * g_thrift_buf_server
Definition: MapDServer.cpp:78
std::vector< LeafHostInfo > string_leaves
std::string udf_compiler_path
#define LOG(tag)
Definition: Logger.h:188
DiskCacheConfig disk_cache_config
void heartbeat()
Definition: MapDServer.cpp:256
void run_warmup_queries(mapd::shared_ptr< DBHandler > handler, std::string base_path, std::string query_file_path)
Definition: MapDServer.cpp:180
TThreadedServer * g_thrift_http_server
Definition: MapDServer.cpp:77
size_t max_concurrent_render_sessions
std::vector< LeafHostInfo > db_leaves
bool g_enable_thrift_logs
Definition: initdb.cpp:42
mapd::shared_ptr< DBHandler > g_mapd_handler
Definition: MapDServer.cpp:83
void start_server(TThreadedServer &server, const int port)
Definition: MapDServer.cpp:161
std::string ssl_key_file
AuthMetadata authMetadata
void shutdown_handler()
Definition: MapDServer.cpp:86
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:74
static void start(std::atomic< bool > &is_program_running)
void register_signal_handlers()
Definition: MapDServer.cpp:150
void shutdown()
Definition: Logger.cpp:314
bool g_enable_experimental_string_functions
std::atomic< bool > g_running
Definition: MapDServer.cpp:73
std::vector< std::string > udf_compiler_options
mapd_unique_lock< mapd_shared_mutex > write_lock
void file_delete(std::atomic< bool > &program_is_running, const unsigned int wait_interval_seconds, const std::string base_path)
Definition: File.cpp:233
bool g_enable_fsi
Definition: Catalog.cpp:91
std::string ha_group_id
SystemParameters system_parameters
std::string ssl_cert_file

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool g_enable_thrift_logs

Definition at line 42 of file initdb.cpp.

Referenced by CommandLineOptions::fillOptions(), main(), and startMapdServer().

mapd::shared_ptr<DBHandler> g_mapd_handler = 0

Definition at line 83 of file MapDServer.cpp.

Referenced by heartbeat(), shutdown_handler(), and startMapdServer().

std::atomic<bool> g_running {true}

Definition at line 73 of file MapDServer.cpp.

Referenced by heartbeat(), omnisci_signal_handler(), and startMapdServer().

std::atomic<int> g_saw_signal {-1}

Definition at line 74 of file MapDServer.cpp.

Referenced by heartbeat(), omnisci_signal_handler(), and startMapdServer().

std::once_flag g_shutdown_once_flag

Definition at line 84 of file MapDServer.cpp.

Referenced by heartbeat(), and shutdown_handler().

TThreadedServer* g_thrift_buf_server {nullptr}

Definition at line 78 of file MapDServer.cpp.

Referenced by heartbeat(), and startMapdServer().

TThreadedServer* g_thrift_http_server {nullptr}

Definition at line 77 of file MapDServer.cpp.

Referenced by heartbeat(), and startMapdServer().

mapd_shared_mutex g_thrift_mutex

Definition at line 76 of file MapDServer.cpp.

Referenced by heartbeat(), and startMapdServer().

mapd::shared_ptr<DBHandler> g_warmup_handler
Initial value:
=
0

Definition at line 80 of file MapDServer.cpp.

Referenced by releaseWarmupSession(), and run_warmup_queries().