Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持添加分区 #281

Closed
xiaozhute opened this issue Nov 20, 2020 · 7 comments
Closed

不支持添加分区 #281

xiaozhute opened this issue Nov 20, 2020 · 7 comments
Labels
wontfix This will not be worked on

Comments

@xiaozhute
Copy link

xiaozhute commented Nov 20, 2020

描述
请问,不支持分区表的分区添加语句吗?

重现

  • 创建分区表
create table testpar(
    id int unsigned not null auto_increment comment 'id',
    a varchar(10) comment 'a',
    buss_day varchar(8) comment 'day',
    primary key (id,buss_day)
) comment '分区表'
partition by list columns (buss_day)
(
    partition p1 values in('20200101'),
    partition p2 values in('20200102'),
    partition p3 values in('20200103')
    )
  • 添加分区
-- 添加单个或多个都告知不支持
alter table testpar add partition (
    partition p4 values in('20200104'),
    partition p5 values in('20200105'),
    partition p6 values in('20200106')
    );
  • 出现错误
| order_id |  stage  | error_level |   stage_status  |         error_message         |
2     | CHECKED |      2      | Audit Completed | Not supported statement type.

环境

  • 数据库: [mysql]
  • 版本: [例如 5.6.43]

参数

  • 测试脚本:python
sql = '''/*--user=testa;--password=123456;--host=xxx.xxx.xx.xx;--port=3306;--execute=1;--backup=1;*/
inception_magic_start;
use testa;
alter table testpar add partition (
    partition p4 values in('20200104')
    );
inception_magic_commit;'''
@hanchuanchuan
Copy link
Owner

支持. 需要自行开启.
参数 enable_partition_table 可以控制是否允许分区表.
#50

@xiaozhute
Copy link
Author

xiaozhute commented Nov 23, 2020

版本:goInception-linux-amd64-v1.2.3.tar.gz
环境:CentOS Linux release 7.6.1810 (Core)

goInception 配置部分如下,测试结果显示“Not supported statement type.”,加不加enable_partition_table参数,都显示不支持

[inc]

backup_host = "127.0.0.1"
backup_port = 3306
backup_user = "goinc_root"
backup_password = "xxxxxx"

enable_nullable = true
enable_drop_table = false
enable_set_engine = true
enable_change_column = true

check_timestamp_count = true
check_table_comment = false
check_column_comment = false
check_column_type_change = true
index_prefix = "idx_"
uniq_index_prefix = "uniq_"
table_prefix = ""
explain_rule = "first"
sql_safe_updates = -1
support_charset = "utf8,utf8mb4"
support_engine = "innodb"
lang = "en-US"
enable_partition_table = true

日志如下:

time="2020/11/23 11:32:31.994" level=debug msg="con:1 ActivePendingTxn SET AUTOCOMMIT = 0" file=adapter.go func=buildExecutor line=278
time="2020/11/23 11:32:31.995" level=debug msg="con:1 autocommit=0" file=set.go func=setSysVariable line=180
time="2020/11/23 11:32:32.040" level=debug msg=checkBinlogIsOn file=session_inception.go func=checkBinlogIsOn line=1891
time="2020/11/23 11:32:32.049" level=debug msg=mysqlServerVersion file=session_inception.go func=mysqlServerVersion line=1659
time="2020/11/23 11:32:32.057" level=debug msg="db version: 50643" file=session_inception.go func=mysqlServerVersion line=1710
time="2020/11/23 11:32:32.057" level=debug msg=setSqlSafeUpdates file=session_inception.go func=setSqlSafeUpdates line=1869
time="2020/11/23 11:32:32.057" level=debug msg=processCommand file=session_inception.go func=processCommand line=561
time="2020/11/23 11:32:32.057" level=debug msg=checkChangeDB file=session_inception.go func=checkChangeDB line=5935
time="2020/11/23 11:32:32.072" level=debug msg=processCommand file=session_inception.go func=processCommand line=561
time="2020/11/23 11:32:32.072" level=debug msg=checkAlterTable file=session_inception.go func=checkAlterTable line=2957
time="2020/11/23 11:32:32.103" level=info msg="con:1 未定义的解析: 16" file=session_inception.go func=checkAlterTable line=3097
time="2020/11/23 11:32:32.105" level=info msg="con:1 close connection" file=server.go func=func1 line=320

@xiaozhute
Copy link
Author

支持. 需要自行开启.
参数 enable_partition_table 可以控制是否允许分区表.
#50

