This commit is contained in:
Alexander Kuzmenkov 2020-09-16 13:00:15 +03:00
parent b1741dd87e
commit da2a3fffe8

View File

@ -822,7 +822,24 @@ void CacheDictionary::waitForCurrentUpdateFinish(UpdateUnitPtr & update_unit_ptr
if (update_unit_ptr->current_exception) if (update_unit_ptr->current_exception)
std::rethrow_exception(update_unit_ptr->current_exception); {
// There might have been a single update unit for multiple callers in
// independent threads, and current_exception will be the same for them.
// Don't just rethrow it, because sharing the same exception object
// between multiple threads can lead to weird effects if they decide to
// modify it, for example, by adding some error context.
try
{
std::rethrow_exception(update_unit_ptr->current_exception);
}
catch (...)
{
throw DB::Exception(ErrorCodes::CACHE_DICTIONARY_UPDATE_FAIL,
"Dictionary update failed: {}",
getCurrentExceptionMessage(true /*with stack trace*/,
true /*check embedded stack trace*/));
}
}
} }
void CacheDictionary::tryPushToUpdateQueueOrThrow(UpdateUnitPtr & update_unit_ptr) const void CacheDictionary::tryPushToUpdateQueueOrThrow(UpdateUnitPtr & update_unit_ptr) const