OmniSciDB  eee9fa949c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
/home/jenkins-slave/workspace/core-os-doxygen/MapDServer.cpp File Reference
#include "MapDServer.h"
#include "ThriftHandler/MapDHandler.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 "MapDRelease.h"
#include "Archive/S3Archive.h"
#include "Shared/Logger.h"
#include "Shared/MapDParameters.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 <sstream>
#include <thread>
#include <vector>
#include "Shared/Compressor.h"
+ Include dependency graph for MapDServer.cpp:

Go to the source code of this file.

Classes

class  MapDProgramOptions
 

Namespaces

 anonymous_namespace{MapDServer.cpp}
 

Functions

TableGenerations table_generations_from_thrift (const std::vector< TTableGeneration > &thrift_table_generations)
 
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< MapDHandler > handler, std::string base_path, std::string query_file_path)
 
std::stringstream anonymous_namespace{MapDServer.cpp}::sanitize_config_file (std::ifstream &in)
 
bool anonymous_namespace{MapDServer.cpp}::trim_and_check_file_exists (std::string &filename, const std::string desc)
 
void heartbeat ()
 
int startMapdServer (MapDProgramOptions &prog_config_opts, bool start_http_server=true)
 
int main (int argc, char **argv)
 

Variables

unsigned connect_timeout {20000}
 
unsigned recv_timeout {300000}
 
unsigned send_timeout {300000}
 
bool g_cache_string_hash
 
size_t g_leaf_count
 
bool g_skip_intermediate_count
 
bool g_enable_bump_allocator
 
size_t g_max_memory_allocation_size
 
size_t g_min_memory_allocation_size
 
bool g_enable_experimental_string_functions
 
bool g_enable_table_functions
 
bool g_enable_thrift_logs {false}
 
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< MapDHandlerg_warmup_handler
 
mapd::shared_ptr< MapDHandlerg_mapd_handler = 0
 
std::once_flag g_shutdown_once_flag
 

Function Documentation

void heartbeat ( )

Definition at line 1018 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().

1018  {
1019  // Block all signals for this heartbeat thread, only.
1020  sigset_t set;
1021  sigfillset(&set);
1022  int result = pthread_sigmask(SIG_BLOCK, &set, NULL);
1023  if (result != 0) {
1024  throw std::runtime_error("heartbeat() thread startup failed");
1025  }
1026 
1027  // Sleep until omnisci_signal_handler or anything clears the g_running flag.
1028  VLOG(1) << "heartbeat thread starting";
1029  while (::g_running) {
1030  using namespace std::chrono;
1031  std::this_thread::sleep_for(1s);
1032  }
1033  VLOG(1) << "heartbeat thread exiting";
1034 
1035  // Get the signal number if there was a signal.
1036  int signum = g_saw_signal;
1037  if (signum >= 1 && signum != SIGTERM) {
1038  LOG(INFO) << "Interrupt signal (" << signum << ") received.";
1039  }
1040 
1041  // if dumping core, try to do some quick stuff
1042  if (signum == SIGQUIT || signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE) {
1043  if (g_mapd_handler) {
1044  std::call_once(g_shutdown_once_flag,
1045  []() { g_mapd_handler->emergency_shutdown(); });
1046  }
1047  logger::shutdown();
1048  return;
1049  // core dump should begin soon after this, see omnisci_signal_handler()
1050  }
1051 
1052  // trigger an orderly shutdown by telling Thrift to stop serving
1053  {
1054  mapd_shared_lock<mapd_shared_mutex> read_lock(g_thrift_mutex);
1055  auto httpserv = g_thrift_http_server;
1056  if (httpserv) {
1057  httpserv->stop();
1058  }
1059  auto bufserv = g_thrift_buf_server;
1060  if (bufserv) {
1061  bufserv->stop();
1062  }
1063  // main() should return soon after this
1064  }
1065 }
mapd_shared_mutex g_thrift_mutex
Definition: MapDServer.cpp:88
TThreadedServer * g_thrift_buf_server
Definition: MapDServer.cpp:90
mapd::shared_ptr< MapDHandler > g_mapd_handler
Definition: MapDServer.cpp:107
std::once_flag g_shutdown_once_flag
Definition: MapDServer.cpp:108
#define LOG(tag)
Definition: Logger.h:188
TThreadedServer * g_thrift_http_server
Definition: MapDServer.cpp:89
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:86
void shutdown()
Definition: Logger.cpp:310
std::atomic< bool > g_running
Definition: MapDServer.cpp:85
#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 1237 of file MapDServer.cpp.

