summaryrefslogtreecommitdiff
path: root/mysql-test/r/partition_binlog.result
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2010-12-01 22:47:40 +0100
committerMattias Jonsson <mattias.jonsson@oracle.com>2010-12-01 22:47:40 +0100
commit2737a722785589eca70f4e25eaaa0d8f594462df (patch)
tree12242bd3cd9a5751c589b93eb792f9924f9d0556 /mysql-test/r/partition_binlog.result
parent45e17739d441f418fc0727ac3cc10f17c17b341e (diff)
downloadmariadb-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/r/partition_binlog.result')
-rw-r--r--mysql-test/r/partition_binlog.result56
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/r/partition_binlog.result b/mysql-test/r/partition_binlog.result
new file mode 100644
index 00000000000..8b449371d0e
--- /dev/null
+++ b/mysql-test/r/partition_binlog.result
@@ -0,0 +1,56 @@
+DROP TABLE IF EXISTS t1;
+#
+# Bug#58147: ALTER TABLE w/ TRUNCATE PARTITION fails
+# but the statement is written to binlog
+#
+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);
+ALTER TABLE t1 TRUNCATE PARTITION p1;
+ERROR HY000: Incorrect partition name
+ALTER TABLE t1 DROP PARTITION p1;
+ERROR HY000: Error in list of partitions to DROP
+# No error returned, output in table format instead:
+ALTER TABLE t1 ANALYZE PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 analyze error Error in list of partitions to test.t1
+ALTER TABLE t1 CHECK PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 check error Error in list of partitions to test.t1
+ALTER TABLE t1 OPTIMIZE PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 optimize error Error in list of partitions to test.t1
+ALTER TABLE t1 REPAIR PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 repair error Error in list of partitions to test.t1
+ALTER TABLE t1 ANALYZE PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+ALTER TABLE t1 CHECK PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+ALTER TABLE t1 REPAIR PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+ALTER TABLE t1 TRUNCATE PARTITION p0;
+ALTER TABLE t1 DROP PARTITION p0;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id INT)
+PARTITION BY RANGE (id)
+(PARTITION p0 VALUES LESS THAN (100),
+PARTITION pmax VALUES LESS THAN (MAXVALUE))
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1), (10), (100), (1000)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 ANALYZE PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 OPTIMIZE PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 REPAIR PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 TRUNCATE PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 DROP PARTITION p0
+DROP TABLE t1;