抽空可以测试看看,每次测试都能复现

@hanchuanchuan
Copy link
Owner

之前仅添加了create table中的分区设置, 所以alter table失败了.
该问题已优化, 可以升级到 v1.2.3-52 及之后的版本.

@xiaozhute
Copy link
Author

之前仅添加了create table中的分区设置, 所以alter table失败了.
该问题已优化, 可以升级到 v1.2.3-52 及之后的版本.

新的问题,可批量添加,但无法合并批量删除分区
版本:goInception-linux-v1.2.3-52-gfeccee1.tar.gz
环境:CentOS Linux release 7.6.1810 (Core)
goInception 配置同上,不变
测试语句:

# 添加单个分区  【OK】
alter table testpar add partition (
    partition p4 values in('20200104')
);

# 合并添加多个分区 【OK】
alter table testpar add partition (
    partition p5 values in('20200105'),
    partition p6 values in('20200106')
    );

# 删除单个分区 【OK】
alter table testpar drop partition p5;

# 合并删除多个分区 【You have an error in your SQL syntax, near 'p6' at line 1】
alter table testpar drop partition p5,p6;

日志如下:

time="2020/11/26 09:56:42.934" level=info msg="con:8 new connection 127.0.0.1:45826" file=server.go func=onConn line=319
time="2020/11/26 09:56:42.935" level=debug msg="con:0 ActivePendingTxn select HIGH_PRIORITY * from mysql.global_variables where variable_name in ('autocommit', 'sql_mode', 'max_allowed_packet', 'time_zone', 'block_encryption_mode', 'tidb_skip_utf8_check', 'tidb_index_join_batch_size', 'tidb_index_lookup_size', 'tidb_index_lookup_concurrency', 'tidb_index_lookup_join_concurrency', 'tidb_index_serial_scan_concurrency', 'tidb_hash_join_concurrency', 'tidb_projection_concurrency', 'tidb_hashagg_partial_concurrency', 'tidb_hashagg_final_concurrency', 'tidb_backoff_lock_fast', 'tidb_constraint_check_in_place', 'tidb_ddl_reorg_worker_cnt', 'tidb_opt_insubquery_unfold', 'tidb_distsql_scan_concurrency', 'tidb_max_chunk_size', 'tidb_enable_cascades_planner', 'tidb_retry_limit', 'tidb_disable_txn_auto_retry')" file=adapter.go func=buildExecutor line=278
time="2020/11/26 09:56:42.936" level=debug msg="con:8 ActivePendingTxn SET AUTOCOMMIT = 0" file=adapter.go func=buildExecutor line=278
time="2020/11/26 09:56:42.936" level=debug msg="con:8 autocommit=0" file=set.go func=setSysVariable line=180
time="2020/11/26 09:56:42.984" level=debug msg=checkBinlogIsOn file=session_inception.go func=checkBinlogIsOn line=1916
time="2020/11/26 09:56:42.994" level=debug msg=mysqlServerVersion file=session_inception.go func=mysqlServerVersion line=1654
time="2020/11/26 09:56:43.002" level=debug msg="db version: 50643" file=session_inception.go func=mysqlServerVersion line=1705
time="2020/11/26 09:56:43.002" level=debug msg=setSqlSafeUpdates file=session_inception.go func=setSqlSafeUpdates line=1874
time="2020/11/26 09:56:43.002" level=debug msg=setLockWaitTimeout file=session_inception.go func=setLockWaitTimeout line=1896
time="2020/11/26 09:56:43.002" level=debug msg=processCommand file=session_inception.go func=processCommand line=551
time="2020/11/26 09:56:43.002" level=debug msg=checkChangeDB file=session_inception.go func=checkChangeDB line=6120
time="2020/11/26 09:56:43.019" level=error msg="con:8 解析失败! You have an error in your SQL syntax, near 'p6' at line 1" file=session_inception.go func=executeInc line=217
time="2020/11/26 09:56:43.019" level=error msg="alter table testpar drop partition p5,p6" file=session_inception.go func=executeInc line=218
time="2020/11/26 09:56:43.021" level=info msg="con:8 close connection" file=server.go func=func1 line=321

hanchuanchuan added a commit that referenced this issue Nov 28, 2020
@hanchuanchuan
Copy link
Owner

之前的语法解析器不支持同时删除多分区语法.
该问题已优化, 可以升级到 v1.2.3-55 及之后的版本

@stale
Copy link

stale bot commented Dec 12, 2020

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants