Merge pull request #36632 from DevTeamBK/Fix-Coverity-Issues

Minor Coverity defects fixes
This commit is contained in:
Kseniia Sumarokova 2022-04-30 15:11:40 +02:00 committed by GitHub
commit 66f62b2ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -570,6 +570,9 @@ void LRUFileCache::remove(bool force_remove_unreleasable)
auto & [key, offset] = *it++;
auto * cell = getCell(key, offset, cache_lock);
if (!cell)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Cache is in inconsistent state: LRU queue contains entries with no cache cell");
if (cell->releasable() || force_remove_unreleasable)
{
auto file_segment = cell->file_segment;

View File

@ -29,7 +29,6 @@ public:
const std::string & common_path_prefix_,
const BlobsPathToSize & blobs_to_read_,
const ReadSettings & settings_);
String getFileName() const;
void reset();
@ -63,8 +62,6 @@ protected:
ReadSettings settings;
bool use_external_buffer;
size_t read_until_position = 0;
String current_path;

View File

@ -4108,6 +4108,9 @@ String MergeTreeData::getPartitionIDFromQuery(const ASTPtr & ast, ContextPtr loc
assert(typeid_cast<ASTFunction *>(partition_ast.value.get()));
assert(partition_ast.value->as<ASTFunction>()->name == "tuple");
assert(partition_ast.value->as<ASTFunction>()->arguments);
auto args = partition_ast.value->as<ASTFunction>()->arguments;
if (!args)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Expected at least one argument in partition AST");
bool empty_tuple = partition_ast.value->as<ASTFunction>()->arguments->children.empty();
if (!empty_tuple)
throw Exception(ErrorCodes::INVALID_PARTITION_VALUE, "Partition key is empty, expected 'tuple()' as partition key");

View File

@ -471,6 +471,7 @@ void ReplicatedMergeTreeCleanupThread::clearOldMutations()
for (const String & replica : replicas)
{
String pointer;
// No Need to check return value to delete mutations.
zookeeper->tryGet(storage.zookeeper_path + "/replicas/" + replica + "/mutation_pointer", pointer);
if (pointer.empty())
return; /// One replica hasn't done anything yet so we can't delete any mutations.