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