Merge pull request #32972 from kitaisreal/containers-iteration-fix-erase

Containers iteration fix erase
This commit is contained in:
Maksim Kita 2021-12-20 16:47:19 +03:00 committed by GitHub
commit ebff389701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View File

@ -209,7 +209,7 @@ void Block::eraseImpl(size_t position)
for (auto it = index_by_name.begin(); it != index_by_name.end();)
{
if (it->second == position)
index_by_name.erase(it++);
it = index_by_name.erase(it);
else
{
if (it->second > position)

View File

@ -253,7 +253,7 @@ void DiskMemory::clearDirectory(const String & path)
throw Exception(
"Failed to clear directory '" + path + "'. " + iter->first + " is a directory", ErrorCodes::CANNOT_DELETE_DIRECTORY);
files.erase(iter++);
iter = files.erase(iter);
}
}

View File

@ -957,7 +957,7 @@ void TreeRewriterResult::collectUsedColumns(const ASTPtr & query, bool is_select
unknown_required_source_columns.erase(column_name);
if (!required.count(column_name))
source_columns.erase(it++);
it = source_columns.erase(it);
else
++it;
}
@ -973,7 +973,7 @@ void TreeRewriterResult::collectUsedColumns(const ASTPtr & query, bool is_select
if (column)
{
source_columns.push_back(*column);
unknown_required_source_columns.erase(it++);
it = unknown_required_source_columns.erase(it);
}
else
++it;

View File

@ -16,7 +16,7 @@ NameSet removeDuplicateColumns(NamesAndTypesList & columns)
if (names.emplace(it->name).second)
++it;
else
columns.erase(it++);
it = columns.erase(it);
}
return names;
}

View File

@ -49,7 +49,7 @@ bool ActiveDataPartSet::add(const String & name, Strings * out_replaced_parts)
if (out_replaced_parts)
out_replaced_parts->push_back(it->second);
part_info_to_name.erase(it++);
it = part_info_to_name.erase(it);
}
if (out_replaced_parts)
@ -61,7 +61,7 @@ bool ActiveDataPartSet::add(const String & name, Strings * out_replaced_parts)
assert(part_info != it->first);
if (out_replaced_parts)
out_replaced_parts->push_back(it->second);
part_info_to_name.erase(it++);
it = part_info_to_name.erase(it);
}
if (it != part_info_to_name.end() && !part_info.isDisjoint(it->first))

View File

@ -1033,7 +1033,7 @@ void ReplicatedMergeTreeQueue::removePartProducingOpsInRange(
min_unprocessed_insert_time_changed, max_processed_insert_time_changed, lock);
(*it)->removed_by_other_entry = true;
queue.erase(it++);
it = queue.erase(it);
++removed_entries;
}
else