From 09df0acb008a8e1e3d1451b3b5294a45c9dae520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sat, 4 Mar 2017 00:31:07 +0200 Subject: [PATCH] Fix binlog rotation detection The rotations of binlogs weren't detected as the file names weren't compared. Moved the indexing of the binlogs to the end of the binlog processing. This way the files can be flushed multiple times before they are indexed. --- server/modules/routing/avro/avro.c | 8 +++++++- server/modules/routing/avro/avro_file.c | 3 --- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/avro/avro.c b/server/modules/routing/avro/avro.c index 398549817..8a7cfd65b 100644 --- a/server/modules/routing/avro/avro.c +++ b/server/modules/routing/avro/avro.c @@ -1000,14 +1000,20 @@ void converter_func(void* data) while (ok && binlog_end == AVRO_OK) { uint64_t start_pos = router->current_pos; + char binlog_name[BINLOG_FNAMELEN + 1]; + strcpy(binlog_name, router->binlog_name); + if (avro_open_binlog(router->binlogdir, router->binlog_name, &router->binlog_fd)) { binlog_end = avro_read_all_events(router); - if (router->current_pos != start_pos) + if (router->current_pos != start_pos || strcmp(binlog_name, router->binlog_name) != 0) { /** We processed some data, reset the conversion task delay */ router->task_delay = 1; + + /** Update the GTID index */ + avro_update_index(router); } avro_close_binlog(router->binlog_fd); diff --git a/server/modules/routing/avro/avro_file.c b/server/modules/routing/avro/avro_file.c index c1d65b1b0..cfa9e66cd 100644 --- a/server/modules/routing/avro/avro_file.c +++ b/server/modules/routing/avro/avro_file.c @@ -867,9 +867,6 @@ void avro_flush_all_tables(AVRO_INSTANCE *router) } hashtable_iterator_free(iter); } - - /** Update the GTID index */ - avro_update_index(router); } /**