Reject ddl for partition temporarily

This commit is contained in:
lazio579 2019-01-16 10:50:23 +08:00
parent 90d3118cb1
commit 27d9b04a5c
3 changed files with 21 additions and 7 deletions

View File

@ -384,7 +384,12 @@ sharding_get_sql(network_mysqld_con *con, const GString *group)
} else {
g_message("%s: first group:%s, now group:%s for con:%p", G_STRLOC, con->first_group->str, group->str, con);
if (g_string_equal(con->first_group, group)) {
return sharding_plan_get_sql(con->sharding_plan, group);
const GString *new_sql = sharding_plan_get_sql(con->sharding_plan, group);
if (new_sql == NULL) {
new_sql = con->orig_sql;
}
return new_sql;
} else {
shard_plugin_con_t *st = con->plugin_con_state;
sql_context_t *context = st->sql_context;
@ -392,6 +397,8 @@ sharding_get_sql(network_mysqld_con *con, const GString *group)
con->srv->is_groupby_need_reconstruct, con->srv->is_partition_mode, con->sharding_plan->groups->len);
if (new_sql) {
g_message("%s: new sql:%s for con:%p", G_STRLOC, new_sql->str, con);
} else {
new_sql = con->orig_sql;
}
return new_sql;
}

View File

@ -1718,10 +1718,15 @@ sharding_parse_groups(GString *default_db, sql_context_t *context, query_stats_t
return rc;
case STMT_DROP_DATABASE:
case STMT_COMMON_DDL: /* ddl without comments sent to all */
shard_conf_get_all_groups(groups);
sharding_plan_add_groups(plan, groups);
g_ptr_array_free(groups, TRUE);
return USE_ALL;
if (plan->is_partition_mode) {
sql_context_set_error(context, PARSE_NOT_SUPPORT, "(cetus) DDL is not allowed for partition until now");
return ERROR_UNPARSABLE;
} else {
shard_conf_get_all_groups(groups);
sharding_plan_add_groups(plan, groups);
g_ptr_array_free(groups, TRUE);
return USE_ALL;
}
case STMT_SHOW:
shard_conf_get_fixed_group(groups, fixture);
sharding_plan_add_groups(plan, groups);

View File

@ -209,7 +209,7 @@ chassis_frontend_new(void)
frontend->is_tcp_stream_enabled = 0;
frontend->is_fast_stream_enabled = 1;
frontend->is_partition_mode = 1;
frontend->is_partition_mode = 0;
frontend->group_replication_mode = 0;
frontend->sql_log_bufsize = 0;
frontend->sql_log_switch = NULL;
@ -506,7 +506,7 @@ chassis_frontend_set_chassis_options(struct chassis_frontend_t *frontend, chassi
chassis_options_add(opts, "enable-fast-stream", 0, 0, OPTION_ARG_NONE, &(frontend->is_fast_stream_enabled), "", NULL,
NULL, show_enable_fast_stream, SHOW_OPTS_PROPERTY|SAVE_OPTS_PROPERTY);
chassis_options_add(opts, "enable-partition", 0, 0, OPTION_ARG_NONE, &(frontend->is_partition_mode), "", NULL,
chassis_options_add(opts, "partition-mode", 0, 0, OPTION_ARG_NONE, &(frontend->is_partition_mode), "", NULL,
NULL, show_enable_partition, SHOW_OPTS_PROPERTY|SAVE_OPTS_PROPERTY);
chassis_options_add(opts,
@ -761,10 +761,12 @@ init_parameters(struct chassis_frontend_t *frontend, chassis *srv)
if (srv->is_fast_stream_enabled) {
g_message("%s:fast stream enabled", G_STRLOC);
}
#ifndef SIMPLE_PARSER
srv->is_partition_mode = frontend->is_partition_mode;
if (srv->is_partition_mode) {
g_message("%s:partition mode", G_STRLOC);
}
#endif
srv->disable_threads = frontend->disable_threads;
srv->is_back_compressed = frontend->is_back_compressed;
srv->compress_support = frontend->is_client_compress_support;