MXS-936: AVRO shutdown update

AVRO shutdown detection is only in the loop that processes new files.

Flushing and status saving is done anyway
This commit is contained in:
MassimilianoPinto
2016-11-10 10:16:39 +01:00
parent 62049a5bb4
commit e9030f71bd

View File

@ -231,7 +231,6 @@ static bool add_conversion_task(AVRO_INSTANCE *inst)
if (inst->service->svc_do_shutdown) if (inst->service->svc_do_shutdown)
{ {
MXS_INFO("AVRO converter task is not added due to MaxScale shutdown"); MXS_INFO("AVRO converter task is not added due to MaxScale shutdown");
avro_close_binlog(inst->binlog_fd);
return false; return false;
} }
MXS_INFO("Setting task for converter_func"); MXS_INFO("Setting task for converter_func");
@ -1017,15 +1016,9 @@ void converter_func(void* data)
bool ok = true; bool ok = true;
avro_binlog_end_t binlog_end = AVRO_OK; avro_binlog_end_t binlog_end = AVRO_OK;
while (ok && binlog_end == AVRO_OK) while (!router->service->svc_do_shutdown && ok && binlog_end == AVRO_OK)
{ {
uint64_t start_pos = router->current_pos; uint64_t start_pos = router->current_pos;
if (router->service->svc_do_shutdown)
{
MXS_INFO("AVRO converter task is not handling events due to MaxScale shutdown");
break;
}
if (avro_open_binlog(router->binlogdir, router->binlog_name, &router->binlog_fd)) if (avro_open_binlog(router->binlogdir, router->binlog_name, &router->binlog_fd))
{ {
binlog_end = avro_read_all_events(router); binlog_end = avro_read_all_events(router);
@ -1047,11 +1040,6 @@ void converter_func(void* data)
/** We reached end of file, flush unwritten records to disk */ /** We reached end of file, flush unwritten records to disk */
if (router->task_delay == 1) if (router->task_delay == 1)
{ {
if (router->service->svc_do_shutdown)
{
MXS_INFO("AVRO converter task is not indexing due to MaxScale shutdown");
return;
}
avro_flush_all_tables(router); avro_flush_all_tables(router);
avro_save_conversion_state(router); avro_save_conversion_state(router);
} }