mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Merge pull request #4665 from yandex/fix-llvm-bad-alloc-clobbering
Fix wrong behaviour in case of allocation failure.
This commit is contained in:
commit
faa94c09a9
@ -1,3 +1,4 @@
|
|||||||
|
#include <new>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -139,6 +140,10 @@ bool isClickhouseApp(const std::string & app_suffix, std::vector<char *> & argv)
|
|||||||
|
|
||||||
int main(int argc_, char ** argv_)
|
int main(int argc_, char ** argv_)
|
||||||
{
|
{
|
||||||
|
/// Reset new handler to default (that throws std::bad_alloc)
|
||||||
|
/// It is needed because LLVM library clobbers it.
|
||||||
|
std::set_new_handler(nullptr);
|
||||||
|
|
||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
if (argc_ >= 2 && 0 == strcmp(argv_[1], "-cc1"))
|
if (argc_ >= 2 && 0 == strcmp(argv_[1], "-cc1"))
|
||||||
return mainEntryClickHouseClang(argc_, argv_);
|
return mainEntryClickHouseClang(argc_, argv_);
|
||||||
|
@ -260,6 +260,15 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
|||||||
StatusFile status{path + "status"};
|
StatusFile status{path + "status"};
|
||||||
|
|
||||||
SCOPE_EXIT({
|
SCOPE_EXIT({
|
||||||
|
/** Ask to cancel background jobs all table engines,
|
||||||
|
* and also query_log.
|
||||||
|
* It is important to do early, not in destructor of Context, because
|
||||||
|
* table engines could use Context on destroy.
|
||||||
|
*/
|
||||||
|
LOG_INFO(log, "Shutting down storages.");
|
||||||
|
global_context->shutdown();
|
||||||
|
LOG_DEBUG(log, "Shutted down storages.");
|
||||||
|
|
||||||
/** Explicitly destroy Context. It is more convenient than in destructor of Server, because logger is still available.
|
/** Explicitly destroy Context. It is more convenient than in destructor of Server, because logger is still available.
|
||||||
* At this moment, no one could own shared part of Context.
|
* At this moment, no one could own shared part of Context.
|
||||||
*/
|
*/
|
||||||
@ -498,17 +507,6 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
|||||||
|
|
||||||
global_context->setCurrentDatabase(default_database);
|
global_context->setCurrentDatabase(default_database);
|
||||||
|
|
||||||
SCOPE_EXIT({
|
|
||||||
/** Ask to cancel background jobs all table engines,
|
|
||||||
* and also query_log.
|
|
||||||
* It is important to do early, not in destructor of Context, because
|
|
||||||
* table engines could use Context on destroy.
|
|
||||||
*/
|
|
||||||
LOG_INFO(log, "Shutting down storages.");
|
|
||||||
global_context->shutdown();
|
|
||||||
LOG_DEBUG(log, "Shutted down storages.");
|
|
||||||
});
|
|
||||||
|
|
||||||
if (has_zookeeper && config().has("distributed_ddl"))
|
if (has_zookeeper && config().has("distributed_ddl"))
|
||||||
{
|
{
|
||||||
/// DDL worker should be started after all tables were loaded
|
/// DDL worker should be started after all tables were loaded
|
||||||
|
Loading…
Reference in New Issue
Block a user