Initialize all AvroSession variables
This is done to get tests to pass before further refactoring is done.
This commit is contained in:
@ -679,21 +679,23 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session)
|
|||||||
}
|
}
|
||||||
|
|
||||||
atomic_add(&inst->stats.n_clients, 1);
|
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;
|
client->uuid = NULL;
|
||||||
spinlock_init(&client->catch_lock);
|
spinlock_init(&client->catch_lock);
|
||||||
client->dcb = session->client_dcb;
|
|
||||||
client->router = inst;
|
client->router = inst;
|
||||||
client->format = AVRO_FORMAT_UNDEFINED;
|
client->file_handle = NULL; /*< Current open file handle */
|
||||||
|
client->last_sent_pos = 0; /*< The last record we sent */
|
||||||
client->cstate = 0;
|
|
||||||
|
|
||||||
client->connect_time = time(0);
|
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, 0, sizeof(client->gtid));
|
||||||
memset(&client->gtid_start, 0, sizeof(client->gtid_start));
|
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];
|
char dbpath[PATH_MAX + 1];
|
||||||
snprintf(dbpath, sizeof(dbpath), "/%s/%s", inst->avrodir, avro_index_name);
|
snprintf(dbpath, sizeof(dbpath), "/%s/%s", inst->avrodir, avro_index_name);
|
||||||
|
|
||||||
|
|||||||
@ -805,11 +805,7 @@ static bool avro_client_stream_data(AvroSession *client)
|
|||||||
maxavro_get_error_string(client->file_handle));
|
maxavro_get_error_string(client->file_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update client struct */
|
client->last_sent_pos = client->file_handle->records_read;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -243,7 +243,6 @@ struct AvroSession
|
|||||||
MAXAVRO_FILE* file_handle; /*< Current open file handle */
|
MAXAVRO_FILE* file_handle; /*< Current open file handle */
|
||||||
uint64_t last_sent_pos; /*< The last record we sent */
|
uint64_t last_sent_pos; /*< The last record we sent */
|
||||||
time_t connect_time; /*< Connect time of slave */
|
time_t connect_time; /*< Connect time of slave */
|
||||||
MAXAVRO_FILE avro_file; /*< Avro file struct */
|
|
||||||
char avro_binfile[AVRO_MAX_FILENAME_LEN + 1];
|
char avro_binfile[AVRO_MAX_FILENAME_LEN + 1];
|
||||||
bool requested_gtid; /*< If the client requested */
|
bool requested_gtid; /*< If the client requested */
|
||||||
gtid_pos_t gtid; /*< Current/requested GTID */
|
gtid_pos_t gtid; /*< Current/requested GTID */
|
||||||
|
|||||||
Reference in New Issue
Block a user