diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2010-12-01 22:47:40 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2010-12-01 22:47:40 +0100 |
commit | 2737a722785589eca70f4e25eaaa0d8f594462df (patch) | |
tree | 12242bd3cd9a5751c589b93eb792f9924f9d0556 /mysql-test/t/partition_binlog.test | |
parent | 45e17739d441f418fc0727ac3cc10f17c17b341e (diff) | |
download | mariadb-git-2737a722785589eca70f4e25eaaa0d8f594462df.tar.gz |
Bug#58147: ALTER TABLE w/ TRUNCATE PARTITION fails
but the statement is written to binlog
TRUNCATE PARTITION was written to the binlog
even if it failed before calling any partition's
truncate function.
Solved by adding an argument to truncate_partition,
to flag if it should be written to the binlog or not.
It should be written to the binlog when a call to any
partitions truncate function is done.
mysql-test/r/partition_binlog.result:
New result file
mysql-test/t/partition_binlog.test:
New test file, including DROP PARTITION binlog test
sql/ha_partition.cc:
Added argument to avoid binlogging failed truncate_partition that
have not yet changed any data.
sql/ha_partition.h:
Added argument to avoid excessive binlogging
sql/sql_partition_admin.cc:
Avoid to binlog TRUNCATE PARTITION if it fails before
any partition has tried to truncate.
Diffstat (limited to 'mysql-test/t/partition_binlog.test')
-rw-r--r-- | mysql-test/t/partition_binlog.test | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/t/partition_binlog.test b/mysql-test/t/partition_binlog.test new file mode 100644 index 00000000000..432cdc922d6 --- /dev/null +++ b/mysql-test/t/partition_binlog.test @@ -0,0 +1,42 @@ +--source include/have_log_bin.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 # + +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1) + +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); + +--error ER_WRONG_PARTITION_NAME +ALTER TABLE t1 TRUNCATE PARTITION p1; +--error ER_DROP_PARTITION_NON_EXISTENT +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; |