Merge pull request #14689 from ClickHouse/aku/broken-perf

Add context to errors in ExpressionAction
This commit is contained in:
Nikita Mikhaylov 2020-09-21 23:33:42 +03:00 committed by GitHub
commit 123f389f1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

View File

@ -822,7 +822,24 @@ void CacheDictionary::waitForCurrentUpdateFinish(UpdateUnitPtr & update_unit_ptr
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

View File

@ -607,8 +607,16 @@ void ExpressionActions::execute(Block & block, bool dry_run) const
{
for (const auto & action : actions)
{
action.execute(block, dry_run);
checkLimits(block);
try
{
action.execute(block, dry_run);
checkLimits(block);
}
catch (Exception & e)
{
e.addMessage(fmt::format("while executing '{}'", action.toString()));
throw;
}
}
}