References MapDProgramOptions::init_logging(), MapDProgramOptions::parse_command_line(), startMapdServer(), MapDProgramOptions::validate(), and MapDProgramOptions::validate_base_path().

1237  {
1238  bool has_clust_topo = false;
1239 
1240  MapDProgramOptions prog_config_opts(argv[0], has_clust_topo);
1241 
1242  try {
1243  if (auto return_code = prog_config_opts.parse_command_line(argc, argv)) {
1244  return *return_code;
1245  }
1246 
1247  if (!has_clust_topo) {
1248  prog_config_opts.validate_base_path();
1249  prog_config_opts.init_logging();
1250  prog_config_opts.validate();
1251  return (startMapdServer(prog_config_opts));
1252  }
1253  } catch (std::runtime_error& e) {
1254  std::cerr << "Can't start: " << e.what() << std::endl;
1255  return 1;
1256  } catch (boost::program_options::error& e) {
1257  std::cerr << "Usage Error: " << e.what() << std::endl;
1258  return 1;
1259  }
1260 }
int startMapdServer(MapDProgramOptions &prog_config_opts, bool start_http_server=true)

+ Here is the call graph for this function:

void omnisci_signal_handler ( int  signum)

Definition at line 133 of file MapDServer.cpp.

References g_running, g_saw_signal, and register_signal_handler().

Referenced by register_signal_handlers().

133  {
134  // Record the signal number for logging during shutdown.
135  // Only records the first signal if called more than once.
136  int expected_signal{-1};
137  if (!g_saw_signal.compare_exchange_strong(expected_signal, signum)) {
138  return; // this wasn't the first signal
139  }
140 
141  // This point should never be reached more than once.
142 
143  // Tell heartbeat() to shutdown by unsetting the 'g_running' flag.
144  // If 'g_running' is already false, this has no effect and the
145  // shutdown is already in progress.
146  g_running = false;
147 
148  // Handle core dumps specially by pausing inside this signal handler
149  // because on some systems, some signals will execute their default
150  // action immediately when and if the signal handler returns.
151  // We would like to do some emergency cleanup before core dump.
152  if (signum == SIGQUIT || signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE) {
153  // Wait briefly to give heartbeat() a chance to flush the logs and
154  // do any other emergency shutdown tasks.
155  sleep(2);
156 
157  // Explicitly trigger whatever default action this signal would
158  // have done, such as terminate the process or dump core.
159  // Signals are currently blocked so this new signal will be queued
160  // until this signal handler returns.
161  register_signal_handler(signum, SIG_DFL);
162  kill(getpid(), signum);
163  }
164 }
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:86
std::atomic< bool > g_running
Definition: MapDServer.cpp:85
void register_signal_handler(int signum, void(*handler)(int))
Definition: MapDServer.cpp:116

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

Referenced by omnisci_signal_handler(), QueryRunner::QueryRunner::QueryRunner(), and register_signal_handlers().

116  {
117  struct sigaction act;
118  memset(&act, 0, sizeof(act));
119  if (handler != SIG_DFL && handler != SIG_IGN) {
120  // block all signal deliveries while inside the signal handler
121  sigfillset(&act.sa_mask);
122  }
123  act.sa_handler = handler;
124  sigaction(signum, &act, NULL);
125 }

+ Here is the caller graph for this function:

void register_signal_handlers ( )

Definition at line 166 of file MapDServer.cpp.

References omnisci_signal_handler(), and register_signal_handler().

