Merge branch 'master' into patch-2

This commit is contained in:
mergify[bot] 2022-02-04 21:21:19 +00:00 committed by GitHub
commit 918abf391d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 15 deletions

View File

@ -182,7 +182,7 @@ if (COMPILER_CLANG)
if (HAS_USE_CTOR_HOMING) if (HAS_USE_CTOR_HOMING)
# For more info see https://blog.llvm.org/posts/2021-04-05-constructor-homing-for-debug-info/ # For more info see https://blog.llvm.org/posts/2021-04-05-constructor-homing-for-debug-info/
if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO") if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fuse-ctor-homing") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fuse-ctor-homing")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xclang -fuse-ctor-homing") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xclang -fuse-ctor-homing")
endif() endif()

View File

@ -201,9 +201,12 @@ void WriteBufferFromS3::writePart()
std::lock_guard lock(bg_tasks_mutex); std::lock_guard lock(bg_tasks_mutex);
task->is_finised = true; task->is_finised = true;
++num_finished_bg_tasks; ++num_finished_bg_tasks;
}
bg_tasks_condvar.notify_one(); /// Notification under mutex is important here.
/// Othervies, WriteBuffer could be destroyed in between
/// Releasing lock and condvar notification.
bg_tasks_condvar.notify_one();
}
}); });
} }
else else
@ -305,9 +308,13 @@ void WriteBufferFromS3::makeSinglepartUpload()
{ {
std::lock_guard lock(bg_tasks_mutex); std::lock_guard lock(bg_tasks_mutex);
put_object_task->is_finised = true; put_object_task->is_finised = true;
/// Notification under mutex is important here.
/// Othervies, WriteBuffer could be destroyed in between
/// Releasing lock and condvar notification.
bg_tasks_condvar.notify_one();
} }
bg_tasks_condvar.notify_one();
}); });
} }
else else

View File

@ -412,6 +412,11 @@ void MergeTreeDataPartWriterWide::validateColumnOfFixedSize(const NameAndTypePai
String escaped_name = escapeForFileName(name); String escaped_name = escapeForFileName(name);
String mrk_path = part_path + escaped_name + marks_file_extension; String mrk_path = part_path + escaped_name + marks_file_extension;
String bin_path = part_path + escaped_name + DATA_FILE_EXTENSION; String bin_path = part_path + escaped_name + DATA_FILE_EXTENSION;
/// Some columns may be removed because of ttl. Skip them.
if (!disk->exists(mrk_path))
return;
auto mrk_in = disk->readFile(mrk_path); auto mrk_in = disk->readFile(mrk_path);
DB::CompressedReadBufferFromFile bin_in(disk->readFile(bin_path)); DB::CompressedReadBufferFromFile bin_in(disk->readFile(bin_path));
bool must_be_last = false; bool must_be_last = false;

View File

@ -66,10 +66,9 @@ struct MergedBlockOutputStream::Finalizer::Impl
void MergedBlockOutputStream::Finalizer::finish() void MergedBlockOutputStream::Finalizer::finish()
{ {
if (impl) std::unique_ptr<Impl> to_finish = std::move(impl);
impl->finish(); if (to_finish)
to_finish->finish();
impl.reset();
} }
void MergedBlockOutputStream::Finalizer::Impl::finish() void MergedBlockOutputStream::Finalizer::Impl::finish()

View File

@ -403,9 +403,15 @@ public:
/// Note: AddingDefaultsBlockInputStream doesn't change header. /// Note: AddingDefaultsBlockInputStream doesn't change header.
if (need_path_column) if (need_path_column)
header.insert({DataTypeString().createColumn(), std::make_shared<DataTypeString>(), "_path"}); header.insert(
{DataTypeLowCardinality{std::make_shared<DataTypeString>()}.createColumn(),
std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>()),
"_path"});
if (need_file_column) if (need_file_column)
header.insert({DataTypeString().createColumn(), std::make_shared<DataTypeString>(), "_file"}); header.insert(
{DataTypeLowCardinality{std::make_shared<DataTypeString>()}.createColumn(),
std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>()),
"_file"});
return header; return header;
} }
@ -515,7 +521,7 @@ public:
/// Enrich with virtual columns. /// Enrich with virtual columns.
if (files_info->need_path_column) if (files_info->need_path_column)
{ {
auto column = DataTypeString().createColumnConst(num_rows, current_path); auto column = DataTypeLowCardinality{std::make_shared<DataTypeString>()}.createColumnConst(num_rows, current_path);
chunk.addColumn(column->convertToFullColumnIfConst()); chunk.addColumn(column->convertToFullColumnIfConst());
} }
@ -524,7 +530,7 @@ public:
size_t last_slash_pos = current_path.find_last_of('/'); size_t last_slash_pos = current_path.find_last_of('/');
auto file_name = current_path.substr(last_slash_pos + 1); auto file_name = current_path.substr(last_slash_pos + 1);
auto column = DataTypeString().createColumnConst(num_rows, std::move(file_name)); auto column = DataTypeLowCardinality{std::make_shared<DataTypeString>()}.createColumnConst(num_rows, std::move(file_name));
chunk.addColumn(column->convertToFullColumnIfConst()); chunk.addColumn(column->convertToFullColumnIfConst());
} }
@ -1093,8 +1099,7 @@ void registerStorageFile(StorageFactory & factory)
NamesAndTypesList StorageFile::getVirtuals() const NamesAndTypesList StorageFile::getVirtuals() const
{ {
return NamesAndTypesList{ return NamesAndTypesList{
{"_path", std::make_shared<DataTypeString>()}, {"_path", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"_file", std::make_shared<DataTypeString>()} {"_file", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())}};
};
} }
} }