mariadb/mysql-test/main/partition_binlog.test
Aleksey Midenkov d324c03d0c Vanilla cleanups and refactorings
Dead code cleanup:

part_info->num_parts usage was wrong and working incorrectly in
mysql_drop_partitions() because num_parts is already updated in
prep_alter_part_table(). We don't have to update part_info->partitions
because part_info is destroyed at alter_partition_lock_handling().

Cleanups:

- DBUG_EVALUATE_IF() macro replaced by shorter form DBUG_IF();
- Typo in ER_KEY_COLUMN_DOES_NOT_EXITS.

Refactorings:

- Splitted write_log_replace_delete_frm() into write_log_delete_frm()
  and write_log_replace_frm();
- partition_info via DDL_LOG_STATE;
- set_part_info_exec_log_entry() removed.

DBUG_EVALUATE removed

DBUG_EVALUTATE was only added for consistency together with
DBUG_EVALUATE_IF. It is not used anywhere in the code.

DBUG_SUICIDE() fix on release build

On release DBUG_SUICIDE() was statement. It was wrong as
DBUG_SUICIDE() is used in expression context.
2021-10-26 17:07:46 +02:00

43 lines
1.2 KiB
Text

--source include/have_log_bin.inc
--source include/have_partition.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo #
--echo # Bug#58147: ALTER TABLE w/ TRUNCATE PARTITION fails
--echo # but the statement is written to binlog
--echo #
CREATE TABLE t1(id INT)
PARTITION BY RANGE (id)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION pmax VALUES LESS THAN (MAXVALUE));
INSERT INTO t1 VALUES (1), (10), (100), (1000);
--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_UNKNOWN_PARTITION
ALTER TABLE t1 TRUNCATE PARTITION p1;
--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION p1;
--echo # No error returned, output in table format instead:
ALTER TABLE t1 ANALYZE PARTITION p1;
ALTER TABLE t1 CHECK PARTITION p1;
ALTER TABLE t1 OPTIMIZE PARTITION p1;
ALTER TABLE t1 REPAIR PARTITION p1;
ALTER TABLE t1 ANALYZE PARTITION p0;
ALTER TABLE t1 CHECK PARTITION p0;
ALTER TABLE t1 OPTIMIZE PARTITION p0;
ALTER TABLE t1 REPAIR PARTITION p0;
ALTER TABLE t1 TRUNCATE PARTITION p0;
ALTER TABLE t1 DROP PARTITION p0;
--source include/show_binlog_events.inc
DROP TABLE t1;