mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Add some logging to StorageRabbitMQ
This commit is contained in:
parent
2ba9263098
commit
3ef2c37b92
@ -959,11 +959,52 @@ bool StorageRabbitMQ::hasDependencies(const StorageID & table_id)
|
||||
|
||||
void StorageRabbitMQ::streamingToViewsFunc()
|
||||
{
|
||||
chassert(initialized);
|
||||
if (initialized)
|
||||
{
|
||||
try
|
||||
{
|
||||
streamToViewsImpl();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
mv_attached.store(false);
|
||||
|
||||
try
|
||||
{
|
||||
/// If there is no running select, stop the loop which was
|
||||
/// activated by previous select.
|
||||
if (connection->getHandler().loopRunning())
|
||||
stopLoopIfNoReaders();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
if (shutdown_called)
|
||||
{
|
||||
LOG_DEBUG(log, "Shutdown called, stopping background streaming process");
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Reschedule with backoff.
|
||||
if (milliseconds_to_wait < rabbitmq_settings->rabbitmq_empty_queue_backoff_end_ms)
|
||||
milliseconds_to_wait += rabbitmq_settings->rabbitmq_empty_queue_backoff_step_ms;
|
||||
|
||||
LOG_DEBUG(log, "Rescheduling background streaming process in {}", milliseconds_to_wait);
|
||||
streaming_task->scheduleAfter(milliseconds_to_wait);
|
||||
}
|
||||
}
|
||||
|
||||
void StorageRabbitMQ::streamToViewsImpl()
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
chassert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
auto table_id = getStorageID();
|
||||
|
||||
// Check if at least one direct dependency is attached
|
||||
@ -999,31 +1040,8 @@ void StorageRabbitMQ::streamingToViewsFunc()
|
||||
milliseconds_to_wait = rabbitmq_settings->rabbitmq_empty_queue_backoff_start_ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
mv_attached.store(false);
|
||||
|
||||
/// If there is no running select, stop the loop which was
|
||||
/// activated by previous select.
|
||||
if (connection->getHandler().loopRunning())
|
||||
stopLoopIfNoReaders();
|
||||
|
||||
if (!shutdown_called)
|
||||
{
|
||||
/// Reschedule with backoff.
|
||||
if (milliseconds_to_wait < rabbitmq_settings->rabbitmq_empty_queue_backoff_end_ms)
|
||||
milliseconds_to_wait += rabbitmq_settings->rabbitmq_empty_queue_backoff_step_ms;
|
||||
|
||||
streaming_task->scheduleAfter(milliseconds_to_wait);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool StorageRabbitMQ::tryStreamToViews()
|
||||
{
|
||||
auto table_id = getStorageID();
|
||||
|
@ -187,6 +187,7 @@ private:
|
||||
void bindExchange(AMQP::TcpChannel & rabbit_channel);
|
||||
void bindQueue(size_t queue_id, AMQP::TcpChannel & rabbit_channel);
|
||||
|
||||
void streamToViewsImpl();
|
||||
/// Return true on successful stream attempt.
|
||||
bool tryStreamToViews();
|
||||
bool hasDependencies(const StorageID & table_id);
|
||||
|
Loading…
Reference in New Issue
Block a user