On 12/1/10 7:47 PM, Mattias Jonsson wrote:
> #At file:///Users/mattiasj/mysql-bzr/b58147-55-bt/ based on
> 3158 Mattias Jonsson 2010-12-01
> 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.
OK to push. One minor suggestion below.
> @ 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.
> === modified file 'sql/ha_partition.cc'
> --- a/sql/ha_partition.cc 2010-11-26 14:32:51 +0000
> +++ b/sql/ha_partition.cc 2010-12-01 21:47:40 +0000
> @@ -3428,7 +3428,7 @@ int ha_partition::truncate()
> ALTER TABLE t TRUNCATE PARTITION ...
> -int ha_partition::truncate_partition(Alter_info *alter_info)
> +int ha_partition::truncate_partition(Alter_info *alter_info, bool *to_binlog)
Rename the variable to binlog_stmt. Sounds a bit better and its the name
already used in some other places for this same purpose.