现在有办法修复一下非分区表t1的meta么?
这样试一下那:
alter table t1_partition partition p202307 placement policy rule1;
alter table t1_partition exchange partition p202307 with table t1;
就是先强制设置下partition的placement让之后的检查能通过,然后再重新 exchange partition 来修复 meta。
果然恢复了,原来是执行时候二次,没有使用表的placement policy啊。不过奇怪的是,预检测时候没问题,执行时候报错了,两者应该用同一个检测逻辑的,这样即便有问题,也是没执行前就能检测出来,不会影响表的meta信息
mysql> alter table t1_partition partition p202307 placement policy rule1;
Query OK, 0 rows affected (0.17 sec)
mysql> alter table t1_partition exchange partition p202307 with table t1;
Query OK, 0 rows affected, 1 warning (0.25 sec)
mysql> show warnings;
+---------+------+---------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------------------------------------------+
| Warning | 1105 | after the exchange, please analyze related table of the exchange to update statistics |
+---------+------+---------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from t1;
+------------+------+
| date | name |
+------------+------+
| 2023-07-02 | 0000 |
| 2023-07-03 | 0000 |
| 2023-07-04 | 0000 |
| 2023-07-05 | 0000 |
+------------+------+
4 rows in set (0.00 sec)
mysql> insert into t1(date, name) values ("2023-08-06","0000");
Query OK, 1 row affected (0.02 sec)
mysql> select * from t1;
+------------+------+
| date | name |
+------------+------+
| 2023-07-02 | 0000 |
| 2023-07-03 | 0000 |
| 2023-07-04 | 0000 |
| 2023-07-05 | 0000 |
| 2023-08-06 | 0000 |
+------------+------+
5 rows in set (0.01 sec)
此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。