diff --git a/server/modules/routing/avrorouter/avro.cc b/server/modules/routing/avrorouter/avro.cc index b5f92b497..e2e77e757 100644 --- a/server/modules/routing/avrorouter/avro.cc +++ b/server/modules/routing/avrorouter/avro.cc @@ -679,21 +679,23 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session) } atomic_add(&inst->stats.n_clients, 1); + + client->dcb = session->client_dcb; + client->state = AVRO_CLIENT_UNREGISTERED; + client->format = AVRO_FORMAT_UNDEFINED; client->uuid = NULL; spinlock_init(&client->catch_lock); - client->dcb = session->client_dcb; client->router = inst; - client->format = AVRO_FORMAT_UNDEFINED; - - client->cstate = 0; - + client->file_handle = NULL; /*< Current open file handle */ + client->last_sent_pos = 0; /*< The last record we sent */ client->connect_time = time(0); - client->last_sent_pos = 0; + client->avro_binfile[0] = '\0'; + client->requested_gtid = false; /*< If the client requested */ memset(&client->gtid, 0, sizeof(client->gtid)); memset(&client->gtid_start, 0, sizeof(client->gtid_start)); + client->cstate = 0; + client->sqlite_handle = NULL; - /* Set initial state of the slave */ - client->state = AVRO_CLIENT_UNREGISTERED; char dbpath[PATH_MAX + 1]; snprintf(dbpath, sizeof(dbpath), "/%s/%s", inst->avrodir, avro_index_name); diff --git a/server/modules/routing/avrorouter/avro_client.cc b/server/modules/routing/avrorouter/avro_client.cc index 80770a8ee..db65149fb 100644 --- a/server/modules/routing/avrorouter/avro_client.cc +++ b/server/modules/routing/avrorouter/avro_client.cc @@ -805,11 +805,7 @@ static bool avro_client_stream_data(AvroSession *client) maxavro_get_error_string(client->file_handle)); } - /* update client struct */ - memcpy(&client->avro_file, client->file_handle, sizeof(client->avro_file)); - - /* may be just use client->avro_file->records_read and remove this var */ - client->last_sent_pos = client->avro_file.records_read; + client->last_sent_pos = client->file_handle->records_read; } } else diff --git a/server/modules/routing/avrorouter/avrorouter.hh b/server/modules/routing/avrorouter/avrorouter.hh index 4a2928c8c..48d92f949 100644 --- a/server/modules/routing/avrorouter/avrorouter.hh +++ b/server/modules/routing/avrorouter/avrorouter.hh @@ -243,7 +243,6 @@ struct AvroSession MAXAVRO_FILE* file_handle; /*< Current open file handle */ uint64_t last_sent_pos; /*< The last record we sent */ time_t connect_time; /*< Connect time of slave */ - MAXAVRO_FILE avro_file; /*< Avro file struct */ char avro_binfile[AVRO_MAX_FILENAME_LEN + 1]; bool requested_gtid; /*< If the client requested */ gtid_pos_t gtid; /*< Current/requested GTID */