Skip to content

Commit

Permalink
Merge pull request #461 from hanchuanchuan/feature-refactor-error-level
Browse files Browse the repository at this point in the history
Feature: refactor error level
  • Loading branch information
hanchuanchuan authored Jun 12, 2022
2 parents c9d9d9d + d0a590b commit 1c797cb
Show file tree
Hide file tree
Showing 14 changed files with 698 additions and 397 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CHECK_LDFLAGS += $(LDFLAGS) ${TEST_LDFLAGS}

TARGET = ""

.PHONY: all build update parser clean todo test gotest interpreter server dev benchkv benchraw check parserlib checklist testapi docs
.PHONY: all build update parser clean todo test gotest interpreter server dev benchkv benchraw check parserlib checklist testapi docs level

default: server buildsucc

Expand Down Expand Up @@ -379,3 +379,7 @@ docker-push:

docs:
$(shell bash docs/deploy.sh)

level:
$(GO) run config/generate_levels/main.go
gofmt -w config/error_level.go
133 changes: 1 addition & 132 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,73 +610,6 @@ type Ghost struct {
GhostBinDir string `toml:"ghost_bin_dir" json:"ghost_bin_dir"`
}

type IncLevel struct {
ER_ALTER_TABLE_ONCE int8 `toml:"er_alter_table_once"`
ER_AUTO_INCR_ID_WARNING int8 `toml:"er_auto_incr_id_warning"`
ER_AUTOINC_UNSIGNED int8 `toml:"er_autoinc_unsigned"`
ER_BLOB_CANT_HAVE_DEFAULT int8 `toml:"er_blob_cant_have_default"`
ER_CANT_SET_CHARSET int8 `toml:"er_cant_set_charset"`
ER_CANT_SET_COLLATION int8 `toml:"er_cant_set_collation"`
ER_CANT_SET_ENGINE int8 `toml:"er_cant_set_engine"`
ER_CHANGE_COLUMN_TYPE int8 `toml:"er_change_column_type"`
ER_CHANGE_TOO_MUCH_ROWS int8 `toml:"er_change_too_much_rows"`
ER_CHAR_TO_VARCHAR_LEN int8 `toml:"er_char_to_varchar_len"`
ER_CHARSET_ON_COLUMN int8 `toml:"er_charset_on_column"`
ER_COLUMN_HAVE_NO_COMMENT int8 `toml:"er_column_have_no_comment"`
ER_DATETIME_DEFAULT int8 `toml:"er_datetime_default"`
ErrFloatDoubleToDecimal int8 `toml:"er_float_double_to_decimal"`
ER_FOREIGN_KEY int8 `toml:"er_foreign_key"`
ER_IDENT_USE_KEYWORD int8 `toml:"er_ident_use_keyword"`
ER_INC_INIT_ERR int8 `toml:"er_inc_init_err"`

ER_INDEX_NAME_IDX_PREFIX int8 `toml:"er_index_name_idx_prefix"`
ER_INDEX_NAME_UNIQ_PREFIX int8 `toml:"er_index_name_uniq_prefix"`
ER_INSERT_TOO_MUCH_ROWS int8 `toml:"er_insert_too_much_rows"`
ER_INVALID_DATA_TYPE int8 `toml:"er_invalid_data_type"`
ER_INVALID_IDENT int8 `toml:"er_invalid_ident"`
ErrMariaDBRollbackWarn int8 `toml:"er_mariadb_rollback_warn"`
ER_MUST_HAVE_COLUMNS int8 `toml:"er_must_have_columns"`
ErrColumnsMustHaveIndex int8 `toml:"er_columns_must_have_index"`
ErrColumnsMustHaveIndexTypeErr int8 `toml:"er_columns_must_have_index_type_err"`
ER_NO_WHERE_CONDITION int8 `toml:"er_no_where_condition"`
ER_NOT_ALLOWED_NULLABLE int8 `toml:"er_not_allowed_nullable"`
ER_ORDERY_BY_RAND int8 `toml:"er_ordery_by_rand"`
ER_PARTITION_NOT_ALLOWED int8 `toml:"er_partition_not_allowed"`
ER_PK_COLS_NOT_INT int8 `toml:"er_pk_cols_not_int"`
ER_PK_TOO_MANY_PARTS int8 `toml:"er_pk_too_many_parts"`
ER_SELECT_ONLY_STAR int8 `toml:"er_select_only_star"`
ER_SET_DATA_TYPE_INT_BIGINT int8 `toml:"er_set_data_type_int_bigint"`
ER_TABLE_CHARSET_MUST_NULL int8 `toml:"er_table_charset_must_null"`
ER_TABLE_CHARSET_MUST_UTF8 int8 `toml:"er_table_charset_must_utf8"`
ER_TABLE_MUST_HAVE_COMMENT int8 `toml:"er_table_must_have_comment"`
ER_TABLE_MUST_HAVE_PK int8 `toml:"er_table_must_have_pk"`
ER_TABLE_PREFIX int8 `toml:"er_table_prefix"`
ER_TEXT_NOT_NULLABLE_ERROR int8 `toml:"er_text_not_nullable_error"`
ER_TIMESTAMP_DEFAULT int8 `toml:"er_timestamp_default"`
ER_TOO_MANY_KEY_PARTS int8 `toml:"er_too_many_key_parts"`
ER_TOO_MANY_KEYS int8 `toml:"er_too_many_keys"`
ER_TOO_MUCH_AUTO_DATETIME_COLS int8 `toml:"er_too_much_auto_datetime_cols"`
ER_TOO_MUCH_AUTO_TIMESTAMP_COLS int8 `toml:"er_too_much_auto_timestamp_cols"`
ER_UDPATE_TOO_MUCH_ROWS int8 `toml:"er_udpate_too_much_rows"`
ER_USE_ENUM int8 `toml:"er_use_enum"`
ER_USE_TEXT_OR_BLOB int8 `toml:"er_use_text_or_blob"`
ER_WITH_DEFAULT_ADD_COLUMN int8 `toml:"er_with_default_add_column"`
ER_WITH_INSERT_FIELD int8 `toml:"er_with_insert_field"`
ER_WITH_LIMIT_CONDITION int8 `toml:"er_with_limit_condition"`
ER_WITH_ORDERBY_CONDITION int8 `toml:"er_with_orderby_condition"`
ErCantChangeColumn int8 `toml:"er_cant_change_column"`
ErCantChangeColumnPosition int8 `toml:"er_cant_change_column_position"`
ErJsonTypeSupport int8 `toml:"er_json_type_support"`
ErrImplicitTypeConversion int8 `toml:"er_implicit_type_conversion"`
ErrJoinNoOnCondition int8 `toml:"er_join_no_on_condition"`
ErrUseValueExpr int8 `toml:"er_use_value_expr"`
ErrWrongAndExpr int8 `toml:"er_wrong_and_expr"`
ErrViewSupport int8 `toml:"er_view_support"`
ErrIncorrectDateTimeValue int8 `toml:"er_incorrect_datetime_value"`
ErrMaxVarcharLength int8 `toml:"er_max_varchar_length"`
ErrMaxColumnCount int8 `toml:"er_max_column_count"`
}

