mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-12-02 03:47:41 +08:00
session id
This commit is contained in:
parent
cd3f134c3d
commit
fff439299c
@ -384,6 +384,11 @@ void admin_show_connectionlist(network_mysqld_con *admin_con, int show_count)
|
||||
|
||||
fields = g_ptr_array_new_with_free_func((void *) network_mysqld_proto_fielddef_free);
|
||||
|
||||
field = network_mysqld_proto_fielddef_new();
|
||||
field->name = g_strdup("Id");
|
||||
field->type = MYSQL_TYPE_STRING;
|
||||
g_ptr_array_add(fields, field);
|
||||
|
||||
field = network_mysqld_proto_fielddef_new();
|
||||
field->name = g_strdup("User");
|
||||
field->type = MYSQL_TYPE_STRING;
|
||||
@ -467,6 +472,7 @@ void admin_show_connectionlist(network_mysqld_con *admin_con, int show_count)
|
||||
count++;
|
||||
|
||||
row = g_ptr_array_new_with_free_func(g_free);
|
||||
g_ptr_array_add(row, g_strdup_printf("%lu", con->id));
|
||||
if (con->client->response != NULL) {
|
||||
g_ptr_array_add(row, g_strdup(con->client->response->username->str));
|
||||
} else {
|
||||
|
@ -392,7 +392,7 @@ explain_shard_sql(network_mysqld_con *con, sharding_plan_t *plan)
|
||||
|
||||
shard_plugin_con_t *st = con->plugin_con_state;
|
||||
|
||||
rv = sharding_parse_groups(con->client->default_db, st->sql_context, &(con->srv->query_stats), con->key, plan);
|
||||
rv = sharding_parse_groups(con->client->default_db, st->sql_context, &(con->srv->query_stats), con->id, plan);
|
||||
|
||||
con->modified_sql = sharding_modify_sql(st->sql_context, &(con->hav_condi));
|
||||
if (con->modified_sql) {
|
||||
@ -832,7 +832,7 @@ process_init_db_when_get_server_list(network_mysqld_con *con, sharding_plan_t *p
|
||||
} else {
|
||||
name_len = name_len - 1;
|
||||
network_mysqld_proto_get_str_len(&packet, &db_name, name_len);
|
||||
shard_conf_get_fixed_group(groups, con->key);
|
||||
shard_conf_get_fixed_group(groups, con->id);
|
||||
}
|
||||
|
||||
if (groups->len > 0) { /* has database */
|
||||
@ -1201,7 +1201,8 @@ proxy_get_server_list(network_mysqld_con *con)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rv = sharding_parse_groups(con->client->default_db, st->sql_context, stats, con->key, plan);
|
||||
rv = sharding_parse_groups(con->client->default_db, st->sql_context,
|
||||
stats, con->id, plan);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1484,7 +1484,7 @@ routing_by_property(sql_context_t *context, sql_property_t *property, char *defa
|
||||
|
||||
int
|
||||
sharding_parse_groups(GString *default_db, sql_context_t *context, query_stats_t *stats,
|
||||
guint32 fixture, sharding_plan_t *plan)
|
||||
guint64 fixture, sharding_plan_t *plan)
|
||||
{
|
||||
GPtrArray *groups = g_ptr_array_new();
|
||||
if (context == NULL) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
#define USE_PREVIOUS_TRAN_CONNS 9
|
||||
#define ERROR_UNPARSABLE -1
|
||||
|
||||
NETWORK_API int sharding_parse_groups(GString *, sql_context_t *, query_stats_t *, unsigned int, sharding_plan_t *);
|
||||
NETWORK_API int sharding_parse_groups(GString *, sql_context_t *, query_stats_t *, guint64, sharding_plan_t *);
|
||||
|
||||
NETWORK_API GString *sharding_modify_sql(sql_context_t *, having_condition_t *);
|
||||
|
||||
|
@ -121,7 +121,7 @@ struct chassis {
|
||||
char *default_charset;
|
||||
char *default_hashed_pwd;
|
||||
|
||||
unsigned int sess_key;
|
||||
guint64 sess_key;
|
||||
unsigned int maintain_close_mode;
|
||||
unsigned int disable_threads;
|
||||
int ssl;
|
||||
|
@ -4225,7 +4225,7 @@ network_mysqld_con_accept(int G_GNUC_UNUSED event_fd, short events, void *user_d
|
||||
|
||||
network_mysqld_add_connection(listen_con->srv, client_con, FALSE);
|
||||
|
||||
client_con->key = client_con->srv->sess_key++;
|
||||
client_con->id = client_con->srv->sess_key++; /*TODO: duplicate check */
|
||||
|
||||
/**
|
||||
* inherit the config to the new connection
|
||||
|
@ -510,7 +510,7 @@ struct network_mysqld_con {
|
||||
int num_servers_visited;
|
||||
int num_write_pending;
|
||||
int num_read_pending;
|
||||
unsigned int key;
|
||||
guint64 id; /* session id */
|
||||
|
||||
mysqld_query_attr_t query_attr;
|
||||
|
||||
|
@ -382,7 +382,7 @@ shard_conf_is_shard_table(const char *db, const char *table)
|
||||
}
|
||||
|
||||
GPtrArray *
|
||||
shard_conf_get_fixed_group(GPtrArray *groups, guint32 fixture)
|
||||
shard_conf_get_fixed_group(GPtrArray *groups, guint64 fixture)
|
||||
{
|
||||
int len = g_list_length(shard_conf_all_groups);
|
||||
if (len == 0) {
|
||||
|
@ -99,7 +99,7 @@ GPtrArray *shard_conf_get_any_group(GPtrArray *groups, const char *db, const cha
|
||||
GPtrArray *shard_conf_get_all_groups(GPtrArray *groups);
|
||||
|
||||
/* same fixture will get same group */
|
||||
GPtrArray *shard_conf_get_fixed_group(GPtrArray *groups, guint32 fixture);
|
||||
GPtrArray *shard_conf_get_fixed_group(GPtrArray *groups, guint64 fixture);
|
||||
|
||||
GPtrArray *shard_conf_get_table_groups(GPtrArray *visited_groups,
|
||||
const char *db, const char *table);
|
||||
|
Loading…
Reference in New Issue
Block a user