From e9067a66898ad9cb134ac8919ee4c63822e0e673 Mon Sep 17 00:00:00 2001 From: Daniel Fischer Date: Wed, 13 Aug 2008 18:44:05 +0200 Subject: [PATCH 01/10] let's try to avoid re-defining _vsnprintf on Windows --- zlib/gzio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zlib/gzio.c b/zlib/gzio.c index afac5352323..7e90f4928fc 100644 --- a/zlib/gzio.c +++ b/zlib/gzio.c @@ -7,10 +7,10 @@ /* @(#) $Id$ */ -#include "zutil.h" - #include +#include "zutil.h" + #ifdef NO_DEFLATE /* for compatibility with old definition */ # define NO_GZCOMPRESS #endif From 7077649ef1a6201ba7f2c5792e8935ea0b4689cf Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 25 Aug 2008 21:07:41 +0200 Subject: [PATCH 02/10] Bug#37098 Get rid of "Installed (but unpackaged)" files in the RPM build Mostly, this affected files (programs, scripts, and manual pages) which got built during a RPM build but were not listed in the appropriate "%files" section of the "spec" file. This is fixed now, they are added. To make this consistent, this patch also makes the build of "innochecksum" (and its inclusion in a tar.gz or other package) depend on whether InnoDB is configured in the build. Also, some tools to create Windows packages are irrelevant in any binary Unix package (not the sources !), and so they are deleted before packaging. configure.in: To prevent "innochecksum" from getting built even if InnoDB is not configured (and then being included in such packages), we need an "automake condition" that evaluates whether we have InnoDB. extra/Makefile.am: Evaluate the new automake condition about having InnoDB, and make the build of "innochecksum" depend on it. man/Makefile.am: Cleanup: There are manual files which we do not need, like those about tools for Windows builds / packaging (irrelevant in any Unix binary package) and about NDB tools which do not get built. scripts/make_binary_distribution.sh: In any Unix binary package, do not include tools for Windows builds (and their manual pages). This does not affect source packages, of course. support-files/mysql.spec.sh: There were several files (binaries, scripts, and manuals) which got built with a RPM but never packages, add them to the respective RPM. --- configure.in | 3 +++ extra/Makefile.am | 7 ++++++- man/Makefile.am | 6 ++++++ scripts/make_binary_distribution.sh | 3 +++ support-files/mysql.spec.sh | 23 +++++++++++++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index ab56fc24c71..f763f9d942b 100644 --- a/configure.in +++ b/configure.in @@ -2810,6 +2810,9 @@ EOF AC_CONFIG_SUBDIRS(innobase) fi + # "innochecksum" is not in the "innobase/" subdirectory, but should be switched + AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$have_innodb" = Xyes]) + case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc-$have_ndbcluster in *solaris*-i?86-no-yes) if $CC -xildon 2>&1 | grep "illegal option" >/dev/null diff --git a/extra/Makefile.am b/extra/Makefile.am index 6eac67e2979..16567f8d613 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -45,7 +45,12 @@ $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ - resolve_stack_dump mysql_waitpid innochecksum + resolve_stack_dump mysql_waitpid +# "innochecksum" should be switched +if BUILD_INNODB_TOOLS +bin_PROGRAMS += innochecksum +endif + noinst_PROGRAMS = charset2html EXTRA_DIST = CMakeLists.txt diff --git a/man/Makefile.am b/man/Makefile.am index 2d47a1ad9ba..d37ef81285b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -21,5 +21,11 @@ man1_MANS = @man1_files@ man8_MANS = @man8_files@ EXTRA_DIST = $(man1_MANS) $(man8_MANS) +# 1) not needed in Unix binary packages, +# 2) programs not generated in 5.0: +install-data-hook: + rm -f $(DESTDIR)$(manlibdir)/man1/make_win_* + rm -f $(DESTDIR)$(manlibdir)/man1/ndb_print_* + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index af3db86af81..e5e08038bff 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -272,6 +272,8 @@ if [ $BASE_SYSTEM != "netware" ] ; then if [ -d man ] ; then $CP man/*.1 $BASE/man/man1 $CP man/*.8 $BASE/man/man8 + # In a Unix binary package, these tools and their manuals are not useful + rm -f $BASE/man/man1/make_win_* fi fi @@ -331,6 +333,7 @@ fi rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \ $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \ + $BASE/bin/make_win_* \ $BASE/bin/setsomevars $BASE/support-files/Makefile* \ $BASE/support-files/*.sh diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index ddffb2827b0..2f09ebc61b2 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -591,6 +591,7 @@ fi %doc %attr(644, root, root) %{_infodir}/mysql.info* +%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1* %doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1* %doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1* %doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1* @@ -610,6 +611,7 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1* %doc %attr(644, root, man) %{_mandir}/man1/perror.1* %doc %attr(644, root, man) %{_mandir}/man1/replace.1* %doc %attr(644, root, man) %{_mandir}/man1/safe_mysqld.1* @@ -617,6 +619,7 @@ fi %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf %ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd +%attr(755, root, root) %{_bindir}/innochecksum %attr(755, root, root) %{_bindir}/my_print_defaults %attr(755, root, root) %{_bindir}/myisam_ftdump %attr(755, root, root) %{_bindir}/myisamchk @@ -661,6 +664,7 @@ fi %attr(755, root, root) %{_bindir}/mysql %attr(755, root, root) %{_bindir}/mysql_find_rows %attr(755, root, root) %{_bindir}/mysql_tableinfo +%attr(755, root, root) %{_bindir}/mysql_upgrade_shell %attr(755, root, root) %{_bindir}/mysql_waitpid %attr(755, root, root) %{_bindir}/mysqlaccess %attr(755, root, root) %{_bindir}/mysqladmin @@ -672,6 +676,8 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/msql2mysql.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_find_rows.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_tableinfo.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlaccess.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqladmin.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlbinlog.1* @@ -713,6 +719,8 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/ndb_config.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_desc.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_error_reporter.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_mgm.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_restore.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_select_all.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_select_count.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_show_tables.1* @@ -724,13 +732,16 @@ fi %attr(755, root, root) %{_bindir}/ndb_delete_all %attr(755, root, root) %{_bindir}/ndb_drop_index %attr(755, root, root) %{_bindir}/ndb_drop_table +%attr(755, root, root) %{_sbindir}/ndb_cpcd %doc %attr(644, root, man) %{_mandir}/man1/ndb_delete_all.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_index.1* %doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_table.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_cpcd.1* %files devel %defattr(-, root, root, 0755) %doc EXCEPTIONS-CLIENT +%doc %attr(644, root, man) %{_mandir}/man1/comp_err.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1* %attr(755, root, root) %{_bindir}/comp_err %attr(755, root, root) %{_bindir}/mysql_config @@ -784,6 +795,18 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Mon Aug 18 2008 Joerg Bruehe + +- Get rid of the "warning: Installed (but unpackaged) file(s) found:" + Some files were missing: + - Manual "mysqlbug" ("server" subpackage) + - Program "innochecksum" and its manual ("server" subpackage) + - Manuals "mysql_find_rows" + "mysql_tableinfo" ("client" subpackage) + - Script "mysql_upgrade_shell" ("client" subpackage) + - Manual "comp_err" ("devel" subpackage) + - Program "ndb_cpcd" and its manual ("ndb-extra" subpackage) + - Manuals "ndb_mgm" + "ndb_restore" ("ndb-tools" subpackage) + * Wed Mar 19 2008 Joerg Bruehe - Add the man pages for "ndbd" and "ndb_mgmd". From c978058b08fe613e805f3fb306c3f0f37c035368 Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Fri, 29 Aug 2008 17:30:41 +0200 Subject: [PATCH 03/10] Handle that version "level" might contain "sp1", "a"..... --- win/create_manifest.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/win/create_manifest.js b/win/create_manifest.js index dec8f6e62e2..dbdd83588c5 100755 --- a/win/create_manifest.js +++ b/win/create_manifest.js @@ -31,7 +31,17 @@ try var end= supp_version.indexOf("-"); if (end == -1) end= supp_version.length; var app_version= supp_version.substring(0, end); - app_version+= ".0"; + var fourth_element= 0; + if(app_version.match(/[a-z]$/)) { + fourth_element+= (1 + app_version.charCodeAt(end-1) - "a".charCodeAt(0)); + app_version= app_version.substring(0,--end); + } + if(app_version.match(/sp[1-9]$/)) { + fourth_element+= 100*(app_version.charCodeAt(end-1) - "0".charCodeAt(0)); + app_version= app_version.substring(0, end-3); + end-= 3; + } + app_version+= "." + fourth_element; break; case "arch": var app_arch= parts[1]; From 00629f57456a0239167d8dff93a5f7000bdbebeb Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Fri, 29 Aug 2008 17:31:31 +0200 Subject: [PATCH 04/10] Removed option to control if federated is enabled, and enabled it. --- support-files/mysql.spec.sh | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index afa552c67a5..31e1c205d66 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -32,11 +32,6 @@ %{?_with_cluster:%define CLUSTER_BUILD 1} %{!?_with_cluster:%define CLUSTER_BUILD 0} -# use "rpmbuild --with federated" or "rpm --define '_with_federated 1'" (for RPM 3.x) -# to build with federated support (off by default) -%{?_with_federated:%define FEDERATED_BUILD 1} -%{!?_with_federated:%define FEDERATED_BUILD 0} - %if %{STATIC_BUILD} %define release 0 %else @@ -342,11 +337,7 @@ BuildMySQL "--enable-shared \ --with-archive-storage-engine \ --with-csv-storage-engine \ --with-blackhole-storage-engine \ -%if %{FEDERATED_BUILD} --with-federated-storage-engine \ -%else - --without-federated-storage-engine \ -%endif --with-partition \ --with-big-tables \ --with-comment=\"MySQL Community Server - Debug (GPL)\"") @@ -378,11 +369,7 @@ BuildMySQL "--enable-shared \ --with-archive-storage-engine \ --with-csv-storage-engine \ --with-blackhole-storage-engine \ -%if %{FEDERATED_BUILD} --with-federated-storage-engine \ -%else - --without-federated-storage-engine \ -%endif --with-partition \ --with-embedded-server \ --with-big-tables \ @@ -846,6 +833,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Fri Aug 29 2008 Kent Boortz + +- Removed the "Federated" storage engine option, and enabled in all + * Tue Aug 26 2008 Joerg Bruehe - Get rid of the "warning: Installed (but unpackaged) file(s) found:" From 8106a731e6671779d3be855f766069cc2774be34 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Sep 2008 21:36:31 +0200 Subject: [PATCH 05/10] Merge from mysql-5.0.68-release From 08421a83ba827171976041151004f087ce66f2a6 Mon Sep 17 00:00:00 2001 From: Martin Skold Date: Mon, 15 Sep 2008 11:19:56 +0200 Subject: [PATCH 06/10] bug #31231 mysql_alter_table() tries to drop a non-existing table bug#31233 mysql_alter_table() fails to drop UNIQUE KEY mysql-test/suite/ndb/r/ndb_alter_table.result: bug#31233 mysql_alter_table() fails to drop UNIQUE KEY: added test cases mysql-test/suite/ndb/t/ndb_alter_table.test: bug#31233 mysql_alter_table() fails to drop UNIQUE KEY: added test cases sql/ha_ndbcluster.cc: bug#31233 mysql_alter_table() fails to drop UNIQUE KEY: Removed check for non-pk tables, not needed when mysql_alter_table checks apropriate flags sql/mysql_priv.h: bug #31231 mysql_alter_table() tries to drop a non-existing table: added FRM_ONLY flag sql/sql_table.cc: bug #31231 mysql_alter_table() tries to drop a non-existing table Don't invoke handler for tables defined with FRM_ONLY flag. bug#31233 mysql_alter_table() fails to drop UNIQUE KEY When a table is defined without an explicit primary key mysql will choose the first found unique index defined over non-nullable fields (if such an index exists). This means that if such an index is added (the first) or dropped (the last) through an alter table, this equals adding or dropping a primary key. The implementation for on-line add/drop index did not consider this semantics. This patch ensures that only handlers with the correctly defined flags (see handler.h for explanation of the flags): HA_ONLINE_ADD_PK_INDEX HA_ONLINE_ADD_PK_INDEX_NO_WRITES HA_ONLINE_DROP_PK_INDEX HA_ONLINE_DROP_PK_INDEX_NO_WRITES are invoked for such on-line operations. All others handlers must perform a full (offline) alter table. --- mysql-test/suite/ndb/r/ndb_alter_table.result | 52 +++++-- mysql-test/suite/ndb/t/ndb_alter_table.test | 29 +++- sql/ha_ndbcluster.cc | 25 +--- sql/mysql_priv.h | 1 + sql/sql_table.cc | 132 +++++++++++++++--- 5 files changed, 185 insertions(+), 54 deletions(-) diff --git a/mysql-test/suite/ndb/r/ndb_alter_table.result b/mysql-test/suite/ndb/r/ndb_alter_table.result index 5798db73403..35b983e1901 100644 --- a/mysql-test/suite/ndb/r/ndb_alter_table.result +++ b/mysql-test/suite/ndb/r/ndb_alter_table.result @@ -354,16 +354,52 @@ select * from t1 where a = 12; a b c 12 403 NULL drop table t1; -create table t1 (a int not null, b varchar(10)) engine=ndb; -show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +create table t1(a int not null) engine=ndb; +$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY +PRIMARY KEY($PK) - UniqueHashIndex +insert into t1 values (1),(2),(3); alter table t1 add primary key (a); -show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A 0 NULL NULL BTREE +a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY +PRIMARY KEY(a) - UniqueHashIndex +PRIMARY(a) - OrderedIndex +update t1 set a = 17 where a = 1; +select * from t1 order by a; +a +2 +3 +17 alter table t1 drop primary key; -show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY +PRIMARY KEY($PK) - UniqueHashIndex +update t1 set a = 1 where a = 17; +select * from t1 order by a; +a +1 +2 +3 +drop table t1; +create table t1(a int not null) engine=ndb; +$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY +PRIMARY KEY($PK) - UniqueHashIndex +insert into t1 values (1),(2),(3); +create unique index pk on t1(a); +a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY +PRIMARY KEY(a) - UniqueHashIndex +update t1 set a = 17 where a = 1; +select * from t1 order by a; +a +2 +3 +17 +alter table t1 drop index pk; +$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY +PRIMARY KEY($PK) - UniqueHashIndex +update t1 set a = 1 where a = 17; +select * from t1 order by a; +a +1 +2 +3 drop table t1; create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; show create table t1; diff --git a/mysql-test/suite/ndb/t/ndb_alter_table.test b/mysql-test/suite/ndb/t/ndb_alter_table.test index 082fe726927..cbd941b8a9c 100644 --- a/mysql-test/suite/ndb/t/ndb_alter_table.test +++ b/mysql-test/suite/ndb/t/ndb_alter_table.test @@ -411,13 +411,32 @@ select * from t1 where a = 12; drop table t1; # some other ALTER combinations -# add/drop pk -create table t1 (a int not null, b varchar(10)) engine=ndb; -show index from t1; +# Check add/drop primary key (not supported on-line) +create table t1(a int not null) engine=ndb; +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY +insert into t1 values (1),(2),(3); alter table t1 add primary key (a); -show index from t1; +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY +update t1 set a = 17 where a = 1; +select * from t1 order by a; alter table t1 drop primary key; -show index from t1; +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY +update t1 set a = 1 where a = 17; +select * from t1 order by a; +drop table t1; + +# bug#31233 mysql_alter_table() fails to drop UNIQUE KEY +create table t1(a int not null) engine=ndb; +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY +insert into t1 values (1),(2),(3); +create unique index pk on t1(a); +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY +update t1 set a = 17 where a = 1; +select * from t1 order by a; +alter table t1 drop index pk; +--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY +update t1 set a = 1 where a = 17; +select * from t1 order by a; drop table t1; # alter .. alter diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 1cfe403407e..f7d52d3834e 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -9971,34 +9971,23 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info, if (table_changes != IS_EQUAL_YES) DBUG_RETURN(COMPATIBLE_DATA_NO); - /** - * Changing from/to primary key - * - * This is _not_ correct, but check_if_incompatible_data-interface - * doesnt give more info, so I guess that we can't do any - * online add index if not using primary key - * - * This as mysql will handle a unique not null index as primary - * even wo/ user specifiying it... :-( - * - */ - if ((table_share->primary_key == MAX_KEY && pk) || - (table_share->primary_key != MAX_KEY && !pk) || - (table_share->primary_key == MAX_KEY && !pk && ai)) - { - DBUG_RETURN(COMPATIBLE_DATA_NO); - } - /* Check that auto_increment value was not changed */ if ((create_info->used_fields & HA_CREATE_USED_AUTO) && create_info->auto_increment_value != 0) + { + DBUG_PRINT("info", ("auto_increment value changed")); DBUG_RETURN(COMPATIBLE_DATA_NO); + } /* Check that row format didn't change */ if ((create_info->used_fields & HA_CREATE_USED_AUTO) && get_row_type() != create_info->row_type) + { + DBUG_PRINT("info", ("row format changed")); DBUG_RETURN(COMPATIBLE_DATA_NO); + } + DBUG_PRINT("info", ("new table seems compatible")); DBUG_RETURN(COMPATIBLE_DATA_YES); } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 3a52c5c0130..4e1f2ad6f60 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2240,6 +2240,7 @@ uint build_table_shadow_filename(char *buff, size_t bufflen, #define FN_TO_IS_TMP (1 << 1) #define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP) #define NO_FRM_RENAME (1 << 2) +#define FRM_ONLY (1 << 3) /* from hostname.cc */ struct in_addr; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 226facffe7c..e317cdab952 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1835,8 +1835,9 @@ bool quick_rm_table(handlerton *base,const char *db, if (my_delete(path,MYF(0))) error= 1; /* purecov: inspected */ path[path_length - reg_ext_length]= '\0'; // Remove reg_ext - DBUG_RETURN(ha_delete_table(current_thd, base, path, db, table_name, 0) || - error); + if (!(flags & FRM_ONLY)) + error|= ha_delete_table(current_thd, base, path, db, table_name, 0); + DBUG_RETURN(error); } /* @@ -5163,6 +5164,7 @@ err: index_drop_count OUT The number of elements in the array. index_add_buffer OUT An array of offsets into key_info_buffer. index_add_count OUT The number of elements in the array. + candidate_key_count OUT The number of candidate keys in original table. DESCRIPTION 'table' (first argument) contains information of the original @@ -5193,7 +5195,8 @@ compare_tables(TABLE *table, enum_alter_table_change_level *need_copy_table, KEY **key_info_buffer, uint **index_drop_buffer, uint *index_drop_count, - uint **index_add_buffer, uint *index_add_count) + uint **index_add_buffer, uint *index_add_count, + uint *candidate_key_count) { Field **f_ptr, *field; uint changes= 0, tmp; @@ -5208,6 +5211,9 @@ compare_tables(TABLE *table, create_info->varchar will be reset in mysql_prepare_create_table. */ bool varchar= create_info->varchar; + bool not_nullable= true; + DBUG_ENTER("compare_tables"); + /* Create a copy of alter_info. To compare the new and old table definitions, we need to "prepare" @@ -5225,24 +5231,21 @@ compare_tables(TABLE *table, */ Alter_info tmp_alter_info(*alter_info, thd->mem_root); uint db_options= 0; /* not used */ - - DBUG_ENTER("compare_tables"); - /* Create the prepared information. */ if (mysql_prepare_create_table(thd, create_info, - &tmp_alter_info, - (table->s->tmp_table != NO_TMP_TABLE), - &db_options, - table->file, key_info_buffer, - &key_count, 0)) + &tmp_alter_info, + (table->s->tmp_table != NO_TMP_TABLE), + &db_options, + table->file, key_info_buffer, + &key_count, 0)) DBUG_RETURN(1); /* Allocate result buffers. */ if (! (*index_drop_buffer= - (uint*) thd->alloc(sizeof(uint) * table->s->keys)) || + (uint*) thd->alloc(sizeof(uint) * table->s->keys)) || ! (*index_add_buffer= - (uint*) thd->alloc(sizeof(uint) * tmp_alter_info.key_list.elements))) + (uint*) thd->alloc(sizeof(uint) * tmp_alter_info.key_list.elements))) DBUG_RETURN(1); - + /* Some very basic checks. If number of fields changes, or the handler, we need to run full ALTER TABLE. In the future @@ -5355,12 +5358,29 @@ compare_tables(TABLE *table, */ *index_drop_count= 0; *index_add_count= 0; + *candidate_key_count= 0; for (table_key= table->key_info; table_key < table_key_end; table_key++) { KEY_PART_INFO *table_part; KEY_PART_INFO *table_part_end= table_key->key_part + table_key->key_parts; KEY_PART_INFO *new_part; + /* + Check if key is a candidate key, i.e. a unique index with no index + fields nullable, then key is either already primary key or could + be promoted to primary key if the original primary key is dropped. + Count all candidate keys. + */ + not_nullable= true; + for (table_part= table_key->key_part; + table_part < table_part_end; + table_part++) + { + not_nullable= not_nullable && (! table_part->field->maybe_null()); + } + if ((table_key->flags & HA_NOSAME) && not_nullable) + (*candidate_key_count)++; + /* Search a new key with the same name. */ for (new_key= *key_info_buffer; new_key < new_key_end; new_key++) { @@ -5986,13 +6006,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, uint *index_drop_buffer; uint index_add_count; uint *index_add_buffer; + uint candidate_key_count; bool committed= 0; + bool no_pk; DBUG_ENTER("mysql_alter_table"); LINT_INIT(index_add_count); LINT_INIT(index_drop_count); LINT_INIT(index_add_buffer); LINT_INIT(index_drop_buffer); + LINT_INIT(candidate_key_count); /* Check if we attempt to alter mysql.slow_log or @@ -6403,7 +6426,8 @@ view_err: &need_copy_table_res, &key_info_buffer, &index_drop_buffer, &index_drop_count, - &index_add_buffer, &index_add_count)) + &index_add_buffer, &index_add_count, + &candidate_key_count)) goto err; if (need_copy_table == ALTER_TABLE_METADATA_ONLY) @@ -6437,20 +6461,40 @@ view_err: DBUG_PRINT("info", ("index dropped: '%s'", key->name)); if (key->flags & HA_NOSAME) { - /* Unique key. Check for "PRIMARY". */ - if (! my_strcasecmp(system_charset_info, - key->name, primary_key_name)) + /* + Unique key. Check for "PRIMARY". + or if dropping last unique key + */ + if ((uint) (key - table->key_info) == table->s->primary_key) { + DBUG_PRINT("info", ("Dropping primary key")); /* Primary key. */ needed_online_flags|= HA_ONLINE_DROP_PK_INDEX; needed_fast_flags|= HA_ONLINE_DROP_PK_INDEX_NO_WRITES; pk_changed++; + candidate_key_count--; } else { + KEY_PART_INFO *part_end= key->key_part + key->key_parts; + bool is_candidate_key= true; + /* Non-primary unique key. */ needed_online_flags|= HA_ONLINE_DROP_UNIQUE_INDEX; needed_fast_flags|= HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES; + + /* + Check if all fields in key are declared + NOT NULL and adjust candidate_key_count + */ + for (KEY_PART_INFO *key_part= key->key_part; + key_part < part_end; + key_part++) + is_candidate_key= + (is_candidate_key && + (! table->field[key_part->fieldnr-1]->maybe_null())); + if (is_candidate_key) + candidate_key_count--; } } else @@ -6460,7 +6504,8 @@ view_err: needed_fast_flags|= HA_ONLINE_DROP_INDEX_NO_WRITES; } } - + no_pk= ((table->s->primary_key == MAX_KEY) || + (needed_online_flags & HA_ONLINE_DROP_PK_INDEX)); /* Check added indexes. */ for (idx_p= index_add_buffer, idx_end_p= idx_p + index_add_count; idx_p < idx_end_p; @@ -6470,14 +6515,38 @@ view_err: DBUG_PRINT("info", ("index added: '%s'", key->name)); if (key->flags & HA_NOSAME) { - /* Unique key. Check for "PRIMARY". */ - if (! my_strcasecmp(system_charset_info, - key->name, primary_key_name)) + /* Unique key */ + + KEY_PART_INFO *part_end= key->key_part + key->key_parts; + bool is_candidate_key= true; + + /* + Check if all fields in key are declared + NOT NULL + */ + for (KEY_PART_INFO *key_part= key->key_part; + key_part < part_end; + key_part++) + is_candidate_key= + (is_candidate_key && + (! table->field[key_part->fieldnr]->maybe_null())); + + /* + Check for "PRIMARY" + or if adding first unique key + defined on non-nullable fields + */ + + if ((!my_strcasecmp(system_charset_info, + key->name, primary_key_name)) || + (no_pk && candidate_key_count == 0 && is_candidate_key)) { + DBUG_PRINT("info", ("Adding primary key")); /* Primary key. */ needed_online_flags|= HA_ONLINE_ADD_PK_INDEX; needed_fast_flags|= HA_ONLINE_ADD_PK_INDEX_NO_WRITES; pk_changed++; + no_pk= false; } else { @@ -6494,6 +6563,20 @@ view_err: } } + if ((candidate_key_count > 0) && + (needed_online_flags & HA_ONLINE_DROP_PK_INDEX)) + { + /* + Dropped primary key when there is some other unique + not null key that should be converted to primary key + */ + needed_online_flags|= HA_ONLINE_ADD_PK_INDEX; + needed_fast_flags|= HA_ONLINE_ADD_PK_INDEX_NO_WRITES; + pk_changed= 2; + } + + DBUG_PRINT("info", ("needed_online_flags: 0x%lx, needed_fast_flags: 0x%lx", + needed_online_flags, needed_fast_flags)); /* Online or fast add/drop index is possible only if the primary key is not added and dropped in the same statement. @@ -6992,7 +7075,10 @@ err1: close_temporary_table(thd, new_table, 1, 1); } else - VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP)); + VOID(quick_rm_table(new_db_type, new_db, tmp_name, + create_info->frm_only + ? FN_IS_TMP | FRM_ONLY + : FN_IS_TMP)); err: /* From 94fad7c0c242a15dd90be9fe061d0661a0fedd16 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 15 Sep 2008 15:29:31 +0500 Subject: [PATCH 07/10] Bug#35720 ucs2 + pad_char_to_full_length = failure Problem: with @@sql_mode=pad_char_to_full_length a CHAR column returned additional garbage after trailing space characters due to incorrect my_charpos() call. Fix: call my_charpos() with correct arguments. --- mysql-test/r/ctype_ucs.result | 11 +++++++++++ mysql-test/t/ctype_ucs.test | 11 +++++++++++ sql/field.cc | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 20dd85834dd..ec2182a3304 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1098,6 +1098,17 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '=' drop table t1; +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('a'); +SET @@sql_mode=pad_char_to_full_length; +SELECT HEX(s1) FROM t1; +HEX(s1) +00610020002000200020 +SET @@sql_mode=default; +SELECT HEX(s1) FROM t1; +HEX(s1) +0061 +DROP TABLE t1; set collation_connection=ucs2_general_ci; drop table if exists t1; create table t1 as diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index db609777c8d..cb371bc0ca6 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -678,6 +678,17 @@ select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062); select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); drop table t1; +# +# Bug#35720 ucs2 + pad_char_to_full_length = failure +# +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('a'); +SET @@sql_mode=pad_char_to_full_length; +SELECT HEX(s1) FROM t1; +SET @@sql_mode=default; +SELECT HEX(s1) FROM t1; +DROP TABLE t1; + set collation_connection=ucs2_general_ci; --source include/ctype_regex.inc set names latin1; diff --git a/sql/field.cc b/sql/field.cc index 70cc14bda5f..b03cc140ade 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6610,7 +6610,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)), uint length; if (table->in_use->variables.sql_mode & MODE_PAD_CHAR_TO_FULL_LENGTH) - length= my_charpos(field_charset, ptr, ptr + field_length, field_length); + length= my_charpos(field_charset, ptr, ptr + field_length, + field_length / field_charset->mbmaxlen); else length= field_charset->cset->lengthsp(field_charset, (const char*) ptr, field_length); From 5343b7ae5980fff72d82c3be44921e16e6471e9d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 15 Sep 2008 14:58:32 +0200 Subject: [PATCH 08/10] Bug#35987 - crash report on windows doesn't resolve stack traces. The problem here is that symbols can not be loaded, because symbol path is not set and default path does not include the directory where PDB is located. The problem is _not_ reproducible on the same machine where mysqld.exe is built - if PDB is not found in the symbol path, dbghelp would fallback to fully qualified PDB path as given in the executable header and on the build host this will succeed. The solution is to calculate symbol path and pass it to SymInitialize() call. --- sql/stacktrace.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/sql/stacktrace.c b/sql/stacktrace.c index ce91d63d3f7..1e112418cf8 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -261,6 +261,7 @@ void write_core(int sig) #else /* __WIN__*/ #include +#include /* Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll) @@ -349,6 +350,63 @@ void set_exception_pointers(EXCEPTION_POINTERS *ep) exception_ptrs = ep; } + +/* + Get symbol path - semicolon-separated list of directories to search for debug + symbols. We expect PDB in the same directory as corresponding exe or dll, + so the path is build from directories of the loaded modules. If environment + variable _NT_SYMBOL_PATH is set, it's value appended to the symbol search path +*/ +static void get_symbol_path(char *path, size_t size) +{ + HANDLE hSnap; + char *envvar; + + path[0]= '\0'; + /* + Enumerate all modules, and add their directories to the path. + Avoid duplicate entries. + */ + hSnap= CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId()); + if (hSnap != INVALID_HANDLE_VALUE) + { + BOOL ret; + MODULEENTRY32 mod; + mod.dwSize= sizeof(MODULEENTRY32); + for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod)) + { + char *module_dir= mod.szExePath; + char *p= strrchr(module_dir,'\\'); + if (!p) + { + /* + Path separator was not found. Not known to happen, if ever happens, + will indicate current directory. + */ + module_dir[0]= '.'; + p= module_dir + 1; + } + *p++= ';'; + *p= '\0'; + + if (!strstr(path, module_dir)) + { + strncat(path, module_dir, size); + } + } + CloseHandle(hSnap); + } + + /* Add _NT_SYMBOL_PATH, if present. */ + envvar= getenv("_NT_SYMBOL_PATH"); + if(envvar) + { + strncat(path, envvar, size); + } +} + +#define MAX_SYMBOL_PATH 32768 + /* Platform SDK in VS2003 does not have definition for SYMOPT_NO_PROMPTS*/ #ifndef SYMOPT_NO_PROMPTS #define SYMOPT_NO_PROMPTS 0 @@ -365,6 +423,7 @@ void print_stacktrace(gptr unused1, ulong unused2) int i; CONTEXT context; STACKFRAME64 frame={0}; + static char symbol_path[MAX_SYMBOL_PATH+1]; if(!exception_ptrs || !init_dbghelp_functions()) return; @@ -373,7 +432,8 @@ void print_stacktrace(gptr unused1, ulong unused2) context = *(exception_ptrs->ContextRecord); /*Initialize symbols.*/ pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG); - pSymInitialize(hProcess,NULL,TRUE); + get_symbol_path(symbol_path, MAX_SYMBOL_PATH); + pSymInitialize(hProcess, symbol_path, TRUE); /*Prepare stackframe for the first StackWalk64 call*/ frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat; From 7eb271ba4377ac33ab7e885ed7534d57189af323 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Mon, 15 Sep 2008 15:13:43 -0400 Subject: [PATCH 09/10] Bug#39803 Test rpl.rpl_truncate_7ndb_2 failing Fixed bad path in .test file Moved test to suite/rpl_ndb (per Cluster QA) Re-recorded .result file to updated expected results. --- .../suite/rpl/r/rpl_truncate_7ndb_2.result | 91 ------------------- .../rpl_ndb/r/rpl_truncate_7ndb_2.result | 91 +++++++++++++++++++ .../t/rpl_truncate_7ndb_2-master.opt | 0 .../t/rpl_truncate_7ndb_2.test | 7 +- 4 files changed, 97 insertions(+), 92 deletions(-) delete mode 100644 mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result create mode 100644 mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result rename mysql-test/suite/{rpl => rpl_ndb}/t/rpl_truncate_7ndb_2-master.opt (100%) rename mysql-test/suite/{rpl => rpl_ndb}/t/rpl_truncate_7ndb_2.test (55%) diff --git a/mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result b/mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result deleted file mode 100644 index d43704c2ba7..00000000000 --- a/mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result +++ /dev/null @@ -1,91 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -**** On Master **** -CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; -INSERT INTO t1 VALUES (1,1), (2,2); -SELECT * FROM t1 ORDER BY a,b; -a b -1 1 -2 2 -**** On Slave **** -INSERT INTO t1 VALUE (3,3); -SELECT * FROM t1 ORDER BY a,b; -a b -1 1 -2 2 -3 3 -**** On Master **** -TRUNCATE TABLE t1; -SELECT * FROM t1 ORDER BY a,b; -a b -**** On Slave **** -SELECT * FROM t1 ORDER BY a,b; -a b -**** On Master **** -DROP TABLE t1; -SHOW BINLOG EVENTS; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 223 Query 1 287 BEGIN -master-bin.000001 287 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 385 Write_rows 1 157 table_id: # -master-bin.000001 444 Write_rows 1 204 table_id: # flags: STMT_END_F -master-bin.000001 491 Query 1 556 COMMIT -master-bin.000001 556 Query 1 636 use `test`; TRUNCATE TABLE t1 -master-bin.000001 636 Query 1 712 use `test`; DROP TABLE t1 -**** On Master **** -CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; -INSERT INTO t1 VALUES (1,1), (2,2); -SELECT * FROM t1 ORDER BY a,b; -a b -1 1 -2 2 -**** On Slave **** -INSERT INTO t1 VALUE (3,3); -SELECT * FROM t1 ORDER BY a,b; -a b -1 1 -2 2 -3 3 -**** On Master **** -DELETE FROM t1; -SELECT * FROM t1 ORDER BY a,b; -a b -**** On Slave **** -SELECT * FROM t1 ORDER BY a,b; -a b -3 3 -**** On Master **** -DROP TABLE t1; -SHOW BINLOG EVENTS; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 223 Query 1 287 BEGIN -master-bin.000001 287 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 385 Write_rows 1 157 table_id: # -master-bin.000001 444 Write_rows 1 204 table_id: # flags: STMT_END_F -master-bin.000001 491 Query 1 556 COMMIT -master-bin.000001 556 Query 1 636 use `test`; TRUNCATE TABLE t1 -master-bin.000001 636 Query 1 712 use `test`; DROP TABLE t1 -master-bin.000001 712 Query 1 829 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 829 Query 1 893 BEGIN -master-bin.000001 893 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 933 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 991 Write_rows 1 157 table_id: # -master-bin.000001 1050 Write_rows 1 204 table_id: # flags: STMT_END_F -master-bin.000001 1097 Query 1 1162 COMMIT -master-bin.000001 1162 Query 1 1226 BEGIN -master-bin.000001 1226 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 1266 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 1324 Write_rows 1 157 table_id: # -master-bin.000001 1383 Delete_rows 1 196 table_id: # flags: STMT_END_F -master-bin.000001 1422 Query 1 1487 COMMIT -master-bin.000001 1487 Query 1 1563 use `test`; DROP TABLE t1 diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result new file mode 100644 index 00000000000..d6c57aed41b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result @@ -0,0 +1,91 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +**** On Master **** +CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; +INSERT INTO t1 VALUES (1,1), (2,2); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +**** On Slave **** +INSERT INTO t1 VALUE (3,3); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +3 3 +**** On Master **** +TRUNCATE TABLE t1; +SELECT * FROM t1 ORDER BY a,b; +a b +**** On Slave **** +SELECT * FROM t1 ORDER BY a,b; +a b +**** On Master **** +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 223 Query 1 287 BEGIN +master-bin.000001 287 Table_map 1 330 table_id: # (test.t1) +master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status) +master-bin.000001 392 Write_rows 1 451 table_id: # +master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F +master-bin.000001 498 Query 1 563 COMMIT +master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1 +master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1 +**** On Master **** +CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; +INSERT INTO t1 VALUES (1,1), (2,2); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +**** On Slave **** +INSERT INTO t1 VALUE (3,3); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +3 3 +**** On Master **** +DELETE FROM t1; +SELECT * FROM t1 ORDER BY a,b; +a b +**** On Slave **** +SELECT * FROM t1 ORDER BY a,b; +a b +3 3 +**** On Master **** +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 223 Query 1 287 BEGIN +master-bin.000001 287 Table_map 1 330 table_id: # (test.t1) +master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status) +master-bin.000001 392 Write_rows 1 451 table_id: # +master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F +master-bin.000001 498 Query 1 563 COMMIT +master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1 +master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1 +master-bin.000001 719 Query 1 836 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 836 Query 1 900 BEGIN +master-bin.000001 900 Table_map 1 943 table_id: # (test.t1) +master-bin.000001 943 Table_map 1 1005 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1005 Write_rows 1 1064 table_id: # +master-bin.000001 1064 Write_rows 1 1111 table_id: # flags: STMT_END_F +master-bin.000001 1111 Query 1 1176 COMMIT +master-bin.000001 1176 Query 1 1240 BEGIN +master-bin.000001 1240 Table_map 1 1283 table_id: # (test.t1) +master-bin.000001 1283 Table_map 1 1345 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1345 Write_rows 1 1404 table_id: # +master-bin.000001 1404 Delete_rows 1 1443 table_id: # flags: STMT_END_F +master-bin.000001 1443 Query 1 1508 COMMIT +master-bin.000001 1508 Query 1 1584 use `test`; DROP TABLE t1 diff --git a/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt similarity index 100% rename from mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt rename to mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt diff --git a/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test similarity index 55% rename from mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test rename to mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test index 5381dff95a3..549227db61a 100644 --- a/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test @@ -1,6 +1,11 @@ # Same test as rpl_truncate_7ndb.test, but with mixed mode # This is marked with 'big_test' just because the rpl_truncate_7ndb test is # so slow... + +# Last Change: 2008-09-03 +# Change Author: pcrews +# Change: Moved test to rpl_ndb suite, updated location of --source .test file + --source include/have_binlog_format_mixed.inc --source include/big_test.inc ---source t/rpl_truncate_7ndb.test +--source suite/rpl_ndb/t/rpl_truncate_7ndb.test From ebd3a6e452c13510d13f82b8fe83850ae41f1b5c Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Mon, 15 Sep 2008 15:34:39 -0400 Subject: [PATCH 10/10] Bug#37938 Test "mysqldump" lacks various INSERT statements / values Moved fix for this bug to 5.0 as other mysqldump bugs seem tied to concurrent_insert being on Setting concurrent_insert off during this test as INSERTs weren't being completely processed before the calls to mysqldump, resulting in failing tests. Altered .test file to turn concurrent_insert off during the test and to restore it to whatever the value was at the start of the test when complete. Re-recorded .result file to account for changes to variables in the test. --- mysql-test/r/mysqldump.result | 6 ++++++ mysql-test/t/mysqldump.test | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index b484cf7c51d..1bf8d78cd9e 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1,3 +1,8 @@ +Bug#37938 - Test "mysqldump" lacks various insert statements +Turn off concurrent inserts to avoid random errors +NOTE: We reset the variable back to saved value at the end of test +SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT = 0; DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; drop database if exists mysqldump_test_db; drop database if exists db1; @@ -3565,6 +3570,7 @@ DROP TABLE t1,t2; -- Dump completed on DATE +SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; # # End of 5.0 tests # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 88053ae95fb..2f11685385f 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -5,6 +5,14 @@ # Binlog is required --source include/have_log_bin.inc + +--echo Bug#37938 - Test "mysqldump" lacks various insert statements +--echo Turn off concurrent inserts to avoid random errors +--echo NOTE: We reset the variable back to saved value at the end of test +SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT = 0; + + --disable_warnings DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; drop database if exists mysqldump_test_db; @@ -1594,6 +1602,10 @@ DROP TABLE t1,t2; --replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/ --exec $MYSQL_DUMP test +# We reset concurrent_inserts value to whatever it was at the start of the test +SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; + + --echo # --echo # End of 5.0 tests --echo #