var defaultConf = Config{
Host: "0.0.0.0",
AdvertiseAddress: "",
Expand Down Expand Up @@ -830,71 +763,7 @@ var defaultConf = Config{
GhostOkToDropTable: true,
GhostSkipForeignKeyChecks: true,
},
IncLevel: IncLevel{
ER_ALTER_TABLE_ONCE: 1,
ER_AUTO_INCR_ID_WARNING: 1,
ER_AUTOINC_UNSIGNED: 1,
ER_BLOB_CANT_HAVE_DEFAULT: 1,
ER_CANT_SET_CHARSET: 1,
ER_CANT_SET_COLLATION: 1,
ER_CANT_SET_ENGINE: 1,
ER_CHANGE_COLUMN_TYPE: 1,
ER_CHANGE_TOO_MUCH_ROWS: 1,
ER_CHAR_TO_VARCHAR_LEN: 1,
ER_CHARSET_ON_COLUMN: 1,
ER_COLUMN_HAVE_NO_COMMENT: 1,
ER_DATETIME_DEFAULT: 1,
ErrFloatDoubleToDecimal: 2,
ER_FOREIGN_KEY: 2,
ER_IDENT_USE_KEYWORD: 1,
ER_INC_INIT_ERR: 1,
ER_INDEX_NAME_IDX_PREFIX: 1,
ER_INDEX_NAME_UNIQ_PREFIX: 1,
ER_INSERT_TOO_MUCH_ROWS: 1,
ER_INVALID_DATA_TYPE: 1,
ER_INVALID_IDENT: 1,
ErrMariaDBRollbackWarn: 1,
ER_MUST_HAVE_COLUMNS: 1,
ErrColumnsMustHaveIndex: 1,
ErrColumnsMustHaveIndexTypeErr: 1,
ER_NO_WHERE_CONDITION: 1,
ER_NOT_ALLOWED_NULLABLE: 1,
ER_ORDERY_BY_RAND: 1,
ER_PARTITION_NOT_ALLOWED: 1,
ER_PK_COLS_NOT_INT: 1,
ER_PK_TOO_MANY_PARTS: 1,
ER_SELECT_ONLY_STAR: 1,
ER_SET_DATA_TYPE_INT_BIGINT: 2,
ER_TABLE_CHARSET_MUST_NULL: 1,
ER_TABLE_CHARSET_MUST_UTF8: 1,
ER_TABLE_MUST_HAVE_COMMENT: 1,
ER_TABLE_MUST_HAVE_PK: 1,
ER_TABLE_PREFIX: 1,
ER_TEXT_NOT_NULLABLE_ERROR: 1,
ER_TIMESTAMP_DEFAULT: 1,
ER_TOO_MANY_KEY_PARTS: 1,
ER_TOO_MANY_KEYS: 1,
ER_TOO_MUCH_AUTO_DATETIME_COLS: 2,
ER_TOO_MUCH_AUTO_TIMESTAMP_COLS: 2,
ER_UDPATE_TOO_MUCH_ROWS: 1,
ER_USE_ENUM: 1,
ER_USE_TEXT_OR_BLOB: 2,
ER_WITH_DEFAULT_ADD_COLUMN: 1,
ER_WITH_INSERT_FIELD: 1,
ER_WITH_LIMIT_CONDITION: 1,
ER_WITH_ORDERBY_CONDITION: 1,
ErCantChangeColumn: 1,
ErCantChangeColumnPosition: 1,
ErJsonTypeSupport: 2,
ErrImplicitTypeConversion: 1,
ErrJoinNoOnCondition: 1,
ErrUseValueExpr: 1,
ErrWrongAndExpr: 1,
ErrViewSupport: 2,
ErrIncorrectDateTimeValue: 2,
ErrMaxVarcharLength: 2,
ErrMaxColumnCount: 1,
},
IncLevel: defaultLevel,
}

