Initialize all AvroSession variables

This is done to get tests to pass before further refactoring is done.
This commit is contained in:
Markus Mäkelä
2018-05-22 17:00:08 +03:00
parent 6159f863ce
commit a6eef98597
3 changed files with 11 additions and 14 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 */