From 903c306e048c7b9efcd0a0e5ad1394c1c1577d49 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 9 May 2021 01:09:16 +0300 Subject: [PATCH] Fix some PVS-Studio warnings --- src/Common/Volnitsky.h | 2 +- src/Core/SettingsQuirks.cpp | 18 +++++------------- .../PushingToViewsBlockOutputStream.cpp | 2 +- .../SerializationLowCardinality.cpp | 2 +- src/Interpreters/ActionsVisitor.cpp | 2 +- src/Interpreters/ProcessList.h | 2 +- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/Common/Volnitsky.h b/src/Common/Volnitsky.h index c674015fba9..13cef28ddcf 100644 --- a/src/Common/Volnitsky.h +++ b/src/Common/Volnitsky.h @@ -303,7 +303,7 @@ namespace VolnitskyTraits { /// ngram for Ul chars.c0 = c0u; - chars.c1 = c1l; + chars.c1 = c1l; //-V1048 putNGramBase(n, offset); } diff --git a/src/Core/SettingsQuirks.cpp b/src/Core/SettingsQuirks.cpp index 3bf9047af3a..6d584fe8906 100644 --- a/src/Core/SettingsQuirks.cpp +++ b/src/Core/SettingsQuirks.cpp @@ -4,9 +4,7 @@ #ifdef __linux__ #include -#endif -#ifdef __linux__ /// Detect does epoll_wait with nested epoll fds works correctly. /// Polling nested epoll fds from epoll_wait is required for async_socket_for_remote and use_hedged_requests. /// @@ -16,21 +14,15 @@ /// [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c54a6a44bf3 bool nestedEpollWorks(Poco::Logger * log) { - bool nested_epoll_works = #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 13)) /// the check is correct since there will be no more 5.5.x releases. - false -#else - true -#endif - ; - - if (!nested_epoll_works) - { if (log) LOG_WARNING(log, "Nested epoll_wait has some issues on kernels [5.5.0, 5.6.13). You should upgrade it to avoid possible issues."); - } - return nested_epoll_works; + return false; +#else + (void)log; + return true; +#endif } #else bool nestedEpollWorks(Poco::Logger *) { return true; } diff --git a/src/DataStreams/PushingToViewsBlockOutputStream.cpp b/src/DataStreams/PushingToViewsBlockOutputStream.cpp index 16baf4377e0..c09420cab6f 100644 --- a/src/DataStreams/PushingToViewsBlockOutputStream.cpp +++ b/src/DataStreams/PushingToViewsBlockOutputStream.cpp @@ -63,7 +63,7 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream( // Do not deduplicate insertions into MV if the main insertion is Ok if (disable_deduplication_for_children) - insert_context->setSetting("insert_deduplicate", false); + insert_context->setSetting("insert_deduplicate", Field{false}); // Separate min_insert_block_size_rows/min_insert_block_size_bytes for children if (insert_settings.min_insert_block_size_rows_for_materialized_views) diff --git a/src/DataTypes/Serializations/SerializationLowCardinality.cpp b/src/DataTypes/Serializations/SerializationLowCardinality.cpp index 41d9a4100e0..69a41d83138 100644 --- a/src/DataTypes/Serializations/SerializationLowCardinality.cpp +++ b/src/DataTypes/Serializations/SerializationLowCardinality.cpp @@ -160,7 +160,7 @@ struct IndexesSerializationType return std::make_shared(); if (type == TUInt32) return std::make_shared(); - if (type == TUInt64) + if (type == TUInt64) //-V547 return std::make_shared(); throw Exception("Can't create DataType from IndexesSerializationType.", ErrorCodes::LOGICAL_ERROR); diff --git a/src/Interpreters/ActionsVisitor.cpp b/src/Interpreters/ActionsVisitor.cpp index b463ab0a586..b00c74601f1 100644 --- a/src/Interpreters/ActionsVisitor.cpp +++ b/src/Interpreters/ActionsVisitor.cpp @@ -207,7 +207,7 @@ static Block createBlockFromAST(const ASTPtr & node, const DataTypes & types, Co assert(tuple || func); - size_t tuple_size = tuple ? tuple->size() : func->arguments->children.size(); + size_t tuple_size = tuple ? tuple->size() : func->arguments->children.size(); //-V1004 if (tuple_size != num_columns) throw Exception("Incorrect size of tuple in set: " + toString(tuple_size) + " instead of " + toString(num_columns), ErrorCodes::INCORRECT_ELEMENT_OF_SET); diff --git a/src/Interpreters/ProcessList.h b/src/Interpreters/ProcessList.h index 3eeea9c8e5b..fca28b031db 100644 --- a/src/Interpreters/ProcessList.h +++ b/src/Interpreters/ProcessList.h @@ -276,7 +276,7 @@ protected: /// List of queries Container processes; - size_t max_size; /// 0 means no limit. Otherwise, when limit exceeded, an exception is thrown. + size_t max_size = 0; /// 0 means no limit. Otherwise, when limit exceeded, an exception is thrown. /// Stores per-user info: queries, statistics and limits UserToQueries user_to_queries;