mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-11-29 18:37:36 +08:00
Purify sharding plan when reused
This commit is contained in:
parent
311f2a6560
commit
ecde9b345e
@ -199,6 +199,13 @@ check_backends_attr_changed(network_mysqld_con *con)
|
||||
return server_attr_changed;
|
||||
}
|
||||
|
||||
static void
|
||||
network_mysqld_con_purify_sharding_plan(struct sharding_plan_t *sharding_plan)
|
||||
{
|
||||
sharding_plan->modified_sql = NULL;
|
||||
sharding_plan->is_modified = 0;
|
||||
}
|
||||
|
||||
NETWORK_MYSQLD_PLUGIN_PROTO(proxy_read_query)
|
||||
{
|
||||
GQueue *chunks = con->client->recv_queue->chunks;
|
||||
@ -214,6 +221,9 @@ NETWORK_MYSQLD_PLUGIN_PROTO(proxy_read_query)
|
||||
|
||||
p.offset = 0;
|
||||
network_mysqld_con_reset_command_response_state(con);
|
||||
if (con->sharding_plan) {
|
||||
network_mysqld_con_purify_sharding_plan(con->sharding_plan);
|
||||
}
|
||||
g_debug("%s: call network_mysqld_con_command_states_init", G_STRLOC);
|
||||
if (network_mysqld_con_command_states_init(con, &p)) {
|
||||
g_warning("%s: tracking mysql proto states failed", G_STRLOC);
|
||||
@ -774,6 +784,15 @@ remove_ro_servers(network_mysqld_con *con)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
network_mysqld_con_set_sharding_plan(network_mysqld_con *con, sharding_plan_t *plan)
|
||||
{
|
||||
if (con->sharding_plan) {
|
||||
sharding_plan_free(con->sharding_plan);
|
||||
}
|
||||
con->sharding_plan = plan;
|
||||
}
|
||||
|
||||
static int
|
||||
process_init_db_when_get_server_list(network_mysqld_con *con, sharding_plan_t *plan, int *rv, int *disp_flag)
|
||||
{
|
||||
|
@ -5026,11 +5026,4 @@ check_and_create_conns_func(int fd, short what, void *arg)
|
||||
chassis_event_add_with_timeout(chas, &chas->auto_create_conns_event, &check_interval);
|
||||
}
|
||||
|
||||
void
|
||||
network_mysqld_con_set_sharding_plan(network_mysqld_con *con, sharding_plan_t *plan)
|
||||
{
|
||||
if (con->sharding_plan) {
|
||||
sharding_plan_free(con->sharding_plan);
|
||||
}
|
||||
con->sharding_plan = plan;
|
||||
}
|
||||
|
||||
|
@ -728,11 +728,6 @@ void network_mysqld_send_xa_start(network_socket *, const char *xid);
|
||||
NETWORK_API void network_mysqld_con_reset_command_response_state(network_mysqld_con *con);
|
||||
NETWORK_API void network_mysqld_con_reset_query_state(network_mysqld_con *con);
|
||||
|
||||
/**
|
||||
* set groups, delete if already exists
|
||||
*/
|
||||
void network_mysqld_con_set_sharding_plan(network_mysqld_con *con, struct sharding_plan_t *);
|
||||
|
||||
/**
|
||||
* should be socket
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user