StorageDictionary fix potential configuration race

This commit is contained in:
Maksim Kita 2021-10-21 17:25:53 +03:00
parent a9ac7fb394
commit 8885748a6c

View File

@ -212,11 +212,20 @@ void StorageDictionary::renameInMemory(const StorageID & new_table_id)
auto old_table_id = getStorageID();
IStorage::renameInMemory(new_table_id);
bool has_configuration = false;
{
std::lock_guard<std::mutex> lock(dictionary_config_mutex);
if (configuration)
{
has_configuration = true;
configuration->setString("dictionary.database", new_table_id.database_name);
configuration->setString("dictionary.name", new_table_id.table_name);
}
}
if (has_configuration)
{
const auto & external_dictionaries_loader = getContext()->getExternalDictionariesLoader();
auto result = external_dictionaries_loader.getLoadResult(old_table_id.getInternalDictionaryName());