From: Mattias Jonsson Date: April 13 2012 10:30am Subject: bzr push into mysql-trunk branch (mattias.jonsson:3877) WL#4443 List-Archive: http://lists.mysql.com/commits/143487 Message-Id: <201204131030.q3DAUef0031426@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3877 Mattias Jonsson 2012-04-13 [merge] WL#4443 merged into latest mysql-trunk added: mysql-test/collections/mysql-trunk-wl4443.push mysql-test/r/partition_locking.result mysql-test/t/partition_locking.test modified: include/my_bitmap.h mysql-test/include/commit.inc mysql-test/include/handler.inc mysql-test/r/commit_1innodb.result mysql-test/r/explain.result mysql-test/r/grant_cache_no_prot.result mysql-test/r/handler_innodb.result mysql-test/r/handler_myisam.result mysql-test/r/innodb_explain_json_non_select_all.result mysql-test/r/innodb_explain_json_non_select_none.result mysql-test/r/innodb_explain_non_select_all.result mysql-test/r/innodb_explain_non_select_none.result mysql-test/r/myisam_explain_json_non_select_all.result mysql-test/r/myisam_explain_json_non_select_none.result mysql-test/r/myisam_explain_non_select_all.result mysql-test/r/myisam_explain_non_select_none.result mysql-test/r/partition_binlog.result mysql-test/r/partition_datatype.result mysql-test/r/partition_error.result mysql-test/r/partition_explicit_prune.result mysql-test/r/partition_pruning.result mysql-test/r/partition_truncate.result mysql-test/r/type_date.result mysql-test/suite/binlog/r/binlog_unsafe.result mysql-test/suite/innodb/r/innodb_corrupt_bit.result mysql-test/suite/innodb/t/innodb_corrupt_bit.test mysql-test/suite/opt_trace/r/bugs_no_prot_all.result mysql-test/suite/opt_trace/r/bugs_no_prot_none.result mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result mysql-test/suite/opt_trace/r/range_no_prot.result mysql-test/suite/opt_trace/r/range_ps_prot.result mysql-test/suite/parts/inc/partition-dml-1-9.inc mysql-test/suite/parts/r/partition-dml-1-9-innodb.result mysql-test/suite/parts/r/partition-dml-1-9-myisam.result mysql-test/suite/perfschema/r/part_table_io.result mysql-test/suite/perfschema/r/stage_mdl_function.result mysql-test/suite/rpl/r/rpl_parallel_change_master.result mysql-test/t/explain.test mysql-test/t/handler_myisam.test mysql-test/t/partition_binlog.test mysql-test/t/partition_explicit_prune.test mysql-test/t/partition_pruning.test mysql-test/t/partition_truncate.test mysql-test/t/type_date.test mysys/my_bitmap.c sql/event_db_repository.cc sql/filesort.cc sql/ha_partition.cc sql/ha_partition.h sql/handler.cc sql/handler.h sql/item.cc sql/item.h sql/item_cmpfunc.cc sql/item_row.cc sql/item_strfunc.cc sql/item_strfunc.h sql/item_subselect.cc sql/log_event.cc sql/log_event_old.cc sql/opt_explain.cc sql/opt_range.cc sql/opt_range.h sql/opt_sum.cc sql/partition_info.cc sql/partition_info.h sql/rpl_info_table_access.cc sql/share/errmsg-utf8.txt sql/sp.cc sql/sql_acl.cc sql/sql_base.cc sql/sql_base.h sql/sql_cache.h sql/sql_class.cc sql/sql_class.h sql/sql_delete.cc sql/sql_executor.cc sql/sql_handler.cc sql/sql_help.cc sql/sql_insert.cc sql/sql_insert.h sql/sql_join_buffer.cc sql/sql_lex.cc sql/sql_lex.h sql/sql_optimizer.cc sql/sql_parse.cc sql/sql_parse.h sql/sql_partition.cc sql/sql_partition_admin.cc sql/sql_prepare.cc sql/sql_resolver.cc sql/sql_select.cc sql/sql_select.h sql/sql_show.cc sql/sql_tmp_table.cc sql/sql_union.cc sql/sql_update.cc sql/sql_view.cc sql/table.cc sql/table.h sql/tztime.cc storage/innobase/handler/ha_innodb.cc unittest/gunit/my_bitmap-t.cc === modified file 'mysql-test/include/function_defaults.inc' --- a/mysql-test/include/function_defaults.inc revid:mattias.jonsson@stripped +++ b/mysql-test/include/function_defaults.inc revid:mattias.jonsson@stripped @@ -1107,3 +1107,60 @@ WHERE t1.a = 1 AND t1.ts >= '2000-09-28 SELECT b FROM t1; DROP TABLE t1, t2; + +--echo # +--echo # Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +--echo # CURRENT_TIMESTAMP INSERTS ZERO +--echo # +SET timestamp = 1000; + +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); + +eval ALTER TABLE t1 ADD COLUMN a6 $datetime DEFAULT $now ON UPDATE $now FIRST; +eval ALTER TABLE t1 ADD COLUMN a5 $datetime DEFAULT $now FIRST; +eval ALTER TABLE t1 ADD COLUMN a4 $datetime ON UPDATE $now FIRST; + +eval ALTER TABLE t1 ADD COLUMN a3 $timestamp DEFAULT $now ON UPDATE $now FIRST; +eval ALTER TABLE t1 ADD COLUMN a2 $timestamp DEFAULT $now FIRST; +eval ALTER TABLE t1 ADD COLUMN a1 $timestamp ON UPDATE $now FIRST; + +eval ALTER TABLE t1 ADD COLUMN c1 $timestamp ON UPDATE $now AFTER b; +eval ALTER TABLE t1 ADD COLUMN c2 $timestamp DEFAULT $now AFTER c1; +eval ALTER TABLE t1 ADD COLUMN c3 $timestamp DEFAULT $now ON UPDATE $now AFTER c2; + +eval ALTER TABLE t1 ADD COLUMN c4 $datetime ON UPDATE $now AFTER c3; +eval ALTER TABLE t1 ADD COLUMN c5 $datetime DEFAULT $now AFTER c4; +eval ALTER TABLE t1 ADD COLUMN c6 $datetime DEFAULT $now ON UPDATE $now AFTER c5; + +SELECT * FROM t1; + +DROP TABLE t1; + + +eval CREATE TABLE t1 ( a $timestamp DEFAULT $now, b $datetime DEFAULT $now ); +INSERT INTO t1 VALUES (); + +SET timestamp = 1000000000; + +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); + +SELECT * FROM t1; + +DROP TABLE t1; + + +eval CREATE TABLE t1 ( + a $timestamp DEFAULT '1999-12-01 11:22:33', + b $datetime DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); + +eval ALTER TABLE t1 MODIFY COLUMN a $timestamp DEFAULT $now; +eval ALTER TABLE t1 MODIFY COLUMN b $datetime DEFAULT $now; +INSERT INTO t1 VALUES (); + +SELECT * FROM t1; + +DROP TABLE t1; === modified file 'mysql-test/r/function_defaults.result' --- a/mysql-test/r/function_defaults.result revid:mattias.jonsson@stripped +++ b/mysql-test/r/function_defaults.result revid:mattias.jonsson@stripped @@ -1488,6 +1488,51 @@ b 1 DROP TABLE t1, t2; # +# Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +# CURRENT_TIMESTAMP INSERTS ZERO +# +SET timestamp = 1000; +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN a6 DATETIME DEFAULT NOW() ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a5 DATETIME DEFAULT NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a4 DATETIME ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a3 TIMESTAMP DEFAULT NOW() ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a2 TIMESTAMP DEFAULT NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a1 TIMESTAMP ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN c1 TIMESTAMP ON UPDATE NOW() AFTER b; +ALTER TABLE t1 ADD COLUMN c2 TIMESTAMP DEFAULT NOW() AFTER c1; +ALTER TABLE t1 ADD COLUMN c3 TIMESTAMP DEFAULT NOW() ON UPDATE NOW() AFTER c2; +ALTER TABLE t1 ADD COLUMN c4 DATETIME ON UPDATE NOW() AFTER c3; +ALTER TABLE t1 ADD COLUMN c5 DATETIME DEFAULT NOW() AFTER c4; +ALTER TABLE t1 ADD COLUMN c6 DATETIME DEFAULT NOW() ON UPDATE NOW() AFTER c5; +SELECT * FROM t1; +a1 a2 a3 a4 a5 a6 b c1 c2 c3 c4 c5 c6 +0000-00-00 00:00:00 1970-01-01 03:16:40 1970-01-01 03:16:40 NULL 1970-01-01 03:16:40 1970-01-01 03:16:40 1 0000-00-00 00:00:00 1970-01-01 03:16:40 1970-01-01 03:16:40 NULL 1970-01-01 03:16:40 1970-01-01 03:16:40 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP DEFAULT NOW(), b DATETIME DEFAULT NOW() ); +INSERT INTO t1 VALUES (); +SET timestamp = 1000000000; +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); +SELECT * FROM t1; +a b +1970-01-01 03:16:40.000 1970-01-01 03:16:40.000 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP DEFAULT '1999-12-01 11:22:33', +b DATETIME DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP DEFAULT NOW(); +ALTER TABLE t1 MODIFY COLUMN b DATETIME DEFAULT NOW(); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a b +1999-12-01 11:22:33 1999-12-01 11:22:33 +2001-09-09 04:46:40 2001-09-09 04:46:40 +DROP TABLE t1; +# # Function defaults run 2. Six digits scale on seconds precision. # SET TIME_ZONE = "+00:00"; @@ -2973,3 +3018,48 @@ SELECT b FROM t1; b 1 DROP TABLE t1, t2; +# +# Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +# CURRENT_TIMESTAMP INSERTS ZERO +# +SET timestamp = 1000; +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN a6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a5 DATETIME(6) DEFAULT NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a4 DATETIME(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a3 TIMESTAMP(6) DEFAULT NOW(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a2 TIMESTAMP(6) DEFAULT NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a1 TIMESTAMP(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN c1 TIMESTAMP(6) ON UPDATE NOW(6) AFTER b; +ALTER TABLE t1 ADD COLUMN c2 TIMESTAMP(6) DEFAULT NOW(6) AFTER c1; +ALTER TABLE t1 ADD COLUMN c3 TIMESTAMP(6) DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c2; +ALTER TABLE t1 ADD COLUMN c4 DATETIME(6) ON UPDATE NOW(6) AFTER c3; +ALTER TABLE t1 ADD COLUMN c5 DATETIME(6) DEFAULT NOW(6) AFTER c4; +ALTER TABLE t1 ADD COLUMN c6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c5; +SELECT * FROM t1; +a1 a2 a3 a4 a5 a6 b c1 c2 c3 c4 c5 c6 +0000-00-00 00:00:00.000000 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 NULL 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 1 0000-00-00 00:00:00.000000 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 NULL 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) DEFAULT NOW(6), b DATETIME(6) DEFAULT NOW(6) ); +INSERT INTO t1 VALUES (); +SET timestamp = 1000000000; +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); +SELECT * FROM t1; +a b +1970-01-01 03:16:40.000 1970-01-01 03:16:40.000 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) DEFAULT '1999-12-01 11:22:33', +b DATETIME(6) DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(6) DEFAULT NOW(6); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(6) DEFAULT NOW(6); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a b +1999-12-01 11:22:33.000000 1999-12-01 11:22:33.000000 +2001-09-09 04:46:40.000000 2001-09-09 04:46:40.000000 +DROP TABLE t1; === modified file 'mysql-test/r/partition_exchange.result' --- a/mysql-test/r/partition_exchange.result revid:mattias.jonsson@stripped +++ b/mysql-test/r/partition_exchange.result revid:mattias.jonsson@stripped @@ -1,5 +1,366 @@ DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp; # +# Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF +# ROW_FORMAT WAS SET EXPLICITLY +# +# Same definition (both have ROW_FORMAT set) +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT=COMPACT +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 REMOVE PARTITIONING; +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT +DROP TABLE t2; +# Only the partitioned table have ROW_FORMAT set. +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS +# Only the non partitioned table have ROW_FORMAT set. +DROP TABLE t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = COMPACT; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT +# No table have ROW_FORMAT set. +DROP TABLE t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS +# Not same ROW_FORMAT as default (but same). +DROP TABLE t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Redundant +CREATE_OPTIONS row_format=REDUNDANT partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Redundant +CREATE_OPTIONS row_format=REDUNDANT +# Not same ROW_FORMAT as default (tables differs). +DROP TABLE t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Redundant +CREATE_OPTIONS row_format=REDUNDANT +# Different than default (forced ROW_TYPE) +DROP TABLE t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = COMPACT +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +year year(2) DEFAULT NULL, +modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +/*!50100 PARTITION BY HASH (id) +PARTITIONS 2 */ +SHOW CREATE TABLE t2; +Table t2 +Create Table CREATE TABLE `t2` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `year` year(2) DEFAULT NULL, + `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +TABLE_NAME t1 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Compact +CREATE_OPTIONS row_format=COMPACT partitioned +TABLE_NAME t2 +TABLE_TYPE BASE TABLE +ENGINE InnoDB +ROW_FORMAT Redundant +CREATE_OPTIONS row_format=REDUNDANT +DROP TABLE t1, t2; +# # Bug#56484: !table || (!table->read_set || # bitmap_is_set(table->read_set, field_index)) # === modified file 'mysql-test/suite/parts/r/partition_exch_qa_12.result' --- a/mysql-test/suite/parts/r/partition_exch_qa_12.result revid:mattias.jonsson@stripped +++ b/mysql-test/suite/parts/r/partition_exch_qa_12.result revid:mattias.jonsson@stripped @@ -101,8 +101,12 @@ a b 9 Nine ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; ERROR HY000: Tables have different definitions +SELECT TABLE_NAME, ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' +AND TABLE_NAME IN ('tp', 't_100'); +TABLE_NAME ROW_FORMAT +t_100 Dynamic +tp Dynamic ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t_100; -ERROR HY000: Tables have different definitions ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t_1000; ERROR HY000: Non matching attribute 'MAX_ROWS' between partition and table DROP TABLE IF EXISTS t_10; === modified file 'mysql-test/suite/parts/t/partition_exch_qa_12.test' --- a/mysql-test/suite/parts/t/partition_exch_qa_12.test revid:mattias.jonsson@stripped +++ b/mysql-test/suite/parts/t/partition_exch_qa_12.test revid:mattias.jonsson@stripped @@ -164,7 +164,8 @@ SELECT * FROM tsp_04; ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; #--error ER_TABLES_DIFFERENT_METADATA #ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10 IGNORE; ---error ER_TABLES_DIFFERENT_METADATA +SELECT TABLE_NAME, ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' +AND TABLE_NAME IN ('tp', 't_100'); ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t_100; #--error ER_TABLES_DIFFERENT_METADATA #ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t_100 IGNORE; === added file 'mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result' --- a/mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result revid:mattias.jonsson@stripped @@ -0,0 +1,35 @@ +SET @start_global_value = @@session.transaction_allow_batching; +SELECT @start_global_value as "Should be off by default"; +Should be off by default +0 +select @@global.transaction_allow_batching; +ERROR HY000: Variable 'transaction_allow_batching' is a SESSION variable +select @@session.transaction_allow_batching; +@@session.transaction_allow_batching +0 +show global variables like 'transaction_allow_batching'; +Variable_name Value +show session variables like 'transaction_allow_batching'; +Variable_name Value +transaction_allow_batching OFF +select * from information_schema.global_variables where variable_name='transaction_allow_batching'; +VARIABLE_NAME VARIABLE_VALUE +select * from information_schema.session_variables where variable_name='transaction_allow_batching'; +VARIABLE_NAME VARIABLE_VALUE +TRANSACTION_ALLOW_BATCHING OFF +set global transaction_allow_batching = 1; +ERROR HY000: Variable 'transaction_allow_batching' is a SESSION variable and can't be used with SET GLOBAL +set session transaction_allow_batching = TRUE; +select @@session.transaction_allow_batching; +@@session.transaction_allow_batching +1 +set transaction_allow_batching=1.1; +ERROR 42000: Incorrect argument type to variable 'transaction_allow_batching' +set transaction_allow_batching=1e1; +ERROR 42000: Incorrect argument type to variable 'transaction_allow_batching' +set transaction_allow_batching="foobar"; +ERROR 42000: Variable 'transaction_allow_batching' can't be set to the value of 'foobar' +set session transaction_allow_batching = @start_global_value; +select @@session.transaction_allow_batching; +@@session.transaction_allow_batching +0 === added file 'mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test' --- a/mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test revid:mattias.jonsson@stripped @@ -0,0 +1,44 @@ +--source include/not_embedded.inc + +SET @start_global_value = @@session.transaction_allow_batching; +SELECT @start_global_value as "Should be off by default"; + +# +# exists as session only +# +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@global.transaction_allow_batching; +select @@session.transaction_allow_batching; +show global variables like 'transaction_allow_batching'; +show session variables like 'transaction_allow_batching'; +select * from information_schema.global_variables where variable_name='transaction_allow_batching'; +select * from information_schema.session_variables where variable_name='transaction_allow_batching'; + +# +# show that it is writable +# +--error ER_LOCAL_VARIABLE +set global transaction_allow_batching = 1; +set session transaction_allow_batching = TRUE; +select @@session.transaction_allow_batching; + +# +# incorrect assignments +# +--error ER_WRONG_TYPE_FOR_VAR +set transaction_allow_batching=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set transaction_allow_batching=1e1; +--error ER_WRONG_VALUE_FOR_VAR +set transaction_allow_batching="foobar"; + + +# +# restore original value +# +set session transaction_allow_batching = @start_global_value; +select @@session.transaction_allow_batching; + +# +# See ndb_sql_transaction_allow_batching.test for a comprehensive test case. +# === modified file 'mysql-test/t/partition_exchange.test' --- a/mysql-test/t/partition_exchange.test revid:mattias.jonsson@stripped +++ b/mysql-test/t/partition_exchange.test revid:mattias.jonsson@stripped @@ -6,6 +6,180 @@ DROP TABLE IF EXISTS t1, t2, t3, t, tp, --enable_warnings --echo # +--echo # Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF +--echo # ROW_FORMAT WAS SET EXPLICITLY +--echo # + +--echo # Same definition (both have ROW_FORMAT set) +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT=COMPACT +PARTITION BY HASH (id) +PARTITIONS 2; + +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 REMOVE PARTITIONING; + +--vertical_results +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +DROP TABLE t2; + +--echo # Only the partitioned table have ROW_FORMAT set. +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB; + +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +--echo # Only the non partitioned table have ROW_FORMAT set. +DROP TABLE t1, t2; +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = COMPACT; + +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +--echo # No table have ROW_FORMAT set. +DROP TABLE t1, t2; +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB; + +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +--echo # Not same ROW_FORMAT as default (but same). +DROP TABLE t1, t2; +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; + +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +--echo # Not same ROW_FORMAT as default (tables differs). +DROP TABLE t1, t2; +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; + +--error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); + +--echo # Different than default (forced ROW_TYPE) +DROP TABLE t1, t2; +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = COMPACT +PARTITION BY HASH (id) +PARTITIONS 2; +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + year year(2) DEFAULT NULL, + modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (id) +) ENGINE=InnoDB ROW_FORMAT = REDUNDANT; + +--error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2'); +--horizontal_results +DROP TABLE t1, t2; + +--echo # --echo # Bug#56484: !table || (!table->read_set || --echo # bitmap_is_set(table->read_set, field_index)) --echo # === modified file 'sql/sql_partition_admin.cc' --- a/sql/sql_partition_admin.cc revid:mattias.jonsson@stripped +++ b/sql/sql_partition_admin.cc revid:mattias.jonsson@stripped @@ -196,6 +196,19 @@ static bool compare_table_with_partition part_create_info.auto_increment_value= table_create_info.auto_increment_value; + /* Check compatible row_types and set create_info accordingly. */ + { + enum row_type part_row_type= part_table->file->get_row_type(); + enum row_type table_row_type= table->file->get_row_type(); + if (part_row_type != table_row_type) + { + my_error(ER_PARTITION_EXCHANGE_DIFFERENT_OPTION, MYF(0), + "ROW_FORMAT"); + DBUG_RETURN(true); + } + part_create_info.row_type= table->s->row_type; + } + /* NOTE: ha_blackhole does not support check_if_compatible_data, so this always fail for blackhole tables. @@ -215,6 +228,10 @@ static bool compare_table_with_partition my_error(ER_TABLES_DIFFERENT_METADATA, MYF(0)); DBUG_RETURN(TRUE); } + DBUG_ASSERT(table->s->db_create_options == + part_table->s->db_create_options); + DBUG_ASSERT(table->s->db_options_in_use == + part_table->s->db_options_in_use); if (table_create_info.avg_row_length != part_create_info.avg_row_length) { === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc revid:mattias.jonsson@stripped +++ b/sql/sql_table.cc revid:mattias.jonsson@stripped @@ -7825,6 +7825,20 @@ copy_data_between_tables(TABLE *from,TAB copy_ptr->do_copy(copy_ptr); } prev_insert_id= to->file->next_insert_id; + + /* Set the function defaults. */ + List_iterator iter(create); + for (uint i= 0; i < to->s->fields; ++i) + { + const Create_field *definition= iter++; + if (definition->field == NULL) // this column didn't exist in old table. + { + Field *column= to->field[i]; + if (column->has_insert_default_function()) + column->evaluate_insert_default_function(); + } + } + error=to->file->ha_write_row(to->record[0]); to->auto_increment_field_not_null= FALSE; if (error) === modified file 'sql/sys_vars.cc' --- a/sql/sys_vars.cc revid:mattias.jonsson@stripped +++ b/sql/sys_vars.cc revid:mattias.jonsson@stripped @@ -3056,6 +3056,11 @@ static Sys_var_mybool Sys_log_binlog( DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_sql_log_bin), ON_UPDATE(fix_sql_log_bin_after_update)); +static Sys_var_bit Sys_transaction_allow_batching( + "transaction_allow_batching", "transaction_allow_batching", + SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_ALLOW_BATCH, + DEFAULT(FALSE)); + static Sys_var_bit Sys_sql_warnings( "sql_warnings", "sql_warnings", SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS, === modified file 'storage/ndb/compile-cluster' --- a/storage/ndb/compile-cluster revid:mattias.jonsson@stripped +++ b/storage/ndb/compile-cluster revid:mattias.jonsson@stripped @@ -31,24 +31,31 @@ use Getopt::Long; # thus acting like a filter and passing all other arguments # straight through my $opt_debug; +my $opt_build_type; +my $opt_build = 1; +my $opt_just_print; + Getopt::Long::Configure("pass_through"); GetOptions( # Build MySQL Server and NDB with debug - 'debug' => \$opt_debug, + 'debug!' => \$opt_debug, 'with-debug:s' => sub { $opt_debug = 1; }, - + 'build-type=s' => \$opt_build_type, + 'build!' => \$opt_build, + 'c|just-configure' => sub { $opt_build = 0; }, + 'n|just-print' => \$opt_just_print, ) or exit(1); # Find source root directory, assume this script is # in /storage/ndb/ -my $srcdir = dirname(dirname(dirname(abs_path($0)))); -die unless -d $srcdir; # Sanity check that the srcdir exist +my $opt_srcdir = dirname(dirname(dirname(abs_path($0)))); +die unless -d $opt_srcdir; # Sanity check that the srcdir exist if ($^O eq "cygwin") { # Convert posix path to Windows mixed path since cmake # is most likely a windows binary - $srcdir= `cygpath -m $srcdir`; - chomp $srcdir; + $opt_srcdir= `cygpath -m $opt_srcdir`; + chomp $opt_srcdir; } # Check that cmake exists and figure out it's version @@ -61,7 +68,7 @@ my $cmake_version_id; { #print "1: $1 2: $2 3: $3\n"; $cmake_version_id= $1*10000 + $2*100 + $3; - print "cmake_version_id: $cmake_version_id\n"; + #print "cmake_version_id: $cmake_version_id\n"; } die "Could not parse cmake version" unless ($cmake_version_id); } @@ -71,37 +78,244 @@ my $cmake_version_id; # Configure # { + # Remove old CMakeCache.txt(ignore if not exists) to + # force fresh configure + unlink("CMakeCache.txt"); + my @args; - push(@args, "$srcdir/cmake/configure.pl"); - - # MySQL Server options - push(@args, "--with-ssl"); + + # Hardcoded options controlling how to build MySQL Server + push(@args, "-DWITH_SSL=bundled"); if ($opt_debug) { - push(@args, "--with-debug"); - push(@args, "--disable-mysql-maintainer-mode"); + push(@args, "-DWITH_DEBUG=1"); + push(@args, "-DMYSQL_MAINTAINER_MODE=0"); } - # NDB options - push(@args, "--with-plugin-ndbcluster"); - push(@args, "--with-ndb-test"); + # Hardcoded options controlling how to build NDB + push(@args, "-DWITH_PLUGIN_NDBCLUSTER=1"); + push(@args, "-DWITH_NDB_TEST=1"); - cmd($^X, @args, @ARGV); + # The cmake generator to use + if ($opt_build_type) + { + push(@args, "-G \"$opt_build_type\""); + } + + # Sets installation directory, bindir, libdir, libexecdir etc. + # The equivalent CMake variables are given without prefix + # e.g if --prefix is /usr and --bindir is /usr/bin + # then cmake variable (INSTALL_BINDIR) must be just "bin" + my $opt_prefix; + sub set_installdir + { + my($path, $varname) = @_; + my $prefix_length = length($opt_prefix); + if (($prefix_length > 0) && (index($path,$opt_prefix) == 0)) + { + # path is under the prefix, remove the prefix and + # maybe following "/" + $path = substr($path, $prefix_length); + if(length($path) > 0) + { + my $char = substr($path, 0, 1); + if($char eq "/") + { + $path= substr($path, 1); + } + } + if(length($path) > 0) + { + push(@args, "-D$varname=$path"); + } + } + } + + # Process --configure style arguments which need special conversion + my $opt_bindir; + my $opt_libdir; + my $opt_libexecdir; + my $opt_includedir; + my $opt_with_zlib_dir; + my $opt_with_ssl; + my $opt_localstatedir; + my $opt_mysql_maintainer_mode; + my $opt_with_gcov; + my $opt_with_comment; + my $opt_with_plugins; + my $opt_without_plugin; + my $opt_extra_charsets; + my $opt_with_extra_charsets; + Getopt::Long::Configure("pass_through"); + GetOptions( + 'prefix=s' => \$opt_prefix, + 'srcdir=s' => \$opt_srcdir, + 'bindir=s' => \$opt_bindir, + 'libdir=s' => \$opt_libdir, + 'libexecdir=s' => \$opt_libexecdir, + 'includedir=s' => \$opt_includedir, + 'with-zlib-dir=s' => \$opt_with_zlib_dir, + 'with-ssl:s' => \$opt_with_ssl, + 'localstatedir=s' => \$opt_localstatedir, + 'mysql-maintainer-mode=s' => \$opt_mysql_maintainer_mode, + 'with-gcov' => \$opt_with_gcov, + 'with-comment=s' => \$opt_with_comment, + 'with-plugins=s' => \$opt_with_plugins, + 'without-plugin=s' => \$opt_without_plugin, + 'with-extra-charsets=s' => \$opt_with_extra_charsets, + 'extra-charsets=s' => \$opt_extra_charsets, + ) or exit(1); + + if($opt_prefix) + { + push(@args, "-DCMAKE_INSTALL_PREFIX=$opt_prefix"); + } + if($opt_bindir) + { + set_installdir($opt_bindir, "INSTALL_BINDIR"); + } + if($opt_libdir) + { + set_installdir($opt_libdir, "INSTALL_LIBDIR"); + } + if($opt_libexecdir) + { + set_installdir($opt_libexecdir, "INSTALL_SBINDIR"); + } + if($opt_includedir) + { + set_installdir($opt_includedir, "INSTALL_INCLUDEDIR"); + } + if($opt_with_zlib_dir) + { + $opt_with_zlib_dir = "system" + if ($opt_with_zlib_dir ne "bundled"); + push(@args, "-DWITH_ZLIB=$opt_with_zlib_dir"); + } + if($opt_with_ssl) + { + push(@args, "-DWITH_SSL=".($opt_with_ssl ? "yes" : "bundled")); + } + if ($opt_localstatedir) + { + push(@args, "-DMYSQL_DATADIR=$opt_localstatedir"); + } + if ($opt_mysql_maintainer_mode) + { + push(@args, "-DMYSQL_MAINTAINER_MODE=" . + ($opt_mysql_maintainer_mode =~ /enable/ ? "1" : "0")); + } + if ($opt_with_gcov) + { + push(@args, "-DENABLE_GCOV=ON"); + } + if ($opt_with_comment) + { + push(@args, "\"-DWITH_COMMENT=$opt_with_comment\""); + } + if($opt_with_plugins) + { + my @plugins= split(/,/, $opt_with_plugins); + foreach my $p (@plugins) + { + $p =~ s/-/_/g; + push(@args, "-DWITH_".uc($p)."=1"); + } + } + if($opt_without_plugin) + { + push(@args, "-DWITHOUT_".uc($opt_without_plugin)."=1"); + } + if ($opt_extra_charsets) + { + push(@args, "-DWITH_CHARSETS=$opt_extra_charsets"); + } + if($opt_with_extra_charsets) + { + push(@args, "-DWITH_EXTRA_CHARSETS=$opt_with_extra_charsets"); + } + + + # Default conversion of remaining args in ARGV from + # 1) --arg -> -DARG=1 + # 2) --arg=value -> -DARG=value + # 3) arg=value -> environment variable arg=value + foreach my $option (@ARGV) + { + if ($option =~ /^--/) + { + # Remove leading -- + $option = substr($option, 2); + + my @v = split('=', $option); + my $name = shift(@v); + $name = uc($name); + $name =~ s/-/_/g; + if (@v) + { + push(@args, "-D$name=".join('=', @v)); + } + else + { + push(@args, "-D$name=1"); + } + } + else + { + + # This must be environment variable + my @v = split('=', $option); + my $name = shift(@v); + if(@v) + { + $ENV{$name} = join('=', @v); + } + else + { + die "unhandled argument '$option' found"; + } + } + } + + # The source directory to build from + die "srcdir already contains CMakeCache.txt, this will not work!" + if (-f "$opt_srcdir/CMakeCache.txt"); + push(@args, $opt_srcdir); + + cmd("cmake", @args); +} + +if (!$opt_build) +{ + print "Configuration completed, skipping build(used --no-build)\n"; + exit(0); } + # # Build # { if ($cmake_version_id >= 20800) { - # Use the universal "cmake --build " way of building + # Use the universal "cmake --build " way of building # which is available from cmake 2.8 and works on all platforms my @args; push(@args, "--build"); - - push(@args, "$srcdir"); + push(@args, "."); + + if ($^O eq "cygwin" or $^O eq "MSWin32") + { + # Choose to build RelWitDebInfo by default on Windows + my $config = 'RelWithDebInfo'; + if ($opt_debug) + { + $config = 'Debug'; + } + push(@args, "--config"); + push(@args, $config); + } cmd("cmake", @args); @@ -112,12 +326,18 @@ my $cmake_version_id; die "You need to install cmake with version > 2.8" if ($^O eq "cygwin" or $^O eq "MSWin32"); - cmd("make -C $srcdir"); + cmd("make"); } } sub cmd { my ($cmd, @a)= @_; + + if ($opt_just_print){ + print "$cmd ", join(' ', @a), "\n"; + return; + } + print "compile-cluster: calling '$cmd ", join(' ', @a), "'\n"; system($cmd, @a) and print("command failed: $!\n") No bundle (reason: useless for push emails).