var globalConf = defaultConf
Expand Down
129 changes: 119 additions & 10 deletions config/config.toml.default
Original file line number Diff line number Diff line change
Expand Up @@ -115,66 +115,175 @@ max_allowed_packet = 4194304
er_alter_table_once = 1
er_auto_incr_id_warning = 1
er_autoinc_unsigned = 1
er_bad_field_error = 2
er_bad_null_error = 2
er_binlog_corrupted = 2
er_binlog_format_statement = 2
er_blob_cant_have_default = 1
er_blob_used_as_key = 2
er_cant_change_column = 1
er_cant_change_column_position = 1
er_cant_drop_database = 2
er_cant_drop_field_or_key = 2
er_cant_drop_table = 2
er_cant_remove_all_fields = 2
er_cant_set_charset = 1
er_cant_set_collation = 1
er_cant_set_engine = 1
er_change_column_type = 1
er_change_too_much_rows = 1
er_char_to_varchar_len = 1
er_charset_not_support = 2
er_charset_on_column = 1
er_collation_charset_mismatch = 2
er_collation_not_support = 2
er_column_existed = 2
er_column_have_no_comment = 1
er_datetime_default = 1
er_column_not_existed = 2
er_columns_must_have_index = 1
er_columns_must_have_index_type_err = 1
er_con_count_error = 2
er_conflicting_declarations = 2
er_data_too_long = 2
er_db_not_existed_error = 2
er_ddl_dml_coexist = 2
er_dup_fieldname = 2
er_dup_index = 2
er_dup_keyname = 2
er_end_with_commit = 2
er_end_with_semicolon = 2
er_engine_not_support = 2
er_error_exist_before = 2
er_field_not_in_group_by = 2
er_field_specified_twice = 2
er_float_double_to_decimal = 2
er_forcing_close = 2
er_foreign_key = 2
er_have_begin = 2
er_hostname = 2
er_id_is_uper = 2
er_ident_use_keyword = 1
er_identifier_lower = 2
er_identifier_upper = 2
er_implicit_type_conversion = 1
er_inc_init_err = 1
er_inception_empty_query = 2
er_incorrect_datetime_value = 2
er_incorrect_global_local_var = 2
er_index_name_idx_prefix = 1
er_index_name_uniq_prefix = 1
er_index_use_alter_table = 2
er_insert_too_much_rows = 1
er_invalid_backup_host_info = 2
er_invalid_command = 2
er_invalid_data_type = 1
er_invalid_default = 2
er_invalid_group_func_use = 2
er_invalid_ident = 1
er_mariadb_rollback_warn = 1
er_invalid_on_update = 2
er_join_no_on_condition = 1
er_json_type_support = 2
er_key_column_does_not_exits = 2
er_mariadb_rollback_warn = 1
er_max_column_count = 1
er_max_varchar_length = 2
er_mix_of_group_func_and_fields = 2
er_multiple_pri_key = 2
er_must_at_least_one_column = 2
er_must_have_columns = 1
er_columns_must_have_index = 1
er_columns_must_have_index_type_err = 1
er_net_packets_out_of_order = 2
er_net_read_error = 2
er_net_read_interrupted = 2
er_network_read_event_checksum_failure = 2
er_no_db_error = 2
er_no_where_condition = 1
er_non_uniq_error = 2
er_non_uniq_table = 2
er_normal_shutdown = 2
er_not_allowed_nullable = 1
er_not_found_master_status = 2
er_not_found_table_info = 1
er_not_supported_alter_option = 1
er_not_supported_item_type = 2
er_not_supported_key_type = 2
er_not_supported_yet = 2
er_not_valid_password = 2
er_ordery_by_rand = 1
er_osc_kill_failed = 2
er_outofmemory = 1
er_parse_error = 2
er_partition_not_allowed = 1
er_partition_not_existed = 2
er_pk_cols_not_int = 1
er_pk_too_many_parts = 1
er_primary_cant_have_null = 2
er_remote_exe_error = 2
er_removed_spaces = 2
er_repeat_const_definition = 2
er_same_name_partition = 2
er_select_only_star = 1
er_set_data_type_int_bigint = 2
er_shutdown_complete = 2
er_slave_corrupt_event = 2
er_slave_relay_log_write_failure = 2
er_sql_invalid_op_type = 2
er_sql_invalid_source = 2
er_sql_no_op_type = 2
er_sql_no_source = 2
er_start_as_begin = 2
er_syntax_error = 2
er_table_cant_handle_auto_increment = 2
er_table_charset_must_null = 1
er_table_charset_must_utf8 = 1
er_table_collation_not_support = 1
er_table_exists_error = 2
er_table_must_have_comment = 1
er_table_must_have_pk = 1
er_table_not_existed_error = 2
er_table_prefix = 1
er_temp_table_tmp_prefix = 1
er_text_not_nullable_error = 1
er_timestamp_default = 1
er_too_long_bakdb_name = 2
er_too_long_ident = 2
er_too_long_index_comment = 1
er_too_long_key = 2
er_too_many_key_parts = 1
er_too_many_keys = 1
er_too_much_auto_datetime_cols = 2
er_too_much_auto_timestamp_cols = 2
er_truncated_wrong_value = 2
er_udpate_too_much_rows = 1
er_unknown_character_set = 2
er_unknown_charset = 1
er_unknown_collation = 1
er_unknown_system_variable = 2
er_unknown_table = 2
er_use_enum = 1
er_use_index_visibility = 2
er_use_text_or_blob = 2
er_use_value_expr = 1
er_username = 2
er_varchar_to_text_len = 2
er_view_select_clause = 2
er_view_support = 2
er_with_default_add_column = 1
er_with_insert_field = 1
er_with_insert_values = 2
er_with_limit_condition = 1
er_with_orderby_condition = 1
er_use_value_expr = 1
er_wrong_and_expr = 1
er_view_support = 2
er_incorrect_datetime_value = 2
er_max_varchar_length = 2
er_max_column_count = 1
er_wrong_arguments = 2
er_wrong_auto_key = 2
er_wrong_column_name = 2
er_wrong_db_name = 2
er_wrong_key_column = 2
er_wrong_name_for_index = 2
er_wrong_string_length = 2
er_wrong_sub_key = 2
er_wrong_table_name = 2
er_wrong_usage = 2
er_wrong_value_count_on_row = 2
er_wrong_value_for_var = 2

[osc]

Expand Down
Loading

0 comments on commit 1c797cb

Please sign in to comment.