Referenced by startMapdServer().

166  {
173  // Thrift secure socket can cause problems with SIGPIPE
174  register_signal_handler(SIGPIPE, SIG_IGN);
175 }
void register_signal_handler(int signum, void(*handler)(int))
Definition: MapDServer.cpp:116
void omnisci_signal_handler(int signum)
Definition: MapDServer.cpp:133

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

References g_warmup_handler.

Referenced by run_warmup_queries().

185  {
186  query_file.close();
187  if (sessionId != g_warmup_handler->getInvalidSessionId()) {
188  g_warmup_handler->disconnect(sessionId);
189  }
190 }
mapd::shared_ptr< MapDHandler > g_warmup_handler
Definition: MapDServer.cpp:104

+ Here is the caller graph for this function:

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

Definition at line 192 of file MapDServer.cpp.

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

Referenced by startMapdServer().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void shutdown_handler ( )

Definition at line 110 of file MapDServer.cpp.

References g_mapd_handler, and g_shutdown_once_flag.

Referenced by startMapdServer().

110  {
111  if (g_mapd_handler) {
112  std::call_once(g_shutdown_once_flag, []() { g_mapd_handler->shutdown(); });
113  }
114 }
mapd::shared_ptr< MapDHandler > g_mapd_handler
Definition: MapDServer.cpp:107
std::once_flag g_shutdown_once_flag
Definition: MapDServer.cpp:108

+ Here is the caller graph for this function:

void start_server ( TThreadedServer &  server,
const int  port 
)

Definition at line 177 of file MapDServer.cpp.

References logger::ERROR, and LOG.

Referenced by startMapdServer().

177  {
178  try {
179  server.serve();
180  } catch (std::exception& e) {
181  LOG(ERROR) << "Exception: " << e.what() << ": port " << port << std::endl;
182  }
183 }
#define LOG(tag)
Definition: Logger.h:188

+ Here is the caller graph for this function:

int startMapdServer ( MapDProgramOptions prog_config_opts,
bool  start_http_server = true 
)

Definition at line 1067 of file MapDServer.cpp.

References MapDProgramOptions::allow_loop_joins, MapDProgramOptions::allow_multifrag, MapDProgramOptions::authMetadata, MapDProgramOptions::base_path, MapDProgramOptions::cpu_only, MapDProgramOptions::db_leaves, MapDProgramOptions::db_query_file, MapDProgramOptions::enable_auto_clear_render_mem, MapDProgramOptions::enable_legacy_syntax, MapDProgramOptions::enable_rendering, MapDProgramOptions::enable_runtime_udf, MapDProgramOptions::exit_after_warmup, logger::FATAL, file_delete(), g_enable_experimental_string_functions, g_enable_thrift_logs, g_mapd_handler, g_running, g_saw_signal, g_thrift_buf_server, g_thrift_http_server, g_thrift_mutex, MapDParameters::ha_group_id, heartbeat(), MapDProgramOptions::http_port, MapDProgramOptions::idle_session_duration, logger::INFO, MapDProgramOptions::intel_jit_profile, MapDProgramOptions::jit_debug, LOG, MapDProgramOptions::mapd_parameters, MapDProgramOptions::max_session_duration, MapDProgramOptions::num_gpus, MapDProgramOptions::num_reader_threads, MapDParameters::omnisci_server_port, MapDProgramOptions::read_only, register_signal_handlers(), MapDProgramOptions::render_mem_bytes, MapDProgramOptions::render_oom_retry_threshold, MapDProgramOptions::reserved_gpu_mem, run_warmup_queries(), logger::shutdown(), shutdown_handler(), MapDParameters::ssl_cert_file, MapDParameters::ssl_key_file, MapDParameters::ssl_transport_client_auth, MapDProgramOptions::start_gpu, start_server(), MapDProgramOptions::string_leaves, and MapDProgramOptions::udf_file_name.

Referenced by main().

