ClickHouse / dbt-clickhouse

The Clickhouse plugin for dbt (data build tool)
Apache License 2.0
253 stars 113 forks source link

Truncate stack trace from error output #381

Open 3fonov opened 1 week ago

3fonov commented 1 week ago

I'm always frustrated when scrolling throw stack trace to my actual errors in database.

Solution Remove stack trace and keep only database errors.

Before

clickhouse adapter: ClickHouse server does not support exchange tables Database Error
  Code: 1.
  DB::Exception: System call renameat2() is not supported. Stack trace:

  0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xce3f35a in /usr/bin/clickhouse
  1. DB::renameExchange(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x11a385a5 in /usr/bin/clickhouse
  2. DB::DatabaseAtomic::renameTable(std::__1::shared_ptr<DB::Context const>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::IDatabase&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, bool) @ 0x11a2f0dd in /usr/bin/clickhouse
  3. DB::InterpreterRenameQuery::executeToTables(DB::ASTRenameQuery const&, std::__1::vector<DB::RenameDescription, std::__1::allocator<DB::RenameDescription> > const&, std::__1::map<DB::UniqueTableName, std::__1::unique_ptr<DB::DDLGuard, std::__1::default_delete<DB::DDLGuard> >, std::__1::less<DB::UniqueTableName>, std::__1::allocator<std::__1::pair<DB::UniqueTableName const, std::__1::unique_ptr<DB::DDLGuard, std::__1::default_delete<DB::DDLGuard> > > > >&) @ 0x125ca713 in /usr/bin/clickhouse
  4. DB::InterpreterRenameQuery::execute() @ 0x125c9608 in /usr/bin/clickhouse
  5. ? @ 0x1297956b in /usr/bin/clickhouse
  6. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x1297682d in /usr/bin/clickhouse
  7. DB::TCPHandler::runImpl() @ 0x1353d924 in /usr/bin/clickhouse
  8. DB::TCPHandler::run() @ 0x13551919 in /usr/bin/clickhouse
  9. Poco::Net::TCPServerConnection::start() @ 0x1636236f in /usr/bin/clickhouse
  10. Poco::Net::TCPServerDispatcher::run() @ 0x163646fb in /usr/bin/clickhouse
  11. Poco::PooledThread::run() @ 0x1651ff92 in /usr/bin/clickhouse
  12. Poco::ThreadImpl::runnableEntry(void*) @ 0x1651d71d in /usr/bin/clickhouse
  13. ? @ 0x7fd8e7797609 in ?
  14. clone @ 0x7fd8e76bc133 in ?

After

clickhouse adapter: ClickHouse server does not support exchange tables Database Error
  Code: 1.
  DB::Exception: System call renameat2() is not supported.
BentsiLeviav commented 1 week ago

Hi @3fonov

Thank you for your contribution. The error appears in the first line of the stack trace so most of the time there is no need to scroll until you find it. In addition, and most importantly, we use this stack trace to investigate things on the ClickHouse side, therefore, this suggestion is problematic.

Thanks again, we would love to get your help with other urgent issues.

3fonov commented 1 week ago

@BentsiLeviav from my point of view at day to day work i have following output in model with errors: image

And for me relevant only upper half of the output. Some times terminal window not so big and actual error hidden behind the fold. So stack trace in 99.9% of times is not relevant to me. Same thing made at dbt-bigquery adapter. Maybe we can introduce env variable HIDE_STACK_TRACE to hide stack trace?

BentsiLeviav commented 1 week ago

Maybe we can introduce env variable HIDE_STACK_TRACE to hide stack trace

Sounds good. Let's disable it by default.