CI linters and compiler errors

This commit is contained in:
Raúl Marín 2021-06-29 11:25:34 +02:00
parent 22d1ed472d
commit 75d18bc79b
4 changed files with 26 additions and 26 deletions

View File

@ -402,9 +402,9 @@ int getExceptionErrorCode(std::exception_ptr e)
{ {
std::rethrow_exception(e); std::rethrow_exception(e);
} }
catch (const Exception & e) catch (const Exception & exception)
{ {
return e.code(); return exception.code();
} }
catch (const Poco::Exception &) catch (const Poco::Exception &)
{ {

View File

@ -248,10 +248,10 @@ void PushingToViewsBlockOutputStream::writePrefix()
for (auto & view : views) for (auto & view : views)
{ {
process_prefix(view); processPrefix(view);
if (view.exception) if (view.exception)
{ {
log_query_views(); logQueryViews();
std::rethrow_exception(view.exception); std::rethrow_exception(view.exception);
} }
} }
@ -285,7 +285,7 @@ void PushingToViewsBlockOutputStream::writeSuffix()
pool.scheduleOrThrowOnError([&] { pool.scheduleOrThrowOnError([&] {
setThreadName("PushingToViews"); setThreadName("PushingToViews");
process_suffix(view); processSuffix(view);
if (view.exception) if (view.exception)
exception_count.fetch_add(1, std::memory_order_relaxed); exception_count.fetch_add(1, std::memory_order_relaxed);
}); });
@ -302,20 +302,20 @@ void PushingToViewsBlockOutputStream::writeSuffix()
exception_happened = true; exception_happened = true;
continue; continue;
} }
process_suffix(view); processSuffix(view);
if (view.exception) if (view.exception)
exception_happened = true; exception_happened = true;
} }
} }
if (exception_happened) if (exception_happened)
check_exceptions_in_views(); checkExceptionsInViews();
if (views.size() > 1) if (views.size() > 1)
{ {
UInt64 milliseconds = main_watch.elapsedMilliseconds(); UInt64 milliseconds = main_watch.elapsedMilliseconds();
LOG_DEBUG(log, "Pushing from {} to {} views took {} ms.", storage->getStorageID().getNameForLogs(), views.size(), milliseconds); LOG_DEBUG(log, "Pushing from {} to {} views took {} ms.", storage->getStorageID().getNameForLogs(), views.size(), milliseconds);
} }
log_query_views(); logQueryViews();
} }
void PushingToViewsBlockOutputStream::flush() void PushingToViewsBlockOutputStream::flush()
@ -391,17 +391,17 @@ void PushingToViewsBlockOutputStream::process(const Block & block, ViewInfo & vi
catch (Exception & ex) catch (Exception & ex)
{ {
ex.addMessage("while pushing to view " + view.table_id.getNameForLogs()); ex.addMessage("while pushing to view " + view.table_id.getNameForLogs());
view.set_exception(std::current_exception()); view.setException(std::current_exception());
} }
catch (...) catch (...)
{ {
view.set_exception(std::current_exception()); view.setException(std::current_exception());
} }
view.runtime_stats.elapsed_ms += watch.elapsedMilliseconds(); view.runtime_stats.elapsed_ms += watch.elapsedMilliseconds();
} }
void PushingToViewsBlockOutputStream::process_prefix(ViewInfo & view) void PushingToViewsBlockOutputStream::processPrefix(ViewInfo & view)
{ {
Stopwatch watch; Stopwatch watch;
/// Change thread context to store individual metrics per view. Once the work in done, go back to the original thread /// Change thread context to store individual metrics per view. Once the work in done, go back to the original thread
@ -420,17 +420,17 @@ void PushingToViewsBlockOutputStream::process_prefix(ViewInfo & view)
catch (Exception & ex) catch (Exception & ex)
{ {
ex.addMessage("while writing prefix to view " + view.table_id.getNameForLogs()); ex.addMessage("while writing prefix to view " + view.table_id.getNameForLogs());
view.set_exception(std::current_exception()); view.setException(std::current_exception());
} }
catch (...) catch (...)
{ {
view.set_exception(std::current_exception()); view.setException(std::current_exception());
} }
view.runtime_stats.elapsed_ms += watch.elapsedMilliseconds(); view.runtime_stats.elapsed_ms += watch.elapsedMilliseconds();
} }
void PushingToViewsBlockOutputStream::process_suffix(ViewInfo & view) void PushingToViewsBlockOutputStream::processSuffix(ViewInfo & view)
{ {
Stopwatch watch; Stopwatch watch;
/// Change thread context to store individual metrics per view. Once the work in done, go back to the original thread /// Change thread context to store individual metrics per view. Once the work in done, go back to the original thread
@ -450,11 +450,11 @@ void PushingToViewsBlockOutputStream::process_suffix(ViewInfo & view)
catch (Exception & ex) catch (Exception & ex)
{ {
ex.addMessage("while writing suffix to view " + view.table_id.getNameForLogs()); ex.addMessage("while writing suffix to view " + view.table_id.getNameForLogs());
view.set_exception(std::current_exception()); view.setException(std::current_exception());
} }
catch (...) catch (...)
{ {
view.set_exception(std::current_exception()); view.setException(std::current_exception());
} }
view.runtime_stats.elapsed_ms += watch.elapsedMilliseconds(); view.runtime_stats.elapsed_ms += watch.elapsedMilliseconds();
if (!view.exception) if (!view.exception)
@ -468,19 +468,19 @@ void PushingToViewsBlockOutputStream::process_suffix(ViewInfo & view)
} }
} }
void PushingToViewsBlockOutputStream::check_exceptions_in_views() void PushingToViewsBlockOutputStream::checkExceptionsInViews()
{ {
for (auto & view : views) for (auto & view : views)
{ {
if (view.exception) if (view.exception)
{ {
log_query_views(); logQueryViews();
std::rethrow_exception(view.exception); std::rethrow_exception(view.exception);
} }
} }
} }
void PushingToViewsBlockOutputStream::log_query_views() void PushingToViewsBlockOutputStream::logQueryViews()
{ {
const auto & settings = getContext()->getSettingsRef(); const auto & settings = getContext()->getSettingsRef();
const UInt64 min_query_duration = settings.log_queries_min_query_duration_ms.totalMilliseconds(); const UInt64 min_query_duration = settings.log_queries_min_query_duration_ms.totalMilliseconds();

View File

@ -9,7 +9,7 @@
namespace Poco namespace Poco
{ {
class Logger; class Logger;
}; }
namespace DB namespace DB
{ {
@ -24,7 +24,7 @@ struct ViewInfo
std::exception_ptr exception; std::exception_ptr exception;
QueryViewsLogElement::ViewRuntimeStats runtime_stats; QueryViewsLogElement::ViewRuntimeStats runtime_stats;
void set_exception(std::exception_ptr e) void setException(std::exception_ptr e)
{ {
exception = e; exception = e;
runtime_stats.setStatus(QueryViewsLogElement::ViewStatus::EXCEPTION_WHILE_PROCESSING); runtime_stats.setStatus(QueryViewsLogElement::ViewStatus::EXCEPTION_WHILE_PROCESSING);
@ -65,10 +65,10 @@ private:
ContextMutablePtr insert_context; ContextMutablePtr insert_context;
void process(const Block & block, ViewInfo & view); void process(const Block & block, ViewInfo & view);
void process_prefix(ViewInfo & view); static void processPrefix(ViewInfo & view);
void process_suffix(ViewInfo & view); void processSuffix(ViewInfo & view);
void check_exceptions_in_views(); void checkExceptionsInViews();
void log_query_views(); void logQueryViews();
}; };

View File

@ -66,7 +66,7 @@ struct QueryViewsLogElement
Int64 peak_memory_usage{}; Int64 peak_memory_usage{};
std::shared_ptr<ProfileEvents::Counters> profile_counters; std::shared_ptr<ProfileEvents::Counters> profile_counters;
ViewStatus status; ViewStatus status = ViewStatus::QUERY_START;
Int32 exception_code{}; Int32 exception_code{};
String exception; String exception;
String stack_trace; String stack_trace;