1067  {
1068  // try to enforce an orderly shutdown even after a signal
1070 
1071  // register shutdown procedures for when a normal shutdown happens
1072  // be aware that atexit() functions run in reverse order
1073  atexit(&logger::shutdown);
1074  atexit(&shutdown_handler);
1075 
1076 #ifdef HAVE_AWS_S3
1077  // hold a s3 archive here to survive from a segfault that happens on centos
1078  // when s3 transactions and others openssl-ed sessions are interleaved...
1079  auto s3_survivor = std::make_unique<S3Archive>("s3://omnisci/s3_survivor.txt", true);
1080 #endif
1081 
1082  // start background thread to clean up _DELETE_ME files
1083  const unsigned int wait_interval =
1084  3; // wait time in secs after looking for deleted file before looking again
1085  std::thread file_delete_thread(file_delete,
1086  std::ref(g_running),
1087  wait_interval,
1088  prog_config_opts.base_path + "/mapd_data");
1089  std::thread heartbeat_thread(heartbeat);
1090 
1091  if (!g_enable_thrift_logs) {
1092  apache::thrift::GlobalOutput.setOutputFunction([](const char* msg) {});
1093  }
1094 
1096  // Use the locale setting of the server by default. The generate parameter can be
1097  // updated appropriately if a locale override option is ever supported.
1098  boost::locale::generator generator;
1099  std::locale::global(generator.generate(""));
1100  }
1101 
1102  try {
1103  g_mapd_handler =
1104  mapd::make_shared<MapDHandler>(prog_config_opts.db_leaves,
1105  prog_config_opts.string_leaves,
1106  prog_config_opts.base_path,
1107  prog_config_opts.cpu_only,
1108  prog_config_opts.allow_multifrag,
1109  prog_config_opts.jit_debug,
1110  prog_config_opts.intel_jit_profile,
1111  prog_config_opts.read_only,
1112  prog_config_opts.allow_loop_joins,
1113  prog_config_opts.enable_rendering,
1114  prog_config_opts.enable_auto_clear_render_mem,
1115  prog_config_opts.render_oom_retry_threshold,
1116  prog_config_opts.render_mem_bytes,
1117  prog_config_opts.num_gpus,
1118  prog_config_opts.start_gpu,
1119  prog_config_opts.reserved_gpu_mem,
1120  prog_config_opts.num_reader_threads,
1121  prog_config_opts.authMetadata,
1122  prog_config_opts.mapd_parameters,
1123  prog_config_opts.enable_legacy_syntax,
1124  prog_config_opts.idle_session_duration,
1125  prog_config_opts.max_session_duration,
1126  prog_config_opts.enable_runtime_udf,
1127  prog_config_opts.udf_file_name);
1128  } catch (const std::exception& e) {
1129  LOG(FATAL) << "Failed to initialize service handler: " << e.what();
1130  }
1131 
1132  mapd::shared_ptr<TServerSocket> serverSocket;
1133  mapd::shared_ptr<TServerSocket> httpServerSocket;
1134  if (!prog_config_opts.mapd_parameters.ssl_cert_file.empty() &&
1135  !prog_config_opts.mapd_parameters.ssl_key_file.empty()) {
1136  mapd::shared_ptr<TSSLSocketFactory> sslSocketFactory;
1137  sslSocketFactory =
1138  mapd::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory(SSLProtocol::SSLTLS));
1139  sslSocketFactory->loadCertificate(
1140  prog_config_opts.mapd_parameters.ssl_cert_file.c_str());
1141  sslSocketFactory->loadPrivateKey(
1142  prog_config_opts.mapd_parameters.ssl_key_file.c_str());
1143  if (prog_config_opts.mapd_parameters.ssl_transport_client_auth) {
1144  sslSocketFactory->authenticate(true);
1145  } else {
1146  sslSocketFactory->authenticate(false);
1147  }
1148  sslSocketFactory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
1149  serverSocket = mapd::shared_ptr<TServerSocket>(new TSSLServerSocket(
1150  prog_config_opts.mapd_parameters.omnisci_server_port, sslSocketFactory));
1151  httpServerSocket = mapd::shared_ptr<TServerSocket>(
1152  new TSSLServerSocket(prog_config_opts.http_port, sslSocketFactory));
1153  LOG(INFO) << " OmniSci server using encrypted connection. Cert file ["
1154  << prog_config_opts.mapd_parameters.ssl_cert_file << "], key file ["
1155  << prog_config_opts.mapd_parameters.ssl_key_file << "]";
1156  } else {
1157  LOG(INFO) << " OmniSci server using unencrypted connection";
1158  serverSocket = mapd::shared_ptr<TServerSocket>(
1159  new TServerSocket(prog_config_opts.mapd_parameters.omnisci_server_port));
1160  httpServerSocket =
1161  mapd::shared_ptr<TServerSocket>(new TServerSocket(prog_config_opts.http_port));
1162  }
1163 
1164  ScopeGuard pointer_to_thrift_guard = [] {
1165  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
1167  };
1168 
1169  if (prog_config_opts.mapd_parameters.ha_group_id.empty()) {
1170  mapd::shared_ptr<TProcessor> processor(new MapDTrackingProcessor(g_mapd_handler));
1171  mapd::shared_ptr<TTransportFactory> bufTransportFactory(
1172  new TBufferedTransportFactory());
1173  mapd::shared_ptr<TProtocolFactory> bufProtocolFactory(new TBinaryProtocolFactory());
1174 
1175  mapd::shared_ptr<TServerTransport> bufServerTransport(serverSocket);
1176  TThreadedServer bufServer(
1177  processor, bufServerTransport, bufTransportFactory, bufProtocolFactory);
1178  {
1179  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
1180  g_thrift_buf_server = &bufServer;
1181  }
1182 
1183  std::thread bufThread(start_server,
1184  std::ref(bufServer),
1185  prog_config_opts.mapd_parameters.omnisci_server_port);
1186 
1187  // TEMPORARY
1188  auto warmup_queries = [&prog_config_opts]() {
1189  // run warm up queries if any exists
1191  g_mapd_handler, prog_config_opts.base_path, prog_config_opts.db_query_file);
1192  if (prog_config_opts.exit_after_warmup) {
1193  g_running = false;
1194  }
1195  };
1196 
1197  mapd::shared_ptr<TServerTransport> httpServerTransport(httpServerSocket);
1198  mapd::shared_ptr<TTransportFactory> httpTransportFactory(
1199  new THttpServerTransportFactory());
1200  mapd::shared_ptr<TProtocolFactory> httpProtocolFactory(new TJSONProtocolFactory());
1201  TThreadedServer httpServer(
1202  processor, httpServerTransport, httpTransportFactory, httpProtocolFactory);
1203  if (start_http_server) {
1204  {
1205  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
1206  g_thrift_http_server = &httpServer;
1207  }
1208  std::thread httpThread(
1209  start_server, std::ref(httpServer), prog_config_opts.http_port);
1210 
1211  warmup_queries();
1212 
1213  bufThread.join();
1214  httpThread.join();
1215  } else {
1216  warmup_queries();
1217  bufThread.join();
1218  }
1219  } else { // running ha server
1220  LOG(FATAL) << "No High Availability module available, please contact OmniSci support";
1221  }
1222 
1223  g_running = false;
1224  file_delete_thread.join();
1225  heartbeat_thread.join();
1226 
1227  int signum = g_saw_signal;
1228  if (signum <= 0 || signum == SIGTERM) {
1229  return 0;
1230  } else {
1231  return signum;
1232  }
1233 }
mapd_shared_mutex g_thrift_mutex
Definition: MapDServer.cpp:88
TThreadedServer * g_thrift_buf_server
Definition: MapDServer.cpp:90
mapd::shared_ptr< MapDHandler > g_mapd_handler
Definition: MapDServer.cpp:107
std::string ssl_key_file
#define LOG(tag)
Definition: Logger.h:188
void run_warmup_queries(mapd::shared_ptr< MapDHandler > handler, std::string base_path, std::string query_file_path)
Definition: MapDServer.cpp:192
std::string udf_file_name
Definition: MapDServer.cpp:333
bool ssl_transport_client_auth
void heartbeat()
TThreadedServer * g_thrift_http_server
Definition: MapDServer.cpp:89
MapDParameters mapd_parameters
Definition: MapDServer.cpp:293
std::vector< LeafHostInfo > db_leaves
Definition: MapDServer.cpp:344
bool g_enable_thrift_logs
Definition: initdb.cpp:39
std::string base_path
Definition: MapDServer.cpp:279
void start_server(TThreadedServer &server, const int port)
Definition: MapDServer.cpp:177
bool enable_auto_clear_render_mem
Definition: MapDServer.cpp:295
std::string ssl_cert_file
void shutdown_handler()
Definition: MapDServer.cpp:110
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:86
AuthMetadata authMetadata
Definition: MapDServer.cpp:291
std::string db_query_file
Definition: MapDServer.cpp:319
void register_signal_handlers()
Definition: MapDServer.cpp:166
void shutdown()
Definition: Logger.cpp:310
bool g_enable_experimental_string_functions
std::atomic< bool > g_running
Definition: MapDServer.cpp:85
std::vector< LeafHostInfo > string_leaves
Definition: MapDServer.cpp:345
std::string ha_group_id
void file_delete(std::atomic< bool > &program_is_running, const unsigned int wait_interval_seconds, const std::string base_path)
Definition: File.cpp:227

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TableGenerations table_generations_from_thrift ( const std::vector< TTableGeneration > &  thrift_table_generations)

