diff --git a/dbms/CMakeLists.txt b/dbms/CMakeLists.txt index 9ff48969026..40670f391bc 100644 --- a/dbms/CMakeLists.txt +++ b/dbms/CMakeLists.txt @@ -36,7 +36,7 @@ option (WEVERYTHING "Enables -Weverything option with some exceptions. This is i if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wno-vla-extension -Wno-zero-length-array -Wno-gnu-anonymous-struct -Wno-nested-anon-types") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra-semi -Wcomma -Winconsistent-missing-destructor-override -Wunused-exception-parameter -Wshadow-uncaptured-local -Wcovered-switch-default -Wshadow -Wold-style-cast -Wrange-loop-analysis -Wunused-member-function -Wunreachable-code -Wunreachable-code-return -Wnewline-eof -Wembedded-directive -Wgnu-case-range -Wunused-macros -Wconditional-uninitialized -Wdeprecated -Wundef -Wreserved-id-macro -Wredundant-parens -Wzero-as-null-pointer-constant") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wshadow-uncaptured-local -Wextra-semi -Wcomma -Winconsistent-missing-destructor-override -Wunused-exception-parameter -Wcovered-switch-default -Wold-style-cast -Wrange-loop-analysis -Wunused-member-function -Wunreachable-code -Wunreachable-code-return -Wnewline-eof -Wembedded-directive -Wgnu-case-range -Wunused-macros -Wconditional-uninitialized -Wdeprecated -Wundef -Wreserved-id-macro -Wredundant-parens -Wzero-as-null-pointer-constant") if (WEVERYTHING) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-missing-noreturn -Wno-padded -Wno-switch-enum -Wno-shadow-field-in-constructor -Wno-deprecated-dynamic-exception-spec -Wno-float-equal -Wno-weak-vtables -Wno-shift-sign-overflow -Wno-sign-conversion -Wno-conversion -Wno-exit-time-destructors -Wno-undefined-func-template -Wno-documentation-unknown-command -Wno-missing-variable-declarations -Wno-unused-template -Wno-global-constructors -Wno-c99-extensions -Wno-missing-prototypes -Wno-weak-template-vtables -Wno-zero-length-array -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-disabled-macro-expansion -Wno-used-but-marked-unused -Wno-vla-extension -Wno-vla -Wno-packed") @@ -53,10 +53,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") endif () if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra-semi-stmt") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra-semi-stmt -Wshadow-field -Wstring-plus-int") if (WEVERYTHING) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shadow-field") # TODO Enable + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif () endif () endif () diff --git a/dbms/src/AggregateFunctions/AggregateFunctionNull.h b/dbms/src/AggregateFunctions/AggregateFunctionNull.h index 5cb33ed0a59..c8676230500 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionNull.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionNull.h @@ -187,8 +187,8 @@ template class AggregateFunctionNullUnary final : public AggregateFunctionNullBase> { public: - AggregateFunctionNullUnary(AggregateFunctionPtr nested_function) - : AggregateFunctionNullBase>(nested_function) + AggregateFunctionNullUnary(AggregateFunctionPtr nested_function_) + : AggregateFunctionNullBase>(std::move(nested_function_)) { } @@ -209,8 +209,8 @@ template class AggregateFunctionNullVariadic final : public AggregateFunctionNullBase> { public: - AggregateFunctionNullVariadic(AggregateFunctionPtr nested_function, const DataTypes & arguments) - : AggregateFunctionNullBase>(nested_function), + AggregateFunctionNullVariadic(AggregateFunctionPtr nested_function_, const DataTypes & arguments) + : AggregateFunctionNullBase>(std::move(nested_function_)), number_of_arguments(arguments.size()) { if (number_of_arguments == 1) diff --git a/dbms/src/Columns/ColumnNothing.h b/dbms/src/Columns/ColumnNothing.h index 777790fcf5e..c9cde4f26ec 100644 --- a/dbms/src/Columns/ColumnNothing.h +++ b/dbms/src/Columns/ColumnNothing.h @@ -20,7 +20,7 @@ private: public: const char * getFamilyName() const override { return "Nothing"; } - MutableColumnPtr cloneDummy(size_t s) const override { return ColumnNothing::create(s); } + MutableColumnPtr cloneDummy(size_t s_) const override { return ColumnNothing::create(s_); } bool canBeInsideNullable() const override { return true; } }; diff --git a/dbms/src/Common/ShellCommand.cpp b/dbms/src/Common/ShellCommand.cpp index de8037c07d5..f9835efe68d 100644 --- a/dbms/src/Common/ShellCommand.cpp +++ b/dbms/src/Common/ShellCommand.cpp @@ -150,8 +150,8 @@ std::unique_ptr ShellCommand::execute(const std::string & command, { /// Arguments in non-constant chunks of memory (as required for `execv`). /// Moreover, their copying must be done before calling `vfork`, so after `vfork` do a minimum of things. - std::vector argv0("sh", "sh" + strlen("sh") + 1); - std::vector argv1("-c", "-c" + strlen("-c") + 1); + std::vector argv0("sh", &("sh"[3])); + std::vector argv1("-c", &("-c"[3])); std::vector argv2(command.data(), command.data() + command.size() + 1); char * const argv[] = { argv0.data(), argv1.data(), argv2.data(), nullptr }; diff --git a/dbms/src/Common/Volnitsky.h b/dbms/src/Common/Volnitsky.h index f1a8325d869..f4cd57d6edf 100644 --- a/dbms/src/Common/Volnitsky.h +++ b/dbms/src/Common/Volnitsky.h @@ -194,9 +194,9 @@ template struct VolnitskyImpl; /// Case sensitive comparison template struct VolnitskyImpl : VolnitskyBase> { - VolnitskyImpl(const char * const needle, const size_t needle_size, const size_t haystack_size_hint = 0) - : VolnitskyBase>{needle, needle_size, haystack_size_hint}, - fallback_searcher{needle, needle_size} + VolnitskyImpl(const char * const needle_, const size_t needle_size_, const size_t haystack_size_hint = 0) + : VolnitskyBase>{needle_, needle_size_, haystack_size_hint}, + fallback_searcher{needle_, needle_size_} { } @@ -222,8 +222,8 @@ template struct VolnitskyImpl : VolnitskyBase struct VolnitskyImpl : VolnitskyBase> { - VolnitskyImpl(const char * const needle, const size_t needle_size, const size_t haystack_size_hint = 0) - : VolnitskyBase{needle, needle_size, haystack_size_hint}, fallback_searcher{needle, needle_size} + VolnitskyImpl(const char * const needle_, const size_t needle_size_, const size_t haystack_size_hint = 0) + : VolnitskyBase{needle_, needle_size_, haystack_size_hint}, fallback_searcher{needle_, needle_size_} { } @@ -248,8 +248,8 @@ template <> struct VolnitskyImpl : VolnitskyBase struct VolnitskyImpl : VolnitskyBase> { - VolnitskyImpl(const char * const needle, const size_t needle_size, const size_t haystack_size_hint = 0) - : VolnitskyBase{needle, needle_size, haystack_size_hint}, fallback_searcher{needle, needle_size} + VolnitskyImpl(const char * const needle_, const size_t needle_size_, const size_t haystack_size_hint = 0) + : VolnitskyBase{needle_, needle_size_, haystack_size_hint}, fallback_searcher{needle_, needle_size_} { } diff --git a/dbms/src/Common/ZooKeeper/ZooKeeper.cpp b/dbms/src/Common/ZooKeeper/ZooKeeper.cpp index 0542b154c73..522667b8055 100644 --- a/dbms/src/Common/ZooKeeper/ZooKeeper.cpp +++ b/dbms/src/Common/ZooKeeper/ZooKeeper.cpp @@ -839,7 +839,7 @@ int32_t ZooKeeper::tryMultiNoThrow(const Coordination::Requests & requests, Coor } -size_t KeeperMultiException::getFailedOpIndex(int32_t code, const Coordination::Responses & responses) +size_t KeeperMultiException::getFailedOpIndex(int32_t exception_code, const Coordination::Responses & responses) { if (responses.empty()) throw DB::Exception("Responses for multi transaction is empty", DB::ErrorCodes::LOGICAL_ERROR); @@ -848,17 +848,17 @@ size_t KeeperMultiException::getFailedOpIndex(int32_t code, const Coordination:: if (responses[index]->error) return index; - if (!Coordination::isUserError(code)) - throw DB::Exception("There are no failed OPs because '" + ZooKeeper::error2string(code) + "' is not valid response code for that", + if (!Coordination::isUserError(exception_code)) + throw DB::Exception("There are no failed OPs because '" + ZooKeeper::error2string(exception_code) + "' is not valid response code for that", DB::ErrorCodes::LOGICAL_ERROR); throw DB::Exception("There is no failed OpResult", DB::ErrorCodes::LOGICAL_ERROR); } -KeeperMultiException::KeeperMultiException(int32_t code, const Coordination::Requests & requests, const Coordination::Responses & responses) - : KeeperException("Transaction failed", code), - requests(requests), responses(responses), failed_op_index(getFailedOpIndex(code, responses)) +KeeperMultiException::KeeperMultiException(int32_t exception_code, const Coordination::Requests & requests, const Coordination::Responses & responses) + : KeeperException("Transaction failed", exception_code), + requests(requests), responses(responses), failed_op_index(getFailedOpIndex(exception_code, responses)) { addMessage("Op #" + std::to_string(failed_op_index) + ", path: " + getPathForFirstFailedOp()); } @@ -869,15 +869,15 @@ std::string KeeperMultiException::getPathForFirstFailedOp() const return requests[failed_op_index]->getPath(); } -void KeeperMultiException::check(int32_t code, const Coordination::Requests & requests, const Coordination::Responses & responses) +void KeeperMultiException::check(int32_t exception_code, const Coordination::Requests & requests, const Coordination::Responses & responses) { - if (!code) + if (!exception_code) return; - if (Coordination::isUserError(code)) - throw KeeperMultiException(code, requests, responses); + if (Coordination::isUserError(exception_code)) + throw KeeperMultiException(exception_code, requests, responses); else - throw KeeperException(code); + throw KeeperException(exception_code); } diff --git a/dbms/src/Core/AccurateComparison.h b/dbms/src/Core/AccurateComparison.h index 1e3e236b1ea..62402c339f7 100644 --- a/dbms/src/Core/AccurateComparison.h +++ b/dbms/src/Core/AccurateComparison.h @@ -263,7 +263,8 @@ inline bool_if_not_safe_conversion equalsOp(A a, B b) template inline bool_if_safe_conversion equalsOp(A a, B b) { - return a == b; + using LargestType = std::conditional_t= sizeof(B), A, B>; + return static_cast(a) == static_cast(b); } template <> diff --git a/dbms/src/Databases/DatabaseOrdinary.cpp b/dbms/src/Databases/DatabaseOrdinary.cpp index a006c2ff6a1..cb1c7587080 100644 --- a/dbms/src/Databases/DatabaseOrdinary.cpp +++ b/dbms/src/Databases/DatabaseOrdinary.cpp @@ -507,13 +507,13 @@ void DatabaseOrdinary::shutdown() void DatabaseOrdinary::alterTable( const Context & context, - const String & name, + const String & table_name, const ColumnsDescription & columns, const ASTModifier & storage_modifier) { /// Read the definition of the table and replace the necessary parts with new ones. - String table_name_escaped = escapeForFileName(name); + String table_name_escaped = escapeForFileName(table_name); String table_metadata_tmp_path = metadata_path + "/" + table_name_escaped + ".sql.tmp"; String table_metadata_path = metadata_path + "/" + table_name_escaped + ".sql"; String statement; diff --git a/dbms/src/Dictionaries/ExecutableDictionarySource.cpp b/dbms/src/Dictionaries/ExecutableDictionarySource.cpp index 3cde810b685..376153bd0e9 100644 --- a/dbms/src/Dictionaries/ExecutableDictionarySource.cpp +++ b/dbms/src/Dictionaries/ExecutableDictionarySource.cpp @@ -23,8 +23,8 @@ namespace class ShellCommandOwningBlockInputStream : public OwningBlockInputStream { public: - ShellCommandOwningBlockInputStream(const BlockInputStreamPtr & stream, std::unique_ptr own) - : OwningBlockInputStream(std::move(stream), std::move(own)) + ShellCommandOwningBlockInputStream(const BlockInputStreamPtr & impl, std::unique_ptr own_) + : OwningBlockInputStream(std::move(impl), std::move(own_)) { } diff --git a/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp b/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp index 89dc575dcb9..8062f59e245 100644 --- a/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp +++ b/dbms/src/Formats/BlockInputStreamFromRowInputStream.cpp @@ -88,7 +88,7 @@ Block BlockInputStreamFromRowInputStream::readImpl() throw; ++num_errors; - Float64 current_error_ratio = static_cast(num_errors) / total_rows; + Float32 current_error_ratio = static_cast(num_errors) / total_rows; if (num_errors > allow_errors_num && current_error_ratio > allow_errors_ratio) diff --git a/dbms/src/Formats/BlockInputStreamFromRowInputStream.h b/dbms/src/Formats/BlockInputStreamFromRowInputStream.h index fcbec628e09..c993f62adfe 100644 --- a/dbms/src/Formats/BlockInputStreamFromRowInputStream.h +++ b/dbms/src/Formats/BlockInputStreamFromRowInputStream.h @@ -45,7 +45,7 @@ private: BlockMissingValues block_missing_values; UInt64 allow_errors_num; - Float64 allow_errors_ratio; + Float32 allow_errors_ratio; size_t total_rows = 0; size_t num_errors = 0; diff --git a/dbms/src/Formats/FormatSettings.h b/dbms/src/Formats/FormatSettings.h index 55996c3c7a0..e8aaef290b4 100644 --- a/dbms/src/Formats/FormatSettings.h +++ b/dbms/src/Formats/FormatSettings.h @@ -60,7 +60,7 @@ struct FormatSettings DateTimeInputFormat date_time_input_format = DateTimeInputFormat::Basic; UInt64 input_allow_errors_num = 0; - Float64 input_allow_errors_ratio = 0; + Float32 input_allow_errors_ratio = 0; }; } diff --git a/dbms/src/Formats/JSONCompactRowOutputStream.cpp b/dbms/src/Formats/JSONCompactRowOutputStream.cpp index 03d5c6cfe2d..04edadf019b 100644 --- a/dbms/src/Formats/JSONCompactRowOutputStream.cpp +++ b/dbms/src/Formats/JSONCompactRowOutputStream.cpp @@ -8,8 +8,8 @@ namespace DB { -JSONCompactRowOutputStream::JSONCompactRowOutputStream(WriteBuffer & ostr_, const Block & sample_, const FormatSettings & settings) - : JSONRowOutputStream(ostr_, sample_, settings) +JSONCompactRowOutputStream::JSONCompactRowOutputStream(WriteBuffer & ostr_, const Block & sample_, const FormatSettings & settings_) + : JSONRowOutputStream(ostr_, sample_, settings_) { } diff --git a/dbms/src/Formats/PrettyCompactBlockOutputStream.h b/dbms/src/Formats/PrettyCompactBlockOutputStream.h index 74298a0535c..d0e3826bece 100644 --- a/dbms/src/Formats/PrettyCompactBlockOutputStream.h +++ b/dbms/src/Formats/PrettyCompactBlockOutputStream.h @@ -11,8 +11,8 @@ namespace DB class PrettyCompactBlockOutputStream : public PrettyBlockOutputStream { public: - PrettyCompactBlockOutputStream(WriteBuffer & ostr_, const Block & header_, const FormatSettings & format_settings) - : PrettyBlockOutputStream(ostr_, header_, format_settings) {} + PrettyCompactBlockOutputStream(WriteBuffer & ostr_, const Block & header_, const FormatSettings & format_settings_) + : PrettyBlockOutputStream(ostr_, header_, format_settings_) {} void write(const Block & block) override; diff --git a/dbms/src/Formats/PrettySpaceBlockOutputStream.h b/dbms/src/Formats/PrettySpaceBlockOutputStream.h index 2f438130568..9807bf85767 100644 --- a/dbms/src/Formats/PrettySpaceBlockOutputStream.h +++ b/dbms/src/Formats/PrettySpaceBlockOutputStream.h @@ -11,8 +11,8 @@ namespace DB class PrettySpaceBlockOutputStream : public PrettyBlockOutputStream { public: - PrettySpaceBlockOutputStream(WriteBuffer & ostr_, const Block & header_, const FormatSettings & format_settings) - : PrettyBlockOutputStream(ostr_, header_, format_settings) {} + PrettySpaceBlockOutputStream(WriteBuffer & ostr_, const Block & header_, const FormatSettings & format_settings_) + : PrettyBlockOutputStream(ostr_, header_, format_settings_) {} void write(const Block & block) override; void writeSuffix() override; diff --git a/dbms/src/Formats/TSKVRowOutputStream.cpp b/dbms/src/Formats/TSKVRowOutputStream.cpp index 1e4f5f0e409..96be0054363 100644 --- a/dbms/src/Formats/TSKVRowOutputStream.cpp +++ b/dbms/src/Formats/TSKVRowOutputStream.cpp @@ -9,8 +9,8 @@ namespace DB { -TSKVRowOutputStream::TSKVRowOutputStream(WriteBuffer & ostr_, const Block & sample_, const FormatSettings & format_settings) - : TabSeparatedRowOutputStream(ostr_, sample_, false, false, format_settings) +TSKVRowOutputStream::TSKVRowOutputStream(WriteBuffer & ostr_, const Block & sample_, const FormatSettings & format_settings_) + : TabSeparatedRowOutputStream(ostr_, sample_, false, false, format_settings_) { NamesAndTypesList columns(sample_.getNamesAndTypesList()); fields.assign(columns.begin(), columns.end()); diff --git a/dbms/src/Formats/TabSeparatedRawRowOutputStream.h b/dbms/src/Formats/TabSeparatedRawRowOutputStream.h index 3f55b68f1b9..a6a8054e383 100644 --- a/dbms/src/Formats/TabSeparatedRawRowOutputStream.h +++ b/dbms/src/Formats/TabSeparatedRawRowOutputStream.h @@ -13,8 +13,8 @@ namespace DB class TabSeparatedRawRowOutputStream : public TabSeparatedRowOutputStream { public: - TabSeparatedRawRowOutputStream(WriteBuffer & ostr_, const Block & sample_, bool with_names_, bool with_types_, const FormatSettings & format_settings) - : TabSeparatedRowOutputStream(ostr_, sample_, with_names_, with_types_, format_settings) {} + TabSeparatedRawRowOutputStream(WriteBuffer & ostr_, const Block & sample_, bool with_names_, bool with_types_, const FormatSettings & format_settings_) + : TabSeparatedRowOutputStream(ostr_, sample_, with_names_, with_types_, format_settings_) {} void writeField(const IColumn & column, const IDataType & type, size_t row_num) override { diff --git a/dbms/src/Functions/FunctionsFormatting.h b/dbms/src/Functions/FunctionsFormatting.h index 9728a0f95ba..60a30d259e8 100644 --- a/dbms/src/Functions/FunctionsFormatting.h +++ b/dbms/src/Functions/FunctionsFormatting.h @@ -183,7 +183,7 @@ private: for (size_t i = 0; i < size; ++i) { - formatReadableSizeWithBinarySuffix(vec_from[i], buf_to); + formatReadableSizeWithBinarySuffix(static_cast(vec_from[i]), buf_to); writeChar(0, buf_to); offsets_to[i] = buf_to.count(); } diff --git a/dbms/src/Functions/GatherUtils/Algorithms.h b/dbms/src/Functions/GatherUtils/Algorithms.h index 34cef4939e5..aaf1828f47d 100644 --- a/dbms/src/Functions/GatherUtils/Algorithms.h +++ b/dbms/src/Functions/GatherUtils/Algorithms.h @@ -4,9 +4,11 @@ #include #include +#include #include + namespace DB::ErrorCodes { extern const int LOGICAL_ERROR; @@ -31,7 +33,7 @@ void writeSlice(const NumericArraySlice & slice, NumericArraySink & sink) sink.elements.resize(sink.current_offset + slice.size); for (size_t i = 0; i < slice.size; ++i) { - sink.elements[sink.current_offset] = slice.data[i]; + sink.elements[sink.current_offset] = static_cast(slice.data[i]); ++sink.current_offset; } } @@ -421,17 +423,12 @@ bool sliceHasImpl(const FirstSliceType & first, const SecondSliceType & second, return all; } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" - template bool sliceEqualElements(const NumericArraySlice & first, const NumericArraySlice & second, size_t first_ind, size_t second_ind) { - return first.data[first_ind] == second.data[second_ind]; + return accurate::equalsOp(first.data[first_ind], second.data[second_ind]); } -#pragma GCC diagnostic pop - template bool sliceEqualElements(const NumericArraySlice &, const GenericArraySlice &, size_t, size_t) { diff --git a/dbms/src/Functions/GatherUtils/Sources.h b/dbms/src/Functions/GatherUtils/Sources.h index 1838280084f..40115a5a240 100644 --- a/dbms/src/Functions/GatherUtils/Sources.h +++ b/dbms/src/Functions/GatherUtils/Sources.h @@ -118,18 +118,18 @@ struct ConstSource : public Base size_t total_rows; size_t row_num = 0; - explicit ConstSource(const ColumnConst & col) - : Base(static_cast(col.getDataColumn())), total_rows(col.size()) + explicit ConstSource(const ColumnConst & col_) + : Base(static_cast(col_.getDataColumn())), total_rows(col_.size()) { } template - ConstSource(const ColumnType & col, size_t total_rows) : Base(col), total_rows(total_rows) + ConstSource(const ColumnType & col_, size_t total_rows_) : Base(col_), total_rows(total_rows_) { } template - ConstSource(const ColumnType & col, const NullMap & null_map, size_t total_rows) : Base(col, null_map), total_rows(total_rows) + ConstSource(const ColumnType & col_, const NullMap & null_map_, size_t total_rows_) : Base(col_, null_map_), total_rows(total_rows_) { } diff --git a/dbms/src/IO/HashingReadBuffer.h b/dbms/src/IO/HashingReadBuffer.h index 0bf1614f884..9ea646206cd 100644 --- a/dbms/src/IO/HashingReadBuffer.h +++ b/dbms/src/IO/HashingReadBuffer.h @@ -12,8 +12,8 @@ namespace DB class HashingReadBuffer : public IHashingBuffer { public: - HashingReadBuffer(ReadBuffer & in_, size_t block_size = DBMS_DEFAULT_HASHING_BLOCK_SIZE) : - IHashingBuffer(block_size), in(in_) + HashingReadBuffer(ReadBuffer & in_, size_t block_size_ = DBMS_DEFAULT_HASHING_BLOCK_SIZE) : + IHashingBuffer(block_size_), in(in_) { working_buffer = in.buffer(); pos = in.position(); diff --git a/dbms/src/IO/ReadBufferFromFile.cpp b/dbms/src/IO/ReadBufferFromFile.cpp index f3b4ddb7d23..b94fce8e033 100644 --- a/dbms/src/IO/ReadBufferFromFile.cpp +++ b/dbms/src/IO/ReadBufferFromFile.cpp @@ -53,14 +53,14 @@ ReadBufferFromFile::ReadBufferFromFile( ReadBufferFromFile::ReadBufferFromFile( - int fd, + int fd_, const std::string & original_file_name, size_t buf_size, char * existing_memory, size_t alignment) : - ReadBufferFromFileDescriptor(fd, buf_size, existing_memory, alignment), - file_name(original_file_name.empty() ? "(fd = " + toString(fd) + ")" : original_file_name) + ReadBufferFromFileDescriptor(fd_, buf_size, existing_memory, alignment), + file_name(original_file_name.empty() ? "(fd = " + toString(fd_) + ")" : original_file_name) { } diff --git a/dbms/src/IO/ReadWriteBufferFromHTTP.h b/dbms/src/IO/ReadWriteBufferFromHTTP.h index 215aa29a3e0..092d6829107 100644 --- a/dbms/src/IO/ReadWriteBufferFromHTTP.h +++ b/dbms/src/IO/ReadWriteBufferFromHTTP.h @@ -96,13 +96,13 @@ class ReadWriteBufferFromHTTP : public detail::ReadWriteBufferFromHTTPBase; public: - explicit ReadWriteBufferFromHTTP(Poco::URI uri, - const std::string & method = {}, + explicit ReadWriteBufferFromHTTP(Poco::URI uri_, + const std::string & method_ = {}, OutStreamCallback out_stream_callback = {}, const ConnectionTimeouts & timeouts = {}, const Poco::Net::HTTPBasicCredentials & credentials = {}, size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE) - : Parent(makeHTTPSession(uri, timeouts), uri, method, out_stream_callback, credentials, buffer_size_) + : Parent(makeHTTPSession(uri_, timeouts), uri_, method_, out_stream_callback, credentials, buffer_size_) { } }; @@ -111,16 +111,16 @@ class PooledReadWriteBufferFromHTTP : public detail::ReadWriteBufferFromHTTPBase using Parent = detail::ReadWriteBufferFromHTTPBase; public: - explicit PooledReadWriteBufferFromHTTP(Poco::URI uri, - const std::string & method = {}, + explicit PooledReadWriteBufferFromHTTP(Poco::URI uri_, + const std::string & method_ = {}, OutStreamCallback out_stream_callback = {}, const ConnectionTimeouts & timeouts = {}, const Poco::Net::HTTPBasicCredentials & credentials = {}, size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE, size_t max_connections_per_endpoint = DEFAULT_COUNT_OF_HTTP_CONNECTIONS_PER_ENDPOINT) - : Parent(makePooledHTTPSession(uri, timeouts, max_connections_per_endpoint), - uri, - method, + : Parent(makePooledHTTPSession(uri_, timeouts, max_connections_per_endpoint), + uri_, + method_, out_stream_callback, credentials, buffer_size_) diff --git a/dbms/src/IO/WriteBufferFromFile.cpp b/dbms/src/IO/WriteBufferFromFile.cpp index 7299d651acc..3082f674fff 100644 --- a/dbms/src/IO/WriteBufferFromFile.cpp +++ b/dbms/src/IO/WriteBufferFromFile.cpp @@ -58,14 +58,14 @@ WriteBufferFromFile::WriteBufferFromFile( /// Use pre-opened file descriptor. WriteBufferFromFile::WriteBufferFromFile( - int fd, + int fd_, const std::string & original_file_name, size_t buf_size, char * existing_memory, size_t alignment) : - WriteBufferFromFileDescriptor(fd, buf_size, existing_memory, alignment), - file_name(original_file_name.empty() ? "(fd = " + toString(fd) + ")" : original_file_name) + WriteBufferFromFileDescriptor(fd_, buf_size, existing_memory, alignment), + file_name(original_file_name.empty() ? "(fd = " + toString(fd_) + ")" : original_file_name) { } diff --git a/dbms/src/IO/WriteBufferFromTemporaryFile.cpp b/dbms/src/IO/WriteBufferFromTemporaryFile.cpp index 9a47760b8aa..e1250c58097 100644 --- a/dbms/src/IO/WriteBufferFromTemporaryFile.cpp +++ b/dbms/src/IO/WriteBufferFromTemporaryFile.cpp @@ -16,9 +16,7 @@ namespace ErrorCodes WriteBufferFromTemporaryFile::WriteBufferFromTemporaryFile(std::unique_ptr && tmp_file_) -: -WriteBufferFromFile(tmp_file_->path(), DBMS_DEFAULT_BUFFER_SIZE, O_RDWR | O_TRUNC | O_CREAT, 0600), -tmp_file(std::move(tmp_file_)) + : WriteBufferFromFile(tmp_file_->path(), DBMS_DEFAULT_BUFFER_SIZE, O_RDWR | O_TRUNC | O_CREAT, 0600), tmp_file(std::move(tmp_file_)) {} @@ -34,7 +32,6 @@ WriteBufferFromTemporaryFile::Ptr WriteBufferFromTemporaryFile::create(const std class ReadBufferFromTemporaryWriteBuffer : public ReadBufferFromFile { public: - static ReadBufferPtr createFrom(WriteBufferFromTemporaryFile * origin) { int fd = origin->getFD(); @@ -47,8 +44,8 @@ public: return std::make_shared(fd, file_name, std::move(origin->tmp_file)); } - ReadBufferFromTemporaryWriteBuffer(int fd, const std::string & file_name, std::unique_ptr && tmp_file_) - : ReadBufferFromFile(fd, file_name), tmp_file(std::move(tmp_file_)) + ReadBufferFromTemporaryWriteBuffer(int fd_, const std::string & file_name_, std::unique_ptr && tmp_file_) + : ReadBufferFromFile(fd_, file_name_), tmp_file(std::move(tmp_file_)) {} std::unique_ptr tmp_file; diff --git a/dbms/src/Interpreters/PartLog.cpp b/dbms/src/Interpreters/PartLog.cpp index d5ae95b5ea3..4ca9c130ef5 100644 --- a/dbms/src/Interpreters/PartLog.cpp +++ b/dbms/src/Interpreters/PartLog.cpp @@ -93,12 +93,12 @@ void PartLogElement::appendToBlock(Block & block) const } -bool PartLog::addNewPart(Context & context, const MutableDataPartPtr & part, UInt64 elapsed_ns, const ExecutionStatus & execution_status) +bool PartLog::addNewPart(Context & current_context, const MutableDataPartPtr & part, UInt64 elapsed_ns, const ExecutionStatus & execution_status) { - return addNewParts(context, {part}, elapsed_ns, execution_status); + return addNewParts(current_context, {part}, elapsed_ns, execution_status); } -bool PartLog::addNewParts(Context & context, const PartLog::MutableDataPartsVector & parts, UInt64 elapsed_ns, +bool PartLog::addNewParts(Context & current_context, const PartLog::MutableDataPartsVector & parts, UInt64 elapsed_ns, const ExecutionStatus & execution_status) { if (parts.empty()) @@ -108,7 +108,7 @@ bool PartLog::addNewParts(Context & context, const PartLog::MutableDataPartsVect try { - part_log = context.getPartLog(parts.front()->storage.getDatabaseName()); // assume parts belong to the same table + part_log = current_context.getPartLog(parts.front()->storage.getDatabaseName()); // assume parts belong to the same table if (!part_log) return false; diff --git a/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp b/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp index 5ae804c507c..6ca9b18b70c 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeSelectBlockInputStream.cpp @@ -22,18 +22,18 @@ MergeTreeSelectBlockInputStream::MergeTreeSelectBlockInputStream( Names column_names, const MarkRanges & mark_ranges_, bool use_uncompressed_cache_, - const PrewhereInfoPtr & prewhere_info, + const PrewhereInfoPtr & prewhere_info_, bool check_columns, size_t min_bytes_to_use_direct_io_, size_t max_read_buffer_size_, bool save_marks_in_cache_, - const Names & virt_column_names, + const Names & virt_column_names_, size_t part_index_in_query_, bool quiet) : - MergeTreeBaseSelectBlockInputStream{storage_, prewhere_info, max_block_size_rows_, + MergeTreeBaseSelectBlockInputStream{storage_, prewhere_info_, max_block_size_rows_, preferred_block_size_bytes_, preferred_max_column_in_block_size_bytes_, min_bytes_to_use_direct_io_, - max_read_buffer_size_, use_uncompressed_cache_, save_marks_in_cache_, virt_column_names}, + max_read_buffer_size_, use_uncompressed_cache_, save_marks_in_cache_, virt_column_names_}, required_columns{column_names}, data_part{owned_data_part_}, part_columns_lock(data_part->columns_lock), diff --git a/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp b/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp index 3434cd8df7b..964adc16edf 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeThreadSelectBlockInputStream.cpp @@ -11,18 +11,18 @@ MergeTreeThreadSelectBlockInputStream::MergeTreeThreadSelectBlockInputStream( const size_t thread, const MergeTreeReadPoolPtr & pool, const size_t min_marks_to_read_, - const size_t max_block_size_rows, - size_t preferred_block_size_bytes, - size_t preferred_max_column_in_block_size_bytes, - const MergeTreeData & storage, - const bool use_uncompressed_cache, - const PrewhereInfoPtr & prewhere_info, + const size_t max_block_size_rows_, + size_t preferred_block_size_bytes_, + size_t preferred_max_column_in_block_size_bytes_, + const MergeTreeData & storage_, + const bool use_uncompressed_cache_, + const PrewhereInfoPtr & prewhere_info_, const Settings & settings, - const Names & virt_column_names) + const Names & virt_column_names_) : - MergeTreeBaseSelectBlockInputStream{storage, prewhere_info, max_block_size_rows, - preferred_block_size_bytes, preferred_max_column_in_block_size_bytes, settings.min_bytes_to_use_direct_io, - settings.max_read_buffer_size, use_uncompressed_cache, true, virt_column_names}, + MergeTreeBaseSelectBlockInputStream{storage_, prewhere_info_, max_block_size_rows_, + preferred_block_size_bytes_, preferred_max_column_in_block_size_bytes_, settings.min_bytes_to_use_direct_io, + settings.max_read_buffer_size, use_uncompressed_cache_, true, virt_column_names_}, thread{thread}, pool{pool} {