OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
/home/jenkins-slave/workspace/core-os-doxygen/HeavyDB.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
19 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
20 #include "Shared/ThriftConfig.h"
21 #endif
22 
23 #ifdef HAVE_THRIFT_THREADFACTORY
24 #include <thrift/concurrency/ThreadFactory.h>
25 #else
26 #include <thrift/concurrency/PlatformThreadFactory.h>
27 #endif
28 
29 #include <thrift/concurrency/ThreadManager.h>
30 #include <thrift/protocol/TBinaryProtocol.h>
31 #include <thrift/server/TThreadedServer.h>
32 #include <thrift/transport/TBufferTransports.h>
33 #include <thrift/transport/THttpServer.h>
34 #include <thrift/transport/TSSLServerSocket.h>
35 #include <thrift/transport/TSSLSocket.h>
36 #include <thrift/transport/TServerSocket.h>
38 
39 #include "Logger/Logger.h"
41 #include "Shared/file_delete.h"
43 #include "Shared/scope.h"
44 
45 #include <boost/algorithm/string.hpp>
46 #include <boost/algorithm/string/trim.hpp>
47 #include <boost/filesystem.hpp>
48 #include <boost/locale/generator.hpp>
49 #include <boost/make_shared.hpp>
50 #include <boost/program_options.hpp>
51 
52 #include <csignal>
53 #include <cstdlib>
54 #include <sstream>
55 #include <thread>
56 #include <vector>
57 
58 #ifdef HAVE_AWS_S3
59 #include "DataMgr/OmniSciAwsSdk.h"
60 #endif
61 #include "MapDRelease.h"
63 #include "Shared/Compressor.h"
65 #include "Shared/file_delete.h"
66 #include "Shared/scope.h"
68 
69 using namespace ::apache::thrift;
70 using namespace ::apache::thrift::concurrency;
71 using namespace ::apache::thrift::protocol;
72 using namespace ::apache::thrift::server;
73 using namespace ::apache::thrift::transport;
74 
75 extern bool g_enable_thrift_logs;
76 
77 // Set g_running to false to trigger normal server shutdown.
78 std::atomic<bool> g_running{true};
79 
80 extern bool g_enable_http_binary_server;
81 
82 namespace { // anonymous
83 
84 std::atomic<int> g_saw_signal{-1};
85 
86 std::shared_ptr<TThreadedServer> g_thrift_http_server;
87 std::shared_ptr<TThreadedServer> g_thrift_http_binary_server;
88 std::shared_ptr<TThreadedServer> g_thrift_tcp_server;
89 
90 std::shared_ptr<DBHandler> g_warmup_handler;
91 // global "g_warmup_handler" needed to avoid circular dependency
92 // between "DBHandler" & function "run_warmup_queries"
93 
94 std::shared_ptr<DBHandler> g_db_handler;
95 
96 void register_signal_handler(int signum, void (*handler)(int)) {
97 #ifdef _WIN32
98  signal(signum, handler);
99 #else
100  struct sigaction act;
101  memset(&act, 0, sizeof(act));
102  if (handler != SIG_DFL && handler != SIG_IGN) {
103  // block all signal deliveries while inside the signal handler
104  sigfillset(&act.sa_mask);
105  }
106  act.sa_handler = handler;
107  sigaction(signum, &act, NULL);
108 #endif
109 }
110 
111 // Signal handler to set a global flag telling the server to exit.
112 // Do not call other functions inside this (or any) signal handler
113 // unless you really know what you are doing. See also:
114 // man 7 signal-safety
115 // man 7 signal
116 // https://en.wikipedia.org/wiki/Reentrancy_(computing)
117 void heavydb_signal_handler(int signum) {
118  // Record the signal number for logging during shutdown.
119  // Only records the first signal if called more than once.
120  int expected_signal{-1};
121  if (!g_saw_signal.compare_exchange_strong(expected_signal, signum)) {
122  return; // this wasn't the first signal
123  }
124 
125  // This point should never be reached more than once.
126 
127  // Tell heartbeat() to shutdown by unsetting the 'g_running' flag.
128  // If 'g_running' is already false, this has no effect and the
129  // shutdown is already in progress.
130  g_running = false;
131 
132  // Handle core dumps specially by pausing inside this signal handler
133  // because on some systems, some signals will execute their default
134  // action immediately when and if the signal handler returns.
135  // We would like to do some emergency cleanup before core dump.
136  if (signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE
137 #ifndef _WIN32
138  || signum == SIGQUIT
139 #endif
140  ) {
141  // Wait briefly to give heartbeat() a chance to flush the logs and
142  // do any other emergency shutdown tasks.
143  std::this_thread::sleep_for(std::chrono::seconds(2));
144 
145  // Explicitly trigger whatever default action this signal would
146  // have done, such as terminate the process or dump core.
147  // Signals are currently blocked so this new signal will be queued
148  // until this signal handler returns.
149  register_signal_handler(signum, SIG_DFL);
150 #ifdef _WIN32
151  raise(signum);
152 #else
153  kill(getpid(), signum);
154 #endif
155  std::this_thread::sleep_for(std::chrono::seconds(5));
156 
157 #ifndef __APPLE__
158  // as a last resort, abort
159  // primary used in Docker environments, where we can end up with PID 1 and fail to
160  // catch unix signals
161  quick_exit(signum);
162 #endif
163  }
164 }
165 
168 #ifndef _WIN32
171 #endif
175 #ifndef _WIN32
176  // Thrift secure socket can cause problems with SIGPIPE
177  register_signal_handler(SIGPIPE, SIG_IGN);
178 #endif
179 }
180 } // anonymous namespace
181 
182 void start_server(std::shared_ptr<TThreadedServer> server, const int port) {
183  try {
184  server->serve();
185  if (errno != 0) {
186  throw std::runtime_error(std::string("Thrift server exited: ") +
187  std::strerror(errno));
188  }
189  } catch (std::exception& e) {
190  LOG(ERROR) << "Exception: " << e.what() << ": port " << port << std::endl;
191  }
192 }
193 
194 void releaseWarmupSession(TSessionId& sessionId, std::ifstream& query_file) noexcept {
195  query_file.close();
196  if (sessionId != g_warmup_handler->getInvalidSessionId()) {
197  try {
198  g_warmup_handler->disconnect(sessionId);
199  } catch (...) {
200  LOG(ERROR) << "Failed to disconnect warmup session, possible failure to run warmup "
201  "queries.";
202  }
203  }
204 }
205 
206 void run_warmup_queries(std::shared_ptr<DBHandler> handler,
207  std::string base_path,
208  std::string query_file_path) {
209  // run warmup queries to load cache if requested
210  if (query_file_path.empty()) {
211  return;
212  }
213  if (handler->isAggregator()) {
214  LOG(INFO) << "Skipping warmup query execution on the aggregator, queries should be "
215  "run directly on the leaf nodes.";
216  return;
217  }
218 
219  LOG(INFO) << "Running DB warmup with queries from " << query_file_path;
220  try {
221  g_warmup_handler = handler;
222  std::string db_info;
223  std::string user_keyword, user_name, db_name;
224  std::ifstream query_file;
227  TSessionId sessionId = g_warmup_handler->getInvalidSessionId();
228 
229  ScopeGuard session_guard = [&] { releaseWarmupSession(sessionId, query_file); };
230  query_file.open(query_file_path);
231  while (std::getline(query_file, db_info)) {
232  if (db_info.length() == 0) {
233  continue;
234  }
235  std::istringstream iss(db_info);
236  iss >> user_keyword >> user_name >> db_name;
237  if (user_keyword.compare(0, 4, "USER") == 0) {
238  // connect to DB for given user_name/db_name with super_user_rights (without
239  // password), & start session
240  g_warmup_handler->super_user_rights_ = true;
241  g_warmup_handler->connect(sessionId, user_name, "", db_name);
242  g_warmup_handler->super_user_rights_ = false;
243 
244  // read and run one query at a time for the DB with the setup connection
245  TQueryResult ret;
246  std::string single_query;
247  while (std::getline(query_file, single_query)) {
248  boost::algorithm::trim(single_query);
249  if (single_query.length() == 0 || single_query[0] == '-') {
250  continue;
251  }
252  if (single_query[0] == '}') {
253  single_query.clear();
254  break;
255  }
256  if (single_query.find(';') == single_query.npos) {
257  std::string multiline_query;
258  std::getline(query_file, multiline_query, ';');
259  single_query += multiline_query;
260  }
261 
262  try {
263  g_warmup_handler->sql_execute(ret, sessionId, single_query, true, "", -1, -1);
264  } catch (...) {
265  LOG(WARNING) << "Exception while executing '" << single_query
266  << "', ignoring";
267  }
268  single_query.clear();
269  }
270 
271  // stop session and disconnect from the DB
272  g_warmup_handler->disconnect(sessionId);
273  sessionId = g_warmup_handler->getInvalidSessionId();
274  } else {
275  LOG(WARNING) << "\nSyntax error in the file: " << query_file_path.c_str()
276  << " Missing expected keyword USER. Following line will be ignored: "
277  << db_info.c_str() << std::endl;
278  }
279  db_info.clear();
280  }
281  } catch (const std::exception& e) {
282  LOG(WARNING)
283  << "Exception while executing warmup queries. "
284  << "Warmup may not be fully completed. Will proceed nevertheless.\nError was: "
285  << e.what();
286  }
287 }
288 
290 extern bool g_enable_fsi;
291 
292 void thrift_stop() {
293  if (auto thrift_http_server = g_thrift_http_server; thrift_http_server) {
294  thrift_http_server->stop();
295  }
296  g_thrift_http_server.reset();
297 
298  if (auto thrift_http_binary_server = g_thrift_http_binary_server;
299  thrift_http_binary_server) {
300  thrift_http_binary_server->stop();
301  }
302  g_thrift_http_binary_server.reset();
303 
304  if (auto thrift_tcp_server = g_thrift_tcp_server; thrift_tcp_server) {
305  thrift_tcp_server->stop();
306  }
307  g_thrift_tcp_server.reset();
308 }
309 
310 void heartbeat() {
311 #ifndef _WIN32
312  // Block all signals for this heartbeat thread, only.
313  sigset_t set;
314  sigfillset(&set);
315  int result = pthread_sigmask(SIG_BLOCK, &set, NULL);
316  if (result != 0) {
317  throw std::runtime_error("heartbeat() thread startup failed");
318  }
319 #endif
320 
321  // Sleep until heavydb_signal_handler or anything clears the g_running flag.
322  VLOG(1) << "heartbeat thread starting";
323  while (::g_running) {
324  using namespace std::chrono;
325  std::this_thread::sleep_for(1s);
326  }
327  VLOG(1) << "heartbeat thread exiting";
328 
329  // Get the signal number if there was a signal.
330  int signum = g_saw_signal;
331  if (signum >= 1 && signum != SIGTERM) {
332  LOG(INFO) << "Interrupt signal (" << signum << ") received.";
333  }
334 
335  // If dumping core, try to do some quick stuff.
336  if (signum == SIGABRT || signum == SIGSEGV || signum == SIGFPE
337 #ifndef _WIN32
338  || signum == SIGQUIT
339 #endif
340  ) {
341  // Need to shut down calcite.
342  if (auto db_handler = g_db_handler; db_handler) {
343  db_handler->emergency_shutdown();
344  }
345  // Need to flush the logs for debugging.
347  return;
348  // Core dump should begin soon after this. See heavydb_signal_handler().
349  // We leave the rest of the server process as is for the core dump image.
350  }
351 
352  // Stopping the Thrift thread(s) will allow main() to return.
353  thrift_stop();
354 }
355 
356 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
357 namespace {
358 class UnboundedTBufferedTransportFactory : public TBufferedTransportFactory {
359  public:
360  UnboundedTBufferedTransportFactory() : TBufferedTransportFactory() {}
361 
362  std::shared_ptr<TTransport> getTransport(
363  std::shared_ptr<TTransport> transport) override {
364  return std::make_shared<TBufferedTransport>(transport, shared::default_tconfig());
365  }
366 };
367 
368 class UnboundedTHttpServerTransportFactory : public THttpServerTransportFactory {
369  public:
370  UnboundedTHttpServerTransportFactory() : THttpServerTransportFactory() {}
371 
372  std::shared_ptr<TTransport> getTransport(
373  std::shared_ptr<TTransport> transport) override {
374  return std::make_shared<THttpServer>(transport, shared::default_tconfig());
375  }
376 };
377 } // namespace
378 #endif
379 
381  bool start_http_server = true) {
382  // Prepare to launch the Thrift server.
383  LOG(INFO) << "HeavyDB starting up";
385 #ifdef ENABLE_TBB
386  LOG(INFO) << "Initializing TBB with " << cpu_threads() << " threads.";
388  const int32_t tbb_max_concurrency{threading_tbb::g_tbb_arena.max_concurrency()};
389  LOG(INFO) << "TBB max concurrency: " << tbb_max_concurrency << " threads.";
390 #endif // ENABLE_TBB
391 #ifdef HAVE_AWS_S3
393 #endif // HAVE_AWS_S3
394  std::set<std::unique_ptr<std::thread>> server_threads;
395  auto wait_for_server_threads = [&] {
396  for (auto& th : server_threads) {
397  try {
398  th->join();
399  } catch (const std::system_error& e) {
400  if (e.code() != std::errc::invalid_argument) {
401  LOG(WARNING) << "std::thread join failed: " << e.what();
402  }
403  } catch (const std::exception& e) {
404  LOG(WARNING) << "std::thread join failed: " << e.what();
405  } catch (...) {
406  LOG(WARNING) << "std::thread join failed";
407  }
408  }
409  };
410  ScopeGuard server_shutdown_guard = [&] {
411  // This function will never be called by exit(), but we shouldn't ever be calling
412  // exit(), we should be setting g_running to false instead.
413  LOG(INFO) << "HeavyDB shutting down";
414 
415  g_running = false;
416 
417  thrift_stop();
418 
419  if (g_enable_fsi) {
421  }
422 
423  g_db_handler.reset();
424 
425  wait_for_server_threads();
426 
427 #ifdef HAVE_AWS_S3
429 #endif // HAVE_AWS_S3
430 
431  // Flush the logs last to capture maximum debugging information.
433  };
434 
435  // start background thread to clean up _DELETE_ME files
436  const unsigned int wait_interval =
437  3; // wait time in secs after looking for deleted file before looking again
438  server_threads.insert(std::make_unique<std::thread>(
439  file_delete,
440  std::ref(g_running),
441  wait_interval,
442  prog_config_opts.base_path + "/" + shared::kDataDirectoryName));
443  server_threads.insert(std::make_unique<std::thread>(heartbeat));
444 
445  if (!g_enable_thrift_logs) {
446  apache::thrift::GlobalOutput.setOutputFunction([](const char* msg) {});
447  }
448 
449  // Thrift event handler for database server setup.
450  try {
451  if (prog_config_opts.system_parameters.master_address.empty()) {
452  // Handler for a single database server. (DBHandler)
453  g_db_handler =
454  std::make_shared<DBHandler>(prog_config_opts.db_leaves,
455  prog_config_opts.string_leaves,
456  prog_config_opts.base_path,
457  prog_config_opts.allow_multifrag,
458  prog_config_opts.jit_debug,
459  prog_config_opts.intel_jit_profile,
460  prog_config_opts.read_only,
461  prog_config_opts.allow_loop_joins,
462  prog_config_opts.enable_rendering,
463  prog_config_opts.renderer_use_ppll_polys,
464  prog_config_opts.renderer_prefer_igpu,
465  prog_config_opts.renderer_vulkan_timeout_ms,
466  prog_config_opts.renderer_use_parallel_executors,
467  prog_config_opts.enable_auto_clear_render_mem,
468  prog_config_opts.render_oom_retry_threshold,
469  prog_config_opts.render_mem_bytes,
470  prog_config_opts.max_concurrent_render_sessions,
471  prog_config_opts.reserved_gpu_mem,
472  prog_config_opts.render_compositor_use_last_gpu,
473  prog_config_opts.num_reader_threads,
474  prog_config_opts.authMetadata,
475  prog_config_opts.system_parameters,
476  prog_config_opts.enable_legacy_syntax,
477  prog_config_opts.idle_session_duration,
478  prog_config_opts.max_session_duration,
479  prog_config_opts.udf_file_name,
480  prog_config_opts.udf_compiler_path,
481  prog_config_opts.udf_compiler_options,
482 #ifdef ENABLE_GEOS
483  prog_config_opts.libgeos_so_filename,
484 #endif
485  prog_config_opts.disk_cache_config,
486  false);
487  } else { // running ha server
488  LOG(FATAL)
489  << "No High Availability module available, please contact OmniSci support";
490  }
491  } catch (const std::exception& e) {
492  LOG(FATAL) << "Failed to initialize service handler: " << e.what();
493  }
494 
495  if (g_enable_fsi) {
497  }
498 
499  // TCP port setup. We use Thrift both for a TCP socket and for an optional HTTP socket.
500  std::shared_ptr<TServerSocket> tcp_socket;
501  std::shared_ptr<TServerSocket> http_socket;
502  std::shared_ptr<TServerSocket> http_binary_socket;
503 
504  if (!prog_config_opts.system_parameters.ssl_cert_file.empty() &&
505  !prog_config_opts.system_parameters.ssl_key_file.empty()) {
506  // SSL port setup.
507  auto sslSocketFactory = std::make_shared<TSSLSocketFactory>(SSLProtocol::SSLTLS);
508  sslSocketFactory->loadCertificate(
509  prog_config_opts.system_parameters.ssl_cert_file.c_str());
510  sslSocketFactory->loadPrivateKey(
511  prog_config_opts.system_parameters.ssl_key_file.c_str());
512  if (prog_config_opts.system_parameters.ssl_transport_client_auth) {
513  sslSocketFactory->authenticate(true);
514  } else {
515  sslSocketFactory->authenticate(false);
516  }
517  sslSocketFactory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
518  tcp_socket = std::make_shared<TSSLServerSocket>(
519  prog_config_opts.system_parameters.omnisci_server_port, sslSocketFactory);
520  if (start_http_server) {
521  http_socket = std::make_shared<TSSLServerSocket>(prog_config_opts.http_port,
522  sslSocketFactory);
523  }
525  http_binary_socket = std::make_shared<TSSLServerSocket>(
526  prog_config_opts.http_binary_port, sslSocketFactory);
527  }
528  LOG(INFO) << " HeavyDB server using encrypted connection. Cert file ["
529  << prog_config_opts.system_parameters.ssl_cert_file << "], key file ["
530  << prog_config_opts.system_parameters.ssl_key_file << "]";
531 
532  } else {
533  // Non-SSL port setup.
534  LOG(INFO) << " HeavyDB server using unencrypted connection";
535  tcp_socket = std::make_shared<TServerSocket>(
536  prog_config_opts.system_parameters.omnisci_server_port);
537  if (start_http_server) {
538  http_socket = std::make_shared<TServerSocket>(prog_config_opts.http_port);
539  }
541  http_binary_socket =
542  std::make_shared<TServerSocket>(prog_config_opts.http_binary_port);
543  }
544  }
545 
546  // Thrift uses the same processor for both the TCP port and the HTTP port.
547  std::shared_ptr<TProcessor> processor{std::make_shared<TrackingProcessor>(
548  g_db_handler, prog_config_opts.log_user_origin)};
549 
550  // Thrift TCP server launch.
551  std::shared_ptr<TServerTransport> tcp_st = tcp_socket;
552 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
553  std::shared_ptr<TTransportFactory> tcp_tf{
554  std::make_shared<UnboundedTBufferedTransportFactory>()};
555 #else
556  std::shared_ptr<TTransportFactory> tcp_tf{
557  std::make_shared<TBufferedTransportFactory>()};
558 #endif
559  std::shared_ptr<TProtocolFactory> tcp_pf{std::make_shared<TBinaryProtocolFactory>()};
560  g_thrift_tcp_server.reset(new TThreadedServer(processor, tcp_st, tcp_tf, tcp_pf));
561  server_threads.insert(std::make_unique<std::thread>(
562  start_server,
563  g_thrift_tcp_server,
564  prog_config_opts.system_parameters.omnisci_server_port));
565 
566  // Thrift HTTP server launch.
567  if (start_http_server) {
568  std::shared_ptr<TServerTransport> http_st = http_socket;
569 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
570  std::shared_ptr<TTransportFactory> http_tf{
571  std::make_shared<UnboundedTHttpServerTransportFactory>()};
572 #else
573  std::shared_ptr<TTransportFactory> http_tf{
574  std::make_shared<THttpServerTransportFactory>()};
575 #endif
576  std::shared_ptr<TProtocolFactory> http_pf{std::make_shared<TJSONProtocolFactory>()};
577  g_thrift_http_server.reset(new TThreadedServer(processor, http_st, http_tf, http_pf));
578  server_threads.insert(std::make_unique<std::thread>(
579  start_server, g_thrift_http_server, prog_config_opts.http_port));
580  }
581 
582  // Thrift HTTP binary protocol server launch.
584  std::shared_ptr<TServerTransport> http_binary_st = http_binary_socket;
585 #ifdef HAVE_THRIFT_MESSAGE_LIMIT
586  std::shared_ptr<TTransportFactory> http_binary_tf{
587  std::make_shared<UnboundedTHttpServerTransportFactory>()};
588 #else
589  std::shared_ptr<TTransportFactory> http_binary_tf{
590  std::make_shared<THttpServerTransportFactory>()};
591 #endif
592  std::shared_ptr<TProtocolFactory> http_binary_pf{
593  std::make_shared<TBinaryProtocolFactory>()};
594  g_thrift_http_binary_server.reset(
595  new TThreadedServer(processor, http_binary_st, http_binary_tf, http_binary_pf));
596  server_threads.insert(std::make_unique<std::thread>(
597  start_server, g_thrift_http_binary_server, prog_config_opts.http_binary_port));
598  }
599 
600  // Run warm up queries if any exist.
602  g_db_handler, prog_config_opts.base_path, prog_config_opts.db_query_file);
603  if (prog_config_opts.exit_after_warmup) {
604  g_running = false;
605  }
606 
607  // Main thread blocks for as long as the servers are running.
608  wait_for_server_threads();
609 
610  // Clean shutdown.
611  int signum = g_saw_signal;
612  if (signum <= 0 || signum == SIGTERM) {
613  return 0;
614  } else {
615  return signum;
616  }
617 }
618 
619 int main(int argc, char** argv) {
620  bool has_clust_topo = false;
621 
622  CommandLineOptions prog_config_opts(argv[0], has_clust_topo);
623 
624  try {
625  if (auto return_code =
626  prog_config_opts.parse_command_line(argc, argv, !has_clust_topo)) {
627  return *return_code;
628  }
629 
630  if (!has_clust_topo) {
631  prog_config_opts.validate_base_path();
632  prog_config_opts.validate();
633  return (startHeavyDBServer(prog_config_opts));
634  }
635  } catch (std::runtime_error& e) {
636  std::cerr << "Server Error: " << e.what() << std::endl;
637  return 1;
638  } catch (boost::program_options::error& e) {
639  std::cerr << "Usage Error: " << e.what() << std::endl;
640  return 1;
641  }
642 }
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:206
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:94
#define LOG(tag)
Definition: Logger.h:285
void heartbeat()
Definition: HeavyDB.cpp:310
shared utility for the db server and string dictionary server to remove old files ...
void start_server(std::shared_ptr< TThreadedServer > server, const int port)
Definition: HeavyDB.cpp:182
std::shared_ptr< TThreadedServer > g_thrift_http_binary_server
Definition: HeavyDB.cpp:87
boost::optional< int > parse_command_line(int argc, char const *const *argv, const bool should_init_logging=false)
std::atomic< int > g_saw_signal
Definition: HeavyDB.cpp:84
size_t max_concurrent_render_sessions
singleton class to handle concurrancy and state for blosc library. A C++ wrapper over a pure C librar...
tbb::task_arena g_tbb_arena
std::shared_ptr< apache::thrift::TConfiguration > default_tconfig()
Definition: ThriftConfig.h:26
std::vector< LeafHostInfo > db_leaves
int startHeavyDBServer(CommandLineOptions &prog_config_opts, bool start_http_server=true)
Definition: HeavyDB.cpp:380
bool g_enable_http_binary_server
std::shared_ptr< TThreadedServer > g_thrift_http_server
Definition: HeavyDB.cpp:86
std::string ssl_key_file
AuthMetadata authMetadata
static void start(std::atomic< bool > &is_program_running)
void shutdown()
Definition: Logger.cpp:397
std::vector< std::string > udf_compiler_options
void register_signal_handler(int signum, void(*handler)(int))
Definition: HeavyDB.cpp:96
std::shared_ptr< DBHandler > g_warmup_handler
Definition: HeavyDB.cpp:90
std::atomic< bool > g_running
Definition: HeavyDB.cpp:78
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:304
bool g_enable_fsi
Definition: Catalog.cpp:96
int cpu_threads()
Definition: thread_count.h:25
bool g_enable_thrift_logs
Definition: HeavyDB.cpp:289
void heavydb_signal_handler(int signum)
Definition: HeavyDB.cpp:117
#define VLOG(n)
Definition: Logger.h:387
void releaseWarmupSession(TSessionId &sessionId, std::ifstream &query_file) noexcept
Definition: HeavyDB.cpp:194
void thrift_stop()
Definition: HeavyDB.cpp:292
std::string master_address
std::shared_ptr< TThreadedServer > g_thrift_tcp_server
Definition: HeavyDB.cpp:88
SystemParameters system_parameters
std::string ssl_cert_file