mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Fix race in system.parts and system.parts_columns
This commit is contained in:
parent
26eb2f57e1
commit
3a5cea8281
@ -1851,7 +1851,7 @@ void MergeTreeData::removePartsFinally(const MergeTreeData::DataPartsVector & pa
|
||||
|
||||
auto it = data_parts_by_info.find(part->info);
|
||||
if (it == data_parts_by_info.end())
|
||||
throw Exception("Deleting data part " + part->name + " doesn't exist", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Deleting data part {} doesn't exist", part->name);
|
||||
|
||||
(*it)->assertState({DataPartState::Deleting});
|
||||
|
||||
|
@ -193,9 +193,12 @@ void StorageSystemPartsColumns::processNextStorage(
|
||||
columns[res_index++]->insert(part->getDataPartStorage().getDiskName());
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
// The full path changes at clean up thread under deleting state, do not read it, avoid the race
|
||||
if (part_state != State::Deleting)
|
||||
/// The full path changes at clean up thread, so do not read it if parts can be deleted, avoid the race.
|
||||
if (part->isStoredOnDisk()
|
||||
&& part_state != State::Deleting && part_state != State::DeleteOnDestroy && part_state != State::Temporary)
|
||||
{
|
||||
columns[res_index++]->insert(part->getDataPartStorage().getFullPath());
|
||||
}
|
||||
else
|
||||
columns[res_index++]->insertDefault();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user