Merge branch 'master' of github.com:ClickHouse/ClickHouse into clickhouse-copier

This commit is contained in:
Nikita Mikhaylov 2020-02-18 16:22:08 +03:00
commit bf9ed2c0a3
9 changed files with 23 additions and 14 deletions

View File

@ -258,6 +258,16 @@ endif ()
add_subdirectory(src/Common/ZooKeeper)
add_subdirectory(src/Common/Config)
# It's Ok to avoid tracking of unresolved symbols for static linkage because
# they will be resolved at link time nevertheless.
function(target_ignore_unresolved_symbols target)
if (OS_DARWIN)
target_link_libraries (${target} PRIVATE -Wl,-undefined,dynamic_lookup)
else()
target_link_libraries (${target} PRIVATE -Wl,--unresolved-symbols=ignore-all)
endif()
endfunction()
set (all_modules)
macro(add_object_library name common_path)
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
@ -266,7 +276,7 @@ macro(add_object_library name common_path)
list (APPEND all_modules ${name})
add_headers_and_sources(${name} ${common_path})
add_library(${name} SHARED ${${name}_sources} ${${name}_headers})
target_link_libraries (${name} PRIVATE -Wl,--unresolved-symbols=ignore-all)
target_ignore_unresolved_symbols(${name})
endif ()
endmacro()
@ -297,6 +307,7 @@ add_object_library(clickhouse_processors_sources src/Processors/Sources)
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
add_library (dbms STATIC ${dbms_headers} ${dbms_sources})
set (all_modules dbms)
target_ignore_unresolved_symbols (dbms)
else()
add_library (dbms SHARED ${dbms_headers} ${dbms_sources})
target_link_libraries (dbms PUBLIC ${all_modules})
@ -551,13 +562,6 @@ endif()
if (USE_JEMALLOC)
dbms_target_include_directories (SYSTEM BEFORE PRIVATE ${JEMALLOC_INCLUDE_DIR}) # used in Interpreters/AsynchronousMetrics.cpp
target_include_directories (clickhouse_new_delete SYSTEM BEFORE PRIVATE ${JEMALLOC_INCLUDE_DIR})
if(NOT MAKE_STATIC_LIBRARIES AND ${JEMALLOC_LIBRARIES} MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
# mallctl in dbms/src/Interpreters/AsynchronousMetrics.cpp
# Actually we link JEMALLOC to almost all libraries.
# This is just hotfix for some uninvestigated problem.
target_link_libraries(clickhouse_interpreters PRIVATE ${JEMALLOC_LIBRARIES})
endif()
endif ()
dbms_target_include_directories (PUBLIC ${DBMS_INCLUDE_DIR})

View File

@ -65,7 +65,7 @@ public:
"You must create it manulally with appropriate value or 0 for first start.");
}
int fd = ::open(path.c_str(), O_RDWR | O_CREAT, 0666);
int fd = ::open(path.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0666);
if (-1 == fd)
DB::throwFromErrnoWithPath("Cannot open file " + path, path, DB::ErrorCodes::CANNOT_OPEN_FILE);
@ -139,7 +139,7 @@ public:
{
bool file_exists = Poco::File(path).exists();
int fd = ::open(path.c_str(), O_RDWR | O_CREAT, 0666);
int fd = ::open(path.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0666);
if (-1 == fd)
DB::throwFromErrnoWithPath("Cannot open file " + path, path, DB::ErrorCodes::CANNOT_OPEN_FILE);

View File

@ -48,7 +48,7 @@ StatusFile::StatusFile(const std::string & path_)
LOG_INFO(&Logger::get("StatusFile"), "Status file " << path << " already exists and is empty - probably unclean hardware restart.");
}
fd = ::open(path.c_str(), O_WRONLY | O_CREAT, 0666);
fd = ::open(path.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0666);
if (-1 == fd)
throwFromErrnoWithPath("Cannot open file " + path, path, ErrorCodes::CANNOT_OPEN_FILE);

View File

@ -26,7 +26,7 @@ void MMapReadBufferFromFile::open()
{
ProfileEvents::increment(ProfileEvents::FileOpen);
fd = ::open(file_name.c_str(), O_RDONLY);
fd = ::open(file_name.c_str(), O_RDONLY | O_CLOEXEC);
if (-1 == fd)
throwFromErrnoWithPath("Cannot open file " + file_name, file_name,

View File

@ -49,6 +49,7 @@ ReadBufferAIO::ReadBufferAIO(const std::string & filename_, size_t buffer_size_,
int open_flags = (flags_ == -1) ? O_RDONLY : flags_;
open_flags |= O_DIRECT;
open_flags |= O_CLOEXEC;
fd = ::open(filename.c_str(), open_flags);
if (fd == -1)

View File

@ -38,7 +38,7 @@ ReadBufferFromFile::ReadBufferFromFile(
if (o_direct)
flags = flags & ~O_DIRECT;
#endif
fd = ::open(file_name.c_str(), flags == -1 ? O_RDONLY : flags);
fd = ::open(file_name.c_str(), flags == -1 ? O_RDONLY | O_CLOEXEC : flags | O_CLOEXEC);
if (-1 == fd)
throwFromErrnoWithPath("Cannot open file " + file_name, file_name,

View File

@ -58,6 +58,7 @@ WriteBufferAIO::WriteBufferAIO(const std::string & filename_, size_t buffer_size
int open_flags = (flags_ == -1) ? (O_RDWR | O_TRUNC | O_CREAT) : flags_;
open_flags |= O_DIRECT;
open_flags |= O_CLOEXEC;
fd = ::open(filename.c_str(), open_flags, mode_);
if (fd == -1)

View File

@ -41,7 +41,7 @@ WriteBufferFromFile::WriteBufferFromFile(
flags = flags & ~O_DIRECT;
#endif
fd = ::open(file_name.c_str(), flags == -1 ? O_WRONLY | O_TRUNC | O_CREAT : flags, mode);
fd = ::open(file_name.c_str(), flags == -1 ? O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC : flags | O_CLOEXEC, mode);
if (-1 == fd)
throwFromErrnoWithPath("Cannot open file " + file_name, file_name,

View File

@ -22,3 +22,6 @@
| [Yandex Cloud](https://cloud.yandex.ru/services/managed-clickhouse) | Public Cloud | Main product | — | — | [Talk in Russian, December 2019](https://www.youtube.com/watch?v=pgnak9e_E0o) |
| [Yandex DataLens](https://cloud.yandex.ru/services/datalens) | Business Intelligence | Main product | — | — | [Slides in Russian, December 2019](https://presentations.clickhouse.tech/meetup38/datalens.pdf) |
| [Yandex Metrica](https://metrica.yandex.com) | Web analytics | Main product | 360 servers in one cluster, 1862 servers in one department | 66.41 PiB / 5.68 PiB | [Slides, February 2020](https://presentations.clickhouse.tech/meetup40/introduction/#13) |
[Original article](https://clickhouse.tech/docs/en/introduction/adopters/) <!--hide-->