OmniSciDB  1dac507f6e
 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 984 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().

984  {
985  // Block all signals for this heartbeat thread, only.
986  sigset_t set;
987  sigfillset(&set);
988  int result = pthread_sigmask(SIG_BLOCK, &set, NULL);
989  if (result != 0) {
990  throw std::runtime_error("heartbeat() thread startup failed");
991  }
992 
993  // Sleep until omnisci_signal_handler or anything clears the g_running flag.
994  VLOG(1) << "heartbeat thread starting";
995  while (::g_running) {
996  using namespace std::chrono;
997  std::this_thread::sleep_for(1s);
998  }
999  VLOG(1) << "heartbeat thread exiting";
1000 
1001  // Get the signal number if there was a signal.
1002  int signum = g_saw_signal;
1003  if (signum >= 1 && signum != SIGTERM) {
1004  LOG(INFO) << "Interrupt signal (" << signum << ") received.";
1005  }
1006 
1007  // if dumping core, try to do some quick stuff
1008  if (signum == SIGQUIT || signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE) {
1009  if (g_mapd_handler) {
1010  std::call_once(g_shutdown_once_flag,
1011  []() { g_mapd_handler->emergency_shutdown(); });
1012  }
1013  logger::shutdown();
1014  return;
1015  // core dump should begin soon after this, see omnisci_signal_handler()
1016  }
1017 
1018  // trigger an orderly shutdown by telling Thrift to stop serving
1019  {
1020  mapd_shared_lock<mapd_shared_mutex> read_lock(g_thrift_mutex);
1021  auto httpserv = g_thrift_http_server;
1022  if (httpserv) {
1023  httpserv->stop();
1024  }
1025  auto bufserv = g_thrift_buf_server;
1026  if (bufserv) {
1027  bufserv->stop();
1028  }
1029  // main() should return soon after this
1030  }
1031 }
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:185
TThreadedServer * g_thrift_http_server
Definition: MapDServer.cpp:89
std::atomic< int > g_saw_signal
Definition: MapDServer.cpp:86
void shutdown()
Definition: Logger.cpp:299
std::atomic< bool > g_running
Definition: MapDServer.cpp:85
#define VLOG(n)
Definition: Logger.h:280

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

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

1193  {
1194  bool has_clust_topo = false;
1195 
1196  MapDProgramOptions prog_config_opts(argv[0], has_clust_topo);
1197 
1198  try {
1199  if (auto return_code = prog_config_opts.parse_command_line(argc, argv)) {
1200  return *return_code;
1201  }
1202 
1203  if (!has_clust_topo) {
1204  prog_config_opts.validate_base_path();
1205  prog_config_opts.init_logging();
1206  prog_config_opts.validate();
1207  return (startMapdServer(prog_config_opts));
1208  }
1209  } catch (std::runtime_error& e) {
1210  std::cerr << "Can't start: " << e.what() << std::endl;
1211  return 1;
1212  } catch (boost::program_options::error& e) {
1213  std::cerr << "Usage Error: " << e.what() << std::endl;
1214  return 1;
1215  }
1216 }
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:185
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:185

+ Here is the caller graph for this function:

int startMapdServer ( MapDProgramOptions prog_config_opts,
bool  start_http_server = true 
)

Definition at line 1033 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, MapDProgramOptions::start_gpu, start_server(), MapDProgramOptions::string_leaves, and MapDProgramOptions::udf_file_name.

Referenced by main().

