Merge branch 'master' into multi-processes

This commit is contained in:
wangbin579 2018-09-03 11:02:40 +08:00
commit c5c1011539
4 changed files with 8 additions and 2 deletions

View File

@ -1752,6 +1752,7 @@ void admin_create_vdb(network_mysqld_con* con, int id, GPtrArray* partitions,
gboolean ok = sharding_vdb_is_valid(vdb, g->backends->groups->len)
&& shard_conf_add_vdb(vdb);
if (ok) {
g_message("Admin: %s", con->orig_sql->str);
shard_conf_write_json(con->srv->config_manager);
network_mysqld_con_send_ok(con->client);
} else {
@ -1774,6 +1775,7 @@ void admin_create_sharded_table(network_mysqld_con* con, const char* schema,
t->pkey = g_string_new(key);
gboolean ok = shard_conf_add_sharded_table(t);
if (ok) {
g_message("Admin: %s", con->orig_sql->str);
shard_conf_write_json(con->srv->config_manager);
network_mysqld_con_send_ok(con->client);
} else {
@ -1965,6 +1967,7 @@ void admin_create_single_table(network_mysqld_con* con, const char* schema,
gboolean ok = shard_conf_add_single_table(schema, table, group);
if (ok) {
g_message("Admin: %s", con->orig_sql->str);
shard_conf_write_json(con->srv->config_manager);
network_mysqld_con_send_ok_full(con->client, 1, 0, SERVER_STATUS_AUTOCOMMIT, 0);
} else {

View File

@ -431,7 +431,7 @@ network_mysqld_con_retry_timeout(network_mysqld_con *con)
return timeout;
}
int network_mysqld_con_clear_xa_env_when_not_expected(network_mysqld_con *con)
void network_mysqld_con_clear_xa_env_when_not_expected(network_mysqld_con *con)
{
con->dist_tran = 0;
con->dist_tran_failed = 0;

View File

@ -772,7 +772,7 @@ NETWORK_API void network_mysqld_con_handle(int event_fd, short events, void *use
NETWORK_API int network_mysqld_queue_append(network_socket *sock, network_queue *queue, const char *data, size_t len);
NETWORK_API int network_mysqld_queue_append_raw(network_socket *sock, network_queue *queue, GString *data);
NETWORK_API int network_mysqld_queue_reset(network_socket *sock);
NETWORK_API int network_mysqld_con_clear_xa_env_when_not_expected(network_mysqld_con *con);
NETWORK_API void network_mysqld_con_clear_xa_env_when_not_expected(network_mysqld_con *con);
NETWORK_API void network_connection_pool_create_conn(network_mysqld_con *con);
NETWORK_API void network_connection_pool_create_conns(chassis *srv);

View File

@ -967,6 +967,8 @@ gboolean shard_conf_add_sharded_table(sharding_table_t* t)
{
sharding_vdb_t* vdb = shard_vdbs_get_by_id(shard_conf_vdbs, t->vdb_id);
if (vdb) {
t->vdb_ref = vdb;
t->shard_key_type = vdb->key_type;
return sharding_tables_add(t);
} else {
return FALSE;
@ -1052,6 +1054,7 @@ gboolean shard_conf_write_json(chassis_config_t* conf_manager)
char* json_str = cJSON_Print(root);
chassis_config_write_object(conf_manager, "sharding", json_str);
g_message("Update sharding.json");
cJSON_Delete(root);
g_free(json_str);
return TRUE;