Definition at line 92 of file MapDServer.cpp.

References TableGenerations::setGeneration().

93  {
94  TableGenerations table_generations;
95  for (const auto& thrift_table_generation : thrift_table_generations) {
96  table_generations.setGeneration(
97  thrift_table_generation.table_id,
98  TableGeneration{static_cast<size_t>(thrift_table_generation.tuple_count),
99  static_cast<size_t>(thrift_table_generation.start_rowid)});
100  }
101  return table_generations;
102 }
void setGeneration(const uint32_t id, const TableGeneration &generation)

+ Here is the call graph for this function:

Variable Documentation

unsigned connect_timeout {20000}

Definition at line 70 of file MapDServer.cpp.

bool g_cache_string_hash

Definition at line 88 of file Execute.cpp.

bool g_enable_bump_allocator
bool g_enable_experimental_string_functions

Definition at line 40 of file RelAlgTranslator.cpp.

bool g_enable_thrift_logs {false}

Definition at line 83 of file MapDServer.cpp.

mapd::shared_ptr<MapDHandler> g_mapd_handler = 0

Definition at line 107 of file MapDServer.cpp.

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

size_t g_max_memory_allocation_size
size_t g_min_memory_allocation_size
std::atomic<bool> g_running {true}

Definition at line 85 of file MapDServer.cpp.

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

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

Definition at line 86 of file MapDServer.cpp.

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

std::once_flag g_shutdown_once_flag

Definition at line 108 of file MapDServer.cpp.

Referenced by heartbeat(), and shutdown_handler().

bool g_skip_intermediate_count
TThreadedServer* g_thrift_buf_server {nullptr}

Definition at line 90 of file MapDServer.cpp.

Referenced by heartbeat(), and startMapdServer().

TThreadedServer* g_thrift_http_server {nullptr}

Definition at line 89 of file MapDServer.cpp.

Referenced by heartbeat(), and startMapdServer().

mapd_shared_mutex g_thrift_mutex

Definition at line 88 of file MapDServer.cpp.

Referenced by heartbeat(), and startMapdServer().

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

Definition at line 104 of file MapDServer.cpp.

Referenced by releaseWarmupSession(), and run_warmup_queries().

unsigned recv_timeout {300000}

Definition at line 71 of file MapDServer.cpp.

unsigned send_timeout {300000}

Definition at line 72 of file MapDServer.cpp.