1033  {
1034  // try to enforce an orderly shutdown even after a signal
1036 
1037  // register shutdown procedures for when a normal shutdown happens
1038  // be aware that atexit() functions run in reverse order
1039  atexit(&logger::shutdown);
1040  atexit(&shutdown_handler);
1041 
1042 #ifdef HAVE_AWS_S3
1043  // hold a s3 archive here to survive from a segfault that happens on centos
1044  // when s3 transactions and others openssl-ed sessions are interleaved...
1045  auto s3_survivor = std::make_unique<S3Archive>("s3://omnisci/s3_survivor.txt", true);
1046 #endif
1047 
1048  // start background thread to clean up _DELETE_ME files
1049  const unsigned int wait_interval =
1050  3; // wait time in secs after looking for deleted file before looking again
1051  std::thread file_delete_thread(file_delete,
1052  std::ref(g_running),
1053  wait_interval,
1054  prog_config_opts.base_path + "/mapd_data");
1055  std::thread heartbeat_thread(heartbeat);
1056 
1057  if (!g_enable_thrift_logs) {
1058  apache::thrift::GlobalOutput.setOutputFunction([](const char* msg) {});
1059  }
1060 
1062  // Use the locale setting of the server by default. The generate parameter can be
1063  // updated appropriately if a locale override option is ever supported.
1064  boost::locale::generator generator;
1065  std::locale::global(generator.generate(""));
1066  }
1067 
1068  try {
1069  g_mapd_handler =
1070  mapd::make_shared<MapDHandler>(prog_config_opts.db_leaves,
1071  prog_config_opts.string_leaves,
1072  prog_config_opts.base_path,
1073  prog_config_opts.cpu_only,
1074  prog_config_opts.allow_multifrag,
1075  prog_config_opts.jit_debug,
1076  prog_config_opts.intel_jit_profile,
1077  prog_config_opts.read_only,
1078  prog_config_opts.allow_loop_joins,
1079  prog_config_opts.enable_rendering,
1080  prog_config_opts.enable_auto_clear_render_mem,
1081  prog_config_opts.render_oom_retry_threshold,
1082  prog_config_opts.render_mem_bytes,
1083  prog_config_opts.num_gpus,
1084  prog_config_opts.start_gpu,
1085  prog_config_opts.reserved_gpu_mem,
1086  prog_config_opts.num_reader_threads,
1087  prog_config_opts.authMetadata,
1088  prog_config_opts.mapd_parameters,
1089  prog_config_opts.enable_legacy_syntax,
1090  prog_config_opts.idle_session_duration,
1091  prog_config_opts.max_session_duration,
1092  prog_config_opts.enable_runtime_udf,
1093  prog_config_opts.udf_file_name);
1094  } catch (const std::exception& e) {
1095  LOG(FATAL) << "Failed to initialize service handler: " << e.what();
1096  }
1097 
1098  mapd::shared_ptr<TServerSocket> serverSocket;
1099  mapd::shared_ptr<TServerSocket> httpServerSocket;
1100  if (!prog_config_opts.mapd_parameters.ssl_cert_file.empty() &&
1101  !prog_config_opts.mapd_parameters.ssl_key_file.empty()) {
1102  mapd::shared_ptr<TSSLSocketFactory> sslSocketFactory;
1103  sslSocketFactory =
1104  mapd::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory(SSLProtocol::SSLTLS));
1105  sslSocketFactory->loadCertificate(
1106  prog_config_opts.mapd_parameters.ssl_cert_file.c_str());
1107  sslSocketFactory->loadPrivateKey(
1108  prog_config_opts.mapd_parameters.ssl_key_file.c_str());
1109  sslSocketFactory->authenticate(false);
1110  sslSocketFactory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
1111  serverSocket = mapd::shared_ptr<TServerSocket>(new TSSLServerSocket(
1112  prog_config_opts.mapd_parameters.omnisci_server_port, sslSocketFactory));
1113  httpServerSocket = mapd::shared_ptr<TServerSocket>(
1114  new TSSLServerSocket(prog_config_opts.http_port, sslSocketFactory));
1115  LOG(INFO) << " OmniSci server using encrypted connection. Cert file ["
1116  << prog_config_opts.mapd_parameters.ssl_cert_file << "], key file ["
1117  << prog_config_opts.mapd_parameters.ssl_key_file << "]";
1118  } else {
1119  LOG(INFO) << " OmniSci server using unencrypted connection";
1120  serverSocket = mapd::shared_ptr<TServerSocket>(
1121  new TServerSocket(prog_config_opts.mapd_parameters.omnisci_server_port));
1122  httpServerSocket =
1123  mapd::shared_ptr<TServerSocket>(new TServerSocket(prog_config_opts.http_port));
1124  }
1125 
1126  ScopeGuard pointer_to_thrift_guard = [] {
1127  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
1129  };
1130 
1131  if (prog_config_opts.mapd_parameters.ha_group_id.empty()) {
1132  mapd::shared_ptr<TProcessor> processor(new MapDProcessor(g_mapd_handler));
1133 
1134  mapd::shared_ptr<TTransportFactory> bufTransportFactory(
1135  new TBufferedTransportFactory());
1136  mapd::shared_ptr<TProtocolFactory> bufProtocolFactory(new TBinaryProtocolFactory());
1137 
1138  mapd::shared_ptr<TServerTransport> bufServerTransport(serverSocket);
1139  TThreadedServer bufServer(
1140  processor, bufServerTransport, bufTransportFactory, bufProtocolFactory);
1141  {
1142  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
1143  g_thrift_buf_server = &bufServer;
1144  }
1145 
1146  std::thread bufThread(start_server,
1147  std::ref(bufServer),
1148  prog_config_opts.mapd_parameters.omnisci_server_port);
1149 
1150  // run warm up queries if any exists
1152  g_mapd_handler, prog_config_opts.base_path, prog_config_opts.db_query_file);
1153  if (prog_config_opts.exit_after_warmup) {
1154  g_running = false;
1155  }
1156 
1157  mapd::shared_ptr<TServerTransport> httpServerTransport(httpServerSocket);
1158  mapd::shared_ptr<TTransportFactory> httpTransportFactory(
1159  new THttpServerTransportFactory());
1160  mapd::shared_ptr<TProtocolFactory> httpProtocolFactory(new TJSONProtocolFactory());
1161  TThreadedServer httpServer(
1162  processor, httpServerTransport, httpTransportFactory, httpProtocolFactory);
1163  if (start_http_server) {
1164  {
1165  mapd_lock_guard<mapd_shared_mutex> write_lock(g_thrift_mutex);
1166  g_thrift_http_server = &httpServer;
1167  }
1168  std::thread httpThread(
1169  start_server, std::ref(httpServer), prog_config_opts.http_port);
1170  bufThread.join();
1171  httpThread.join();
1172  } else {
1173  bufThread.join();
1174  }
1175  } else { // running ha server
1176  LOG(FATAL) << "No High Availability module available, please contact OmniSci support";
1177  }
1178 
1179  g_running = false;
1180  file_delete_thread.join();
1181  heartbeat_thread.join();
1182 
1183  int signum = g_saw_signal;
1184  if (signum <= 0 || signum == SIGTERM) {
1185  return 0;
1186  } else {
1187  return signum;
1188  }
1189 }
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:185
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:334
void heartbeat()
Definition: MapDServer.cpp:984
TThreadedServer * g_thrift_http_server
Definition: MapDServer.cpp:89
MapDParameters mapd_parameters
Definition: MapDServer.cpp:294
std::vector< LeafHostInfo > db_leaves
Definition: MapDServer.cpp:345
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:296
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:292
std::string db_query_file
Definition: MapDServer.cpp:320
void register_signal_handlers()
Definition: MapDServer.cpp:166
void shutdown()
Definition: Logger.cpp:299
bool g_enable_experimental_string_functions
std::atomic< bool > g_running
Definition: MapDServer.cpp:85
std::vector< LeafHostInfo > string_leaves
Definition: MapDServer.cpp:346
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:228

+ 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.