From fc1ff23c6ee7ae1ceb7d8393117e4e5bf99b2275 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 30 Aug 2011 12:54:00 +0200 Subject: [PATCH 01/29] Add the manual page for "mysql_plugin" to the server RPM. --- support-files/mysql.spec.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index d492e8fc6b7..0475f132b41 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -970,6 +970,7 @@ echo "=====" >> $STATUS_HISTORY %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqldumpslow.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_plugin.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_secure_installation.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_setpermission.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1* @@ -996,11 +997,11 @@ echo "=====" >> $STATUS_HISTORY %attr(755, root, root) %{_bindir}/mysql_convert_table_format %attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_install_db +%attr(755, root, root) %{_bindir}/mysql_plugin %attr(755, root, root) %{_bindir}/mysql_secure_installation %attr(755, root, root) %{_bindir}/mysql_setpermission %attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql %attr(755, root, root) %{_bindir}/mysql_upgrade -%attr(755, root, root) %{_bindir}/mysql_plugin %attr(755, root, root) %{_bindir}/mysql_zap %attr(755, root, root) %{_bindir}/mysqlbug %attr(755, root, root) %{_bindir}/mysqld_multi @@ -1133,6 +1134,10 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Tue Aug 30 2011 Joerg Bruehe + +- Add the manual page for "mysql_plugin" to the server package. + * Fri Aug 19 2011 Joerg Bruehe - Null-upmerge the fix of bug#37165: This spec file is not affected. From 739b8bec1249cb7c721e8aee4186accb0f8cccfb Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 31 Aug 2011 16:45:52 +0200 Subject: [PATCH 02/29] Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX Post-push fix: Enable filesort pattern two, perfschema.selects failed. --- mysql-test/valgrind.supp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index d85ce5e3f86..571712a4089 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -894,16 +894,17 @@ fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPy } -## { -## Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / two -## Memcheck:Param -## write(buf) -## obj:*/libpthread*.so -## fun:my_write -## fun:my_b_flush_io_cache -## fun:_Z15merge_many_buffP13st_sort_paramPhP10st_buffpekPjP11st_io_cache -## fun:_Z8filesortP3THDP8st_tableP13st_sort_fieldjP10SQL_SELECTybPy -## } +{ + Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / two + Memcheck:Param + write(buf) + obj:*/libpthread*.so + fun:my_write + fun:inline_mysql_file_write + fun:my_b_flush_io_cache + fun:_Z15merge_many_buffP13st_sort_paramPhP10st_buffpekPjP11st_io_cache + fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPy +} { Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / three From 4c57188c9c03dc2cb96e57ffcddc4a10dac9e4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 1 Sep 2011 21:48:04 +0300 Subject: [PATCH 03/29] Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE This fix was accidentally pushed to mysql-5.1 after the 5.1.59 clone-off in bzr revision id marko.makela@oracle.com-20110829081642-z0w992a0mrc62s6w with the fix of Bug#12704861 Corruption after a crash during BLOB update but not merged to mysql-5.5 and upwards. In the Barracuda formats, the clustered index record no longer contains a prefix of off-page columns. Because of this, the undo log must contain these prefixes, so that purge and multi-versioning will continue to work. However, this also means that an undo log record can become too big to fit in an undo log page. (It is a limitation of the undo log that undo records cannot span across multiple pages.) In case the checks for undo log size fail when CREATE TABLE or CREATE INDEX is executed, we need a fallback that blocks a modification operation when the undo log record would exceed the maximum size. trx_undo_free_last_page_func(): Renamed from trx_undo_free_page_in_rollback(). Define the trx_t parameter only in debug builds. trx_undo_free_last_page(): Wrapper for trx_undo_free_last_page_func(). Pass the trx_t parameter only in debug builds. trx_undo_truncate_end_func(): Renamed from trx_undo_truncate_end(). Define the trx_t parameter only in debug builds. Rewrite a for(;;) loop as a while loop for clarity. trx_undo_truncate_end(): Wrapper for from trx_undo_truncate_end_func(). Pass the trx_t parameter only in debug builds. trx_undo_erase_page_end(): Return TRUE if the page was non-empty to begin with. Refuse to erase empty pages. trx_undo_report_row_operation(): If the page for which the undo log was too big was empty, free the undo page and return DB_TOO_BIG_RECORD. rb:749 approved by Inaam Rana --- include/my_base.h | 3 +- mysql-test/suite/innodb/r/innodb-index.result | 9 +++ mysql-test/suite/innodb/t/innodb-index.test | 13 ++++ mysys/my_handler_errors.h | 3 +- sql/handler.cc | 3 + sql/share/errmsg-utf8.txt | 3 + storage/innobase/handler/ha_innodb.cc | 2 + storage/innobase/include/db0err.h | 3 +- storage/innobase/include/trx0undo.h | 46 +++++++++++-- storage/innobase/row/row0mysql.c | 1 + storage/innobase/trx/trx0rec.c | 69 +++++++++++++------ storage/innobase/trx/trx0undo.c | 66 +++++++++--------- storage/innobase/ut/ut0ut.c | 2 + 13 files changed, 158 insertions(+), 65 deletions(-) diff --git a/include/my_base.h b/include/my_base.h index cc02b0080d9..d9f08a3c467 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -448,7 +448,8 @@ enum ha_base_keytype { #define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */ #define HA_ERR_INDEX_COL_TOO_LONG 178 /* Index column length exceeds limit */ #define HA_ERR_INDEX_CORRUPT 179 /* Index corrupted */ -#define HA_ERR_LAST 179 /* Copy of last error nr */ +#define HA_ERR_UNDO_REC_TOO_BIG 180 /* Undo log record too big */ +#define HA_ERR_LAST 180 /* Copy of last error nr */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index aa03c72022b..2e9ee652a76 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -975,6 +975,15 @@ INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r); UPDATE t1 SET a=1000; DELETE FROM t1; DROP TABLE t1; +CREATE TABLE bug12547647( +a INT NOT NULL, b BLOB NOT NULL, c TEXT, +PRIMARY KEY (b(10), a), INDEX (c(767)), INDEX(b(767)) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7751)); +COMMIT; +UPDATE bug12547647 SET c = REPEAT('b',16928); +ERROR HY000: Undo log record is too big. +DROP TABLE bug12547647; set global innodb_file_per_table=0; set global innodb_file_format=Antelope; set global innodb_file_format_max=Antelope; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index fad90e280fc..1df65afe94c 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -477,6 +477,19 @@ DELETE FROM t1; -- sleep 10 DROP TABLE t1; +# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE +CREATE TABLE bug12547647( +a INT NOT NULL, b BLOB NOT NULL, c TEXT, +PRIMARY KEY (b(10), a), INDEX (c(767)), INDEX(b(767)) +) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + +INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7751)); +COMMIT; +# The following used to cause infinite undo log allocation. +--error ER_UNDO_RECORD_TOO_BIG +UPDATE bug12547647 SET c = REPEAT('b',16928); +DROP TABLE bug12547647; + eval set global innodb_file_per_table=$per_table; eval set global innodb_file_format=$format; eval set global innodb_file_format_max=$format; diff --git a/mysys/my_handler_errors.h b/mysys/my_handler_errors.h index 428a58b0767..3533b633960 100644 --- a/mysys/my_handler_errors.h +++ b/mysys/my_handler_errors.h @@ -82,7 +82,8 @@ static const char *handler_error_messages[]= "Read page with wrong checksum", "Too many active concurrent transactions", "Index column length exceeds limit", - "Index corrupted" + "Index corrupted", + "Undo record too big" }; extern void my_handler_error_register(void); diff --git a/sql/handler.cc b/sql/handler.cc index db1eea6484b..6f7cf2c3456 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2869,6 +2869,9 @@ void handler::print_error(int error, myf errflag) case HA_ERR_INDEX_CORRUPT: textno= ER_INDEX_CORRUPT; break; + case HA_ERR_UNDO_REC_TOO_BIG: + textno= ER_UNDO_RECORD_TOO_BIG; + break; default: { /* The error was "unknown" to this function. diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 519d693f96d..58dea797dda 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6417,3 +6417,6 @@ ER_ERROR_IN_UNKNOWN_TRIGGER_BODY ER_INDEX_CORRUPT eng "Index %s is corrupted" + +ER_UNDO_RECORD_TOO_BIG + eng "Undo log record is too big." diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c4283d65a2a..7592b201ceb 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1045,6 +1045,8 @@ convert_error_code_to_mysql( return(HA_ERR_UNSUPPORTED); case DB_INDEX_CORRUPT: return(HA_ERR_INDEX_CORRUPT); + case DB_UNDO_RECORD_TOO_BIG: + return(HA_ERR_UNDO_REC_TOO_BIG); } } diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index 415470b61b4..e0952f0709d 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -111,6 +111,7 @@ enum db_err { DB_TOO_BIG_INDEX_COL, /* index column size exceeds maximum limit */ DB_INDEX_CORRUPT, /* we have corrupted index */ + DB_UNDO_RECORD_TOO_BIG, /* the undo log record is too big */ /* The following are partial failure codes */ DB_FAIL = 1000, diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index df16c939070..50aa6d0ac09 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -204,17 +204,51 @@ trx_undo_add_page( mtr_t* mtr); /*!< in: mtr which does not have a latch to any undo log page; the caller must have reserved the rollback segment mutex */ +/********************************************************************//** +Frees the last undo log page. +The caller must hold the rollback segment mutex. */ +UNIV_INTERN +void +trx_undo_free_last_page_func( +/*==========================*/ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction */ +#endif /* UNIV_DEBUG */ + trx_undo_t* undo, /*!< in/out: undo log memory copy */ + mtr_t* mtr) /*!< in/out: mini-transaction which does not + have a latch to any undo log page or which + has allocated the undo log page */ + __attribute__((nonnull)); +#ifdef UNIV_DEBUG +# define trx_undo_free_last_page(trx,undo,mtr) \ + trx_undo_free_last_page_func(trx,undo,mtr) +#else /* UNIV_DEBUG */ +# define trx_undo_free_last_page(trx,undo,mtr) \ + trx_undo_free_last_page_func(undo,mtr) +#endif /* UNIV_DEBUG */ + /***********************************************************************//** Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end( -/*==================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ - trx_undo_t* undo, /*!< in: undo log */ - undo_no_t limit); /*!< in: all undo records with undo number +trx_undo_truncate_end_func( +/*=======================*/ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction whose undo log it is */ +#endif /* UNIV_DEBUG */ + trx_undo_t* undo, /*!< in/out: undo log */ + undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ + __attribute__((nonnull)); +#ifdef UNIV_DEBUG +# define trx_undo_truncate_end(trx,undo,limit) \ + trx_undo_truncate_end_func(trx,undo,limit) +#else /* UNIV_DEBUG */ +# define trx_undo_truncate_end(trx,undo,limit) \ + trx_undo_truncate_end_func(undo,limit) +#endif /* UNIV_DEBUG */ + /***********************************************************************//** Truncates an undo log from the start. This function is used during a purge operation. */ diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index d98d47a5da6..dd3aeef78ac 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -576,6 +576,7 @@ handle_new_error: case DB_DUPLICATE_KEY: case DB_FOREIGN_DUPLICATE_KEY: case DB_TOO_BIG_RECORD: + case DB_UNDO_RECORD_TOO_BIG: case DB_ROW_IS_REFERENCED: case DB_NO_REFERENCED_ROW: case DB_CANNOT_ADD_CONSTRAINT: diff --git a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c index 5f83a9f5fd9..80c3d274e7c 100644 --- a/storage/innobase/trx/trx0rec.c +++ b/storage/innobase/trx/trx0rec.c @@ -669,7 +669,6 @@ trx_undo_page_report_modify( /* Save to the undo log the old values of the columns to be updated. */ if (update) { - if (trx_undo_left(undo_page, ptr) < 5) { return(0); @@ -1119,22 +1118,29 @@ trx_undo_rec_get_partial_row( #endif /* !UNIV_HOTBACKUP */ /***********************************************************************//** -Erases the unused undo log page end. */ -static -void +Erases the unused undo log page end. +@return TRUE if the page contained something, FALSE if it was empty */ +static __attribute__((nonnull, warn_unused_result)) +ibool trx_undo_erase_page_end( /*====================*/ - page_t* undo_page, /*!< in: undo page whose end to erase */ - mtr_t* mtr) /*!< in: mtr */ + page_t* undo_page, /*!< in/out: undo page whose end to erase */ + mtr_t* mtr) /*!< in/out: mini-transaction */ { ulint first_free; first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE); + if (first_free == TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE) { + /* This was an empty page to begin with. + Do nothing here; the caller should free the page. */ + return(FALSE); + } memset(undo_page + first_free, 0xff, (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END) - first_free); mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr); + return(TRUE); } /***********************************************************//** @@ -1156,7 +1162,11 @@ trx_undo_parse_erase_page_end( return(ptr); } - trx_undo_erase_page_end(page, mtr); + if (!trx_undo_erase_page_end(page, mtr)) { + /* The function trx_undo_erase_page_end() should not + have done anything to an empty page. */ + ut_ad(0); + } return(ptr); } @@ -1202,6 +1212,9 @@ trx_undo_report_row_operation( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; +#ifdef UNIV_DEBUG + int loop_count = 0; +#endif /* UNIV_DEBUG */ rec_offs_init(offsets_); ut_a(dict_index_is_clust(index)); @@ -1264,7 +1277,7 @@ trx_undo_report_row_operation( mtr_start(&mtr); - for (;;) { + do { buf_block_t* undo_block; page_t* undo_page; ulint offset; @@ -1293,7 +1306,19 @@ trx_undo_report_row_operation( version the replicate page constructed using the log records stays identical to the original page */ - trx_undo_erase_page_end(undo_page, &mtr); + if (!trx_undo_erase_page_end(undo_page, &mtr)) { + /* The record did not fit on an empty + undo page. Discard the freshly allocated + page and return an error. */ + + mutex_enter(&rseg->mutex); + trx_undo_free_last_page(trx, undo, &mtr); + mutex_exit(&rseg->mutex); + + err = DB_UNDO_RECORD_TOO_BIG; + goto err_exit; + } + mtr_commit(&mtr); } else { /* Success */ @@ -1313,16 +1338,15 @@ trx_undo_report_row_operation( *roll_ptr = trx_undo_build_roll_ptr( op_type == TRX_UNDO_INSERT_OP, rseg->id, page_no, offset); - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - return(DB_SUCCESS); + err = DB_SUCCESS; + goto func_exit; } ut_ad(page_no == undo->last_page_no); /* We have to extend the undo log by one page */ + ut_ad(++loop_count < 2); mtr_start(&mtr); /* When we add a page to an undo log, this is analogous to @@ -1334,18 +1358,19 @@ trx_undo_report_row_operation( page_no = trx_undo_add_page(trx, undo, &mtr); mutex_exit(&(rseg->mutex)); + } while (UNIV_LIKELY(page_no != FIL_NULL)); - if (UNIV_UNLIKELY(page_no == FIL_NULL)) { - /* Did not succeed: out of space */ + /* Did not succeed: out of space */ + err = DB_OUT_OF_FILE_SPACE; - mutex_exit(&(trx->undo_mutex)); - mtr_commit(&mtr); - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - return(DB_OUT_OF_FILE_SPACE); - } +err_exit: + mutex_exit(&trx->undo_mutex); + mtr_commit(&mtr); +func_exit: + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); } + return(err); } /*============== BUILDING PREVIOUS VERSION OF A RECORD ===============*/ diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c index 060a537c472..805fdcee242 100644 --- a/storage/innobase/trx/trx0undo.c +++ b/storage/innobase/trx/trx0undo.c @@ -1004,29 +1004,28 @@ trx_undo_free_page( } /********************************************************************//** -Frees an undo log page when there is also the memory object for the undo -log. */ -static +Frees the last undo log page. +The caller must hold the rollback segment mutex. */ +UNIV_INTERN void -trx_undo_free_page_in_rollback( -/*===========================*/ - trx_t* trx __attribute__((unused)), /*!< in: transaction */ - trx_undo_t* undo, /*!< in: undo log memory copy */ - ulint page_no,/*!< in: page number to free: must not be the - header page */ - mtr_t* mtr) /*!< in: mtr which does not have a latch to any - undo log page; the caller must have reserved - the rollback segment mutex */ +trx_undo_free_last_page_func( +/*==========================*/ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction */ +#endif /* UNIV_DEBUG */ + trx_undo_t* undo, /*!< in/out: undo log memory copy */ + mtr_t* mtr) /*!< in/out: mini-transaction which does not + have a latch to any undo log page or which + has allocated the undo log page */ { - ulint last_page_no; + ut_ad(mutex_own(&trx->undo_mutex)); + ut_ad(undo->hdr_page_no != undo->last_page_no); + ut_ad(undo->size > 0); - ut_ad(undo->hdr_page_no != page_no); - ut_ad(mutex_own(&(trx->undo_mutex))); + undo->last_page_no = trx_undo_free_page( + undo->rseg, FALSE, undo->space, + undo->hdr_page_no, undo->last_page_no, mtr); - last_page_no = trx_undo_free_page(undo->rseg, FALSE, undo->space, - undo->hdr_page_no, page_no, mtr); - - undo->last_page_no = last_page_no; undo->size--; } @@ -1062,9 +1061,11 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end( -/*==================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ +trx_undo_truncate_end_func( +/*=======================*/ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction whose undo log it is */ +#endif /* UNIV_DEBUG */ trx_undo_t* undo, /*!< in: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ @@ -1090,18 +1091,7 @@ trx_undo_truncate_end( rec = trx_undo_page_get_last_rec(undo_page, undo->hdr_page_no, undo->hdr_offset); - for (;;) { - if (rec == NULL) { - if (last_page_no == undo->hdr_page_no) { - - goto function_exit; - } - - trx_undo_free_page_in_rollback( - trx, undo, last_page_no, &mtr); - break; - } - + while (rec) { if (trx_undo_rec_get_undo_no(rec) >= limit) { /* Truncate at least this record off, maybe more */ @@ -1115,6 +1105,14 @@ trx_undo_truncate_end( undo->hdr_offset); } + if (last_page_no == undo->hdr_page_no) { + + goto function_exit; + } + + ut_ad(last_page_no == undo->last_page_no); + trx_undo_free_last_page(trx, undo, &mtr); + mtr_commit(&mtr); } diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index bd009f1fd32..f6dfb3ba0b3 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -714,6 +714,8 @@ ut_strerr( return("No index on referenced keys in referenced table"); case DB_INDEX_CORRUPT: return("Index corrupted"); + case DB_UNDO_RECORD_TOO_BIG: + return("Undo record too big"); case DB_END_OF_INDEX: return("End of index"); /* do not add default: in order to produce a warning if new code From e7b37d7258249a66f0a417bf46741b3946aee323 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 2 Sep 2011 16:52:04 +0530 Subject: [PATCH 04/29] BUG#11878394 - MYSQLD_SAFE TEST FOR ALREADY RUNNING PROCESS FAILS, CAUSING CLOBBERED SOCKET A check for running mysqld instances was failing in mysqld_safe because of an incorrect shell command generated by cmake. The problem is that cmake retains the '\' of escaped double-quote, so the generated mysqld_safe script's command contained \" in the shell command, and hence the failure. Fixed the command in scripts\CMakeLists.txt. --- scripts/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 56b7f779bb0..2efb348fcd5 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -104,11 +104,11 @@ IF(UNIX) # FIND_PROC and CHECK_PID are used by mysqld_safe IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET (FIND_PROC - "ps wwwp $PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" > /dev/null") + "ps wwwp $PID | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null") ENDIF() IF(NOT FIND_PROC AND CMAKE_SYSTEM_NAME MATCHES "SunOS") SET (FIND_PROC - "ps -p $PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" > /dev/null") + "ps -p $PID | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null") ENDIF() IF(NOT FIND_PROC) @@ -116,7 +116,7 @@ IF(NOT FIND_PROC) EXECUTE_PROCESS(COMMAND ps -uaxww OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result) IF(result MATCHES 0) SET( FIND_PROC - "ps -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" | grep \" $PID \" > /dev/null") + "ps -uaxww | grep -v mysqld_safe | grep -- $MYSQLD | grep $PID > /dev/null") ENDIF() ENDIF() @@ -124,7 +124,7 @@ IF(NOT FIND_PROC) # SysV style EXECUTE_PROCESS(COMMAND ps -ef OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result) IF(result MATCHES 0) - SET( FIND_PROC "ps -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" | grep \" $PID \" > /dev/null") + SET( FIND_PROC "ps -ef | grep -v mysqld_safe | grep -- $MYSQLD | grep $PID > /dev/null") ENDIF() ENDIF() From cd347313c015fce859bc5300f3266265a0e8365d Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Mon, 5 Sep 2011 16:04:33 +0200 Subject: [PATCH 05/29] Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX Post-push fix: Replace fun:inline_mysql_file_write with '...' since it may be optimized away. --- mysql-test/valgrind.supp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 571712a4089..0ea50c92985 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -880,13 +880,16 @@ # Note the wildcard in the (mangled) function signatures of # write_keys() and find_all_keys(). # They both return ha_rows, which is platform dependent. +# +# The '...' wildcards are for 'fun:inline_mysql_file_write' which *may* +# be inlined. { Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / one Memcheck:Param write(buf) obj:*/libpthread*.so fun:my_write - fun:inline_mysql_file_write + ... fun:my_b_flush_io_cache fun:_my_b_write fun:_Z*10write_keysP13st_sort_paramPPhjP11st_io_cacheS4_ @@ -900,7 +903,7 @@ write(buf) obj:*/libpthread*.so fun:my_write - fun:inline_mysql_file_write + ... fun:my_b_flush_io_cache fun:_Z15merge_many_buffP13st_sort_paramPhP10st_buffpekPjP11st_io_cache fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPy @@ -912,7 +915,7 @@ write(buf) obj:*/libpthread*.so fun:my_write - fun:inline_mysql_file_write + ... fun:my_b_flush_io_cache fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPy } From 380e7babcc53c1b22663847c066d4ba92978c314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 6 Sep 2011 10:04:21 +0300 Subject: [PATCH 06/29] Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE - take 2 The original fix was accidentally pushed to mysql-5.1 after the 5.1.59 clone-off in bzr revision id marko.makela@oracle.com-20110829081642-z0w992a0mrc62s6w with thne fix of Bug#12704861 Corruption after a crash during BLOB update. It was pushed separately to mysql-5.5 in bzr revision id marko.makela@oracle.com-20110901184804-2901f6qmuro3jas8. trx_undo_report_row_operation(): If the page for which the undo log was too big was empty, commit and start the mini-transaction before acquiring the rollback segment mutex and freeing the undo page. This is necessary, because the mini-transaction may be holding lower-order latches in the levels SYNC_FSP and SYNC_FSP_PAGE. trx_undo_erase_page_end(): Erase also empty pages, because trx_undo_report_row_operation() needs to commit the mini-transaction before freeing the empty page. rb:756 approved by Sunny Bains --- storage/innodb_plugin/ChangeLog | 10 +++++----- storage/innodb_plugin/trx/trx0rec.c | 27 +++++++++++++++------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 96b6a47085a..328cafff58f 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2011-09-06 The InnoDB Team + + * include/trx0undo.h, trx/trx0rec.c, trx/trx0undo.c: + Fix Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE + 2011-08-29 The InnoDB Team * btr/btr0btr.c, btr/btr0cur.c, fsp/fsp0fsp.c, @@ -7,11 +12,6 @@ Fix Bug#12704861 Corruption after a crash during BLOB update and other regressions from the fix of Bug#12612184 -2011-08-23 The InnoDB Team - - * include/trx0undo.h, trx/trx0rec.c, trx/trx0undo.c: - Fix Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE - 2011-08-15 The InnoDB Team * btr/btr0btr.c, btr/btr0cur.c, btr/btr0pcur.c, btr/btr0sea.c, diff --git a/storage/innodb_plugin/trx/trx0rec.c b/storage/innodb_plugin/trx/trx0rec.c index a729a39d0cc..2db98e029df 100644 --- a/storage/innodb_plugin/trx/trx0rec.c +++ b/storage/innodb_plugin/trx/trx0rec.c @@ -1099,7 +1099,7 @@ trx_undo_rec_get_partial_row( /***********************************************************************//** Erases the unused undo log page end. @return TRUE if the page contained something, FALSE if it was empty */ -static __attribute__((nonnull, warn_unused_result)) +static __attribute__((nonnull)) ibool trx_undo_erase_page_end( /*====================*/ @@ -1110,16 +1110,11 @@ trx_undo_erase_page_end( first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE); - if (first_free == TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE) { - /* This was an empty page to begin with. - Do nothing here; the caller should free the page. */ - return(FALSE); - } memset(undo_page + first_free, 0xff, (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END) - first_free); mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr); - return(TRUE); + return(first_free != TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE); } /***********************************************************//** @@ -1141,11 +1136,7 @@ trx_undo_parse_erase_page_end( return(ptr); } - if (!trx_undo_erase_page_end(page, mtr)) { - /* The function trx_undo_erase_page_end() should not - have done anything to an empty page. */ - ut_ad(0); - } + trx_undo_erase_page_end(page, mtr); return(ptr); } @@ -1290,6 +1281,18 @@ trx_undo_report_row_operation( undo page. Discard the freshly allocated page and return an error. */ + /* When we remove a page from an undo + log, this is analogous to a + pessimistic insert in a B-tree, and we + must reserve the counterpart of the + tree latch, which is the rseg + mutex. We must commit the mini-transaction + first, because it may be holding lower-level + latches, such as SYNC_FSP and SYNC_FSP_PAGE. */ + + mtr_commit(&mtr); + mtr_start(&mtr); + mutex_enter(&rseg->mutex); trx_undo_free_last_page(trx, undo, &mtr); mutex_exit(&rseg->mutex); From 7088d13d8339acc2cc60ebd27c9b2880a1b5553e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 6 Sep 2011 10:08:52 +0300 Subject: [PATCH 07/29] Bug #12950803 62294: BUF_BUDDY_RELOCATE CALLS GETTIMEOFDAY ... buf_buddy_relocate(): The ut_time_us() function is needed for statistics, calculating the total time spent on relocating blocks. Until now, we invoked ut_time_us() every time buf_buddy_relocate() was called. Fix: Only call ut_time_us() when the block can be relocated. After this fix, the reported relocated_usec will no longer include the time for the page_hash lookup and for acquiring the block mutex. Approved by Sunny Bains on IM --- storage/innodb_plugin/ChangeLog | 6 ++++++ storage/innodb_plugin/buf/buf0buddy.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 328cafff58f..a29aaf2077e 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2011-09-06 The InnoDB Team + + * buf/buf0buddy.c: + Fix Bug#12950803 62294: BUF_BUDDY_RELOCATE CALLS GETTIMEOFDAY + WHILE HOLDING BUFFER POOL MUTEX + 2011-09-06 The InnoDB Team * include/trx0undo.h, trx/trx0rec.c, trx/trx0undo.c: diff --git a/storage/innodb_plugin/buf/buf0buddy.c b/storage/innodb_plugin/buf/buf0buddy.c index de571743361..efc4fd46e90 100644 --- a/storage/innodb_plugin/buf/buf0buddy.c +++ b/storage/innodb_plugin/buf/buf0buddy.c @@ -327,7 +327,6 @@ buf_buddy_relocate( { buf_page_t* bpage; const ulint size = BUF_BUDDY_LOW << i; - ullint usec = ut_time_us(NULL); mutex_t* mutex; ulint space; ulint page_no; @@ -394,6 +393,7 @@ buf_buddy_relocate( if (buf_page_can_relocate(bpage)) { /* Relocate the compressed page. */ + ullint usec = ut_time_us(NULL); ut_a(bpage->zip.data == src); memcpy(dst, src, size); bpage->zip.data = dst; From 982e1ce757a0001f03d02ff5f05f96fbdfe9bd1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 6 Sep 2011 10:18:03 +0300 Subject: [PATCH 08/29] Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() - cleanup Remove the unused debug constants for the latching order level SYNC_THR_LOCAL. --- storage/innobase/include/sync0sync.h | 1 - storage/innobase/sync/sync0sync.c | 1 - 2 files changed, 2 deletions(-) diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index 9c0d5e3c302..f6b8897522f 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -684,7 +684,6 @@ or row lock! */ #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */ #define SYNC_DOUBLEWRITE 140 #define SYNC_ANY_LATCH 135 -#define SYNC_THR_LOCAL 133 #define SYNC_MEM_HASH 131 #define SYNC_MEM_POOL 130 diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c index 5de8dfe0a6f..8e082be33f7 100644 --- a/storage/innobase/sync/sync0sync.c +++ b/storage/innobase/sync/sync0sync.c @@ -1214,7 +1214,6 @@ sync_thread_add_level( case SYNC_WORK_QUEUE: case SYNC_LOG: case SYNC_LOG_FLUSH_ORDER: - case SYNC_THR_LOCAL: case SYNC_ANY_LATCH: case SYNC_FILE_FORMAT_TAG: case SYNC_DOUBLEWRITE: From ecdc6cc21a3b199c64ecf906d66117c0060d38c0 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 6 Sep 2011 21:06:09 +0530 Subject: [PATCH 09/29] Bug#11765888 58898: MYSQL_INSTALL_DB: NOT ALL OPTIONS DOCUMENTED (EG: --DEFAULTS-FILE ) Added help message for the missing options (--no-defaults, --defaults-file and --defaults-extra-file). --- scripts/mysql_install_db.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index b9b31a2d78e..6fe9712b23a 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -46,10 +46,16 @@ Usage: $0 [OPTIONS] --cross-bootstrap For internal use. Used when building the MySQL system tables on a different host than the target. --datadir=path The path to the MySQL data directory. + --defaults-extra-file=name + Read this file after the global files are read. + + --defaults-file=name Only read default options from the given file name. --force Causes mysql_install_db to run even if DNS does not work. In that case, grant table entries that normally use hostnames will use IP addresses. + --help Display this help and exit. --ldata=path The path to the MySQL data directory. Same as --datadir. + --no-defaults Don't read default options from any option file. --rpm For internal use. This option is used by RPM files during the MySQL installation process. --skip-name-resolve Use IP addresses rather than hostnames when creating From 5485967706a71431d9de5c3081dd36e40a420abc Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 6 Sep 2011 21:25:28 +0530 Subject: [PATCH 10/29] Removing a stray line, went into the last push. --- scripts/mysql_install_db.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 6fe9712b23a..9782a37c462 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -48,7 +48,6 @@ Usage: $0 [OPTIONS] --datadir=path The path to the MySQL data directory. --defaults-extra-file=name Read this file after the global files are read. - --defaults-file=name Only read default options from the given file name. --force Causes mysql_install_db to run even if DNS does not work. In that case, grant table entries that normally From c6b1828886f09bae99db9f8b00b792cf6b754136 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 6 Sep 2011 21:50:04 +0530 Subject: [PATCH 11/29] Bug#11765888 58898: MYSQL_INSTALL_DB: NOT ALL OPTIONS DOCUMENTED (EG: --DEFAULTS-FILE ) Updating help message in scripts/mysql_install_db.pl.in file. --- scripts/mysql_install_db.pl.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index 18bd713c041..7bc1e97e7be 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -61,10 +61,15 @@ Usage: $0 [OPTIONS] --cross-bootstrap For internal use. Used when building the MySQL system tables on a different host than the target. --datadir=path The path to the MySQL data directory. + --defaults-extra-file=name + Read this file after the global files are read. + --defaults-file=name Only read default options from the given file name. --force Causes mysql_install_db to run even if DNS does not work. In that case, grant table entries that normally use hostnames will use IP addresses. + --help Display this help and exit. --ldata=path The path to the MySQL data directory. Same as --datadir. + --no-defaults Don't read default options from any option file. --rpm For internal use. This option is used by RPM files during the MySQL installation process. --skip-name-resolve Use IP addresses rather than hostnames when creating From 1ebfa44b927bbea3b249d156a0bc20f99f109908 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 7 Sep 2011 17:58:10 +0300 Subject: [PATCH 12/29] Use cursors for seeking records in SYS_FOREIGN and SYS_INDEXES from DROP_TABLE_PROC(). With this change I observe a speedup from 6.2s to 0.1s when executing DROP_TABLE_PROC() during DROP TABLE with 512 foreign keys, like what is being done in innodb_bug56143.test This fixes "Bug#11765460 DROP TABLE USES INEFFICIENT METHODS TO REMOVE FKS/INDEXES FROM INNODB SYS TABLES" Reviewed by: Marko --- storage/innodb_plugin/row/row0mysql.c | 29 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index c4911400cee..4e6a49cf8b0 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -3221,6 +3221,19 @@ check_next_foreign: "index_id CHAR;\n" "foreign_id CHAR;\n" "found INT;\n" + + "DECLARE CURSOR cur_fk IS\n" + "SELECT ID FROM SYS_FOREIGN\n" + "WHERE FOR_NAME = :table_name\n" + "AND TO_BINARY(FOR_NAME)\n" + " = TO_BINARY(:table_name)\n" + "LOCK IN SHARE MODE;\n" + + "DECLARE CURSOR cur_idx IS\n" + "SELECT ID FROM SYS_INDEXES\n" + "WHERE TABLE_ID = table_id\n" + "LOCK IN SHARE MODE;\n" + "BEGIN\n" "SELECT ID INTO table_id\n" "FROM SYS_TABLES\n" @@ -3243,13 +3256,9 @@ check_next_foreign: "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" " found := 0;\n" "END IF;\n" + "OPEN cur_fk;\n" "WHILE found = 1 LOOP\n" - " SELECT ID INTO foreign_id\n" - " FROM SYS_FOREIGN\n" - " WHERE FOR_NAME = :table_name\n" - " AND TO_BINARY(FOR_NAME)\n" - " = TO_BINARY(:table_name)\n" - " LOCK IN SHARE MODE;\n" + " FETCH cur_fk INTO foreign_id;\n" " IF (SQL % NOTFOUND) THEN\n" " found := 0;\n" " ELSE\n" @@ -3259,12 +3268,11 @@ check_next_foreign: " WHERE ID = foreign_id;\n" " END IF;\n" "END LOOP;\n" + "CLOSE cur_fk;\n" "found := 1;\n" + "OPEN cur_idx;\n" "WHILE found = 1 LOOP\n" - " SELECT ID INTO index_id\n" - " FROM SYS_INDEXES\n" - " WHERE TABLE_ID = table_id\n" - " LOCK IN SHARE MODE;\n" + " FETCH cur_idx INTO index_id;\n" " IF (SQL % NOTFOUND) THEN\n" " found := 0;\n" " ELSE\n" @@ -3275,6 +3283,7 @@ check_next_foreign: " AND TABLE_ID = table_id;\n" " END IF;\n" "END LOOP;\n" + "CLOSE cur_idx;\n" "DELETE FROM SYS_COLUMNS\n" "WHERE TABLE_ID = table_id;\n" "DELETE FROM SYS_TABLES\n" From c77928b47302f8a41b7fc9b69782ae16b8c911d8 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 8 Sep 2011 11:10:26 +0100 Subject: [PATCH 13/29] BUG#12818224: 61921: WRITETRAXINBINLOG SHOULD BE WRITETRANXINBINLOG IN SEMISYNC_MASTER.CC Fixing typo: writeTraxInBinlog() => writeTranxInBinlog() . Additionally, fixed identation. --- plugin/semisync/semisync_master.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 1f92c60913e..1be876d0f1b 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -312,18 +312,18 @@ int ActiveTranx::clear_active_tranx_nodes(const char *log_file_name, * The most important functions during semi-syn replication listed: * * Master: - * . reportReplyBinlog(): called by the binlog dump thread when it receives - * the slave's status information. - * . updateSyncHeader(): based on transaction waiting information, decide - * whether to request the slave to reply. - * . writeTraxInBinlog(): called by the transaction thread when it finishes - * writing all transaction events in binlog. - * . commitTrx(): transaction thread wait for the slave reply. + * . reportReplyBinlog(): called by the binlog dump thread when it receives + * the slave's status information. + * . updateSyncHeader(): based on transaction waiting information, decide + * whether to request the slave to reply. + * . writeTranxInBinlog(): called by the transaction thread when it finishes + * writing all transaction events in binlog. + * . commitTrx(): transaction thread wait for the slave reply. * * Slave: * . slaveReadSyncHeader(): read the semi-sync header from the master, get the - * sync status and get the payload for events. - * . slaveReply(): reply to the master about the replication progress. + * sync status and get the payload for events. + * . slaveReply(): reply to the master about the replication progress. * ******************************************************************************/ From 928b12e540572a3e26606edfed44389dffb167b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 8 Sep 2011 15:54:15 +0300 Subject: [PATCH 14/29] Bug#11766591 59733: POSSIBLE DEADLOCK WHEN BUFFERED CHANGES ARE DISCARDED Tweak the faulty UNIV_SYNC_DEBUG diagnostics a little bit more. ibuf_add_free_page(): Lower the latching order of the newly allocated page only after acquiring the ibuf_mutex. --- storage/innobase/ibuf/ibuf0ibuf.c | 8 ++++---- storage/innodb_plugin/ibuf/ibuf0ibuf.c | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 71ecc7ec49f..8f151e39958 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -1683,14 +1683,14 @@ ibuf_add_free_page( page = buf_page_get(space, page_no, RW_X_LATCH, &mtr); -#ifdef UNIV_SYNC_DEBUG - buf_page_dbg_add_level(page, SYNC_TREE_NODE_NEW); -#endif /* UNIV_SYNC_DEBUG */ - ibuf_enter(); mutex_enter(&ibuf_mutex); +#ifdef UNIV_SYNC_DEBUG + buf_page_dbg_add_level(page, SYNC_TREE_NODE_NEW); +#endif /* UNIV_SYNC_DEBUG */ + root = ibuf_tree_root_get(ibuf_data, space, &mtr); /* Add the page to the free list and update the ibuf size data */ diff --git a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c index effd7b9572b..7aaf8f95bc5 100644 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c @@ -1766,16 +1766,15 @@ ibuf_add_free_page(void) block = buf_page_get( IBUF_SPACE_ID, 0, page_no, RW_X_LATCH, &mtr); - buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); + ibuf_enter(); + mutex_enter(&ibuf_mutex); + + buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); page = buf_block_get_frame(block); } - ibuf_enter(); - - mutex_enter(&ibuf_mutex); - root = ibuf_tree_root_get(&mtr); /* Add the page to the free list and update the ibuf size data */ From 9f4aae8b76fe79b7054ecf9fb62d1bf01adb9e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 8 Sep 2011 16:10:24 +0300 Subject: [PATCH 15/29] Bug#12948130 UNNECESSARY X-LOCKING OF ADAPTIVE HASH INDEX (BTR_SEARCH_LATCH) InnoDB acquires an x-latch on btr_search_latch for certain in-place updates that do affect the adaptive hash index. These operations do not really need to be protected by the btr_search_latch: * updating DB_TRX_ID * updating DB_ROLL_PTR * updating PAGE_MAX_TRX_ID * updating the delete-mark flag rb:750 approved by Sunny Bains --- storage/innodb_plugin/ChangeLog | 5 ++ storage/innodb_plugin/btr/btr0cur.c | 61 ++++++++++++----------- storage/innodb_plugin/include/page0page.h | 5 +- storage/innodb_plugin/include/row0upd.ic | 5 -- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index a29aaf2077e..130a0f9afa2 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2011-09-08 The InnoDB Team + + * btr/btr0cur.c, include/page0page.h, include/row0upd.ic: + Fix Bug#12948130 UNNECESSARY X-LOCKING OF ADAPTIVE HASH INDEX + 2011-09-06 The InnoDB Team * buf/buf0buddy.c: diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index f1c2c2ddd5e..4baa21d7c71 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -1727,6 +1727,7 @@ btr_cur_update_in_place( roll_ptr_t roll_ptr = ut_dulint_zero; trx_t* trx; ulint was_delete_marked; + ibool is_hashed; mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; @@ -1768,7 +1769,21 @@ btr_cur_update_in_place( return(err); } - if (block->is_hashed) { + if (!(flags & BTR_KEEP_SYS_FLAG)) { + row_upd_rec_sys_fields(rec, NULL, + index, offsets, trx, roll_ptr); + } + + was_delete_marked = rec_get_deleted_flag( + rec, page_is_comp(buf_block_get_frame(block))); + + is_hashed = block->is_hashed; + + if (is_hashed) { + /* TO DO: Can we skip this if none of the fields + index->search_info->curr_n_fields + are being updated? */ + /* The function row_upd_changes_ord_field_binary works only if the update vector was built for a clustered index, we must NOT call it if index is secondary */ @@ -1784,17 +1799,9 @@ btr_cur_update_in_place( rw_lock_x_lock(&btr_search_latch); } - if (!(flags & BTR_KEEP_SYS_FLAG)) { - row_upd_rec_sys_fields(rec, NULL, - index, offsets, trx, roll_ptr); - } - - was_delete_marked = rec_get_deleted_flag( - rec, page_is_comp(buf_block_get_frame(block))); - row_upd_rec_in_place(rec, index, offsets, update, page_zip); - if (block->is_hashed) { + if (is_hashed) { rw_lock_x_unlock(&btr_search_latch); } @@ -2520,7 +2527,8 @@ btr_cur_parse_del_mark_set_clust_rec( /* We do not need to reserve btr_search_latch, as the page is only being recovered, and there cannot be a hash index to - it. */ + it. Besides, these fields are being updated in place + and the adaptive hash index does not depend on them. */ btr_rec_set_deleted_flag(rec, page_zip, val); @@ -2600,9 +2608,9 @@ btr_cur_del_mark_set_clust_rec( return(err); } - if (block->is_hashed) { - rw_lock_x_lock(&btr_search_latch); - } + /* The btr_search_latch is not needed here, because + the adaptive hash index does not depend on the delete-mark + and the delete-mark is being updated in place. */ page_zip = buf_block_get_page_zip(block); @@ -2616,10 +2624,6 @@ btr_cur_del_mark_set_clust_rec( index, offsets, trx, roll_ptr); } - if (block->is_hashed) { - rw_lock_x_unlock(&btr_search_latch); - } - btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx, roll_ptr, mtr); @@ -2695,7 +2699,8 @@ btr_cur_parse_del_mark_set_sec_rec( /* We do not need to reserve btr_search_latch, as the page is only being recovered, and there cannot be a hash index to - it. */ + it. Besides, the delete-mark flag is being updated in place + and the adaptive hash index does not depend on it. */ btr_rec_set_deleted_flag(rec, page_zip, val); } @@ -2743,16 +2748,11 @@ btr_cur_del_mark_set_sec_rec( ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(cursor->index->table)); - if (block->is_hashed) { - rw_lock_x_lock(&btr_search_latch); - } - + /* We do not need to reserve btr_search_latch, as the + delete-mark flag is being updated in place and the adaptive + hash index does not depend on it. */ btr_rec_set_deleted_flag(rec, buf_block_get_page_zip(block), val); - if (block->is_hashed) { - rw_lock_x_unlock(&btr_search_latch); - } - btr_cur_del_mark_set_sec_rec_log(rec, val, mtr); return(DB_SUCCESS); @@ -2772,8 +2772,11 @@ btr_cur_del_unmark_for_ibuf( uncompressed */ mtr_t* mtr) /*!< in: mtr */ { - /* We do not need to reserve btr_search_latch, as the page has just - been read to the buffer pool and there cannot be a hash index to it. */ + /* We do not need to reserve btr_search_latch, as the page + has just been read to the buffer pool and there cannot be + a hash index to it. Besides, the delete-mark flag is being + updated in place and the adaptive hash index does not depend + on it. */ btr_rec_set_deleted_flag(rec, page_zip, FALSE); diff --git a/storage/innodb_plugin/include/page0page.h b/storage/innodb_plugin/include/page0page.h index 9099fd7b65d..caf4cee2c57 100644 --- a/storage/innodb_plugin/include/page0page.h +++ b/storage/innodb_plugin/include/page0page.h @@ -68,10 +68,7 @@ typedef byte page_header_t; #define PAGE_MAX_TRX_ID 18 /* highest id of a trx which may have modified a record on the page; a dulint; defined only in secondary indexes and in the insert buffer - tree; NOTE: this may be modified only - when the thread has an x-latch to the page, - and ALSO an x-latch to btr_search_latch - if there is a hash index to the page! */ + tree */ #define PAGE_HEADER_PRIV_END 26 /* end of private data structure of the page header which are set in a page create */ /*----*/ diff --git a/storage/innodb_plugin/include/row0upd.ic b/storage/innodb_plugin/include/row0upd.ic index 0894ed373b0..11db82f64da 100644 --- a/storage/innodb_plugin/include/row0upd.ic +++ b/storage/innodb_plugin/include/row0upd.ic @@ -157,11 +157,6 @@ row_upd_rec_sys_fields( { ut_ad(dict_index_is_clust(index)); ut_ad(rec_offs_validate(rec, index, offsets)); -#ifdef UNIV_SYNC_DEBUG - if (!rw_lock_own(&btr_search_latch, RW_LOCK_EX)) { - ut_ad(!buf_block_align(rec)->is_hashed); - } -#endif /* UNIV_SYNC_DEBUG */ if (UNIV_LIKELY_NULL(page_zip)) { ulint pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID); From 6286d8af6548b1c93cfefcf6aafcb3f26e806425 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 9 Sep 2011 10:07:24 +0300 Subject: [PATCH 16/29] Disable the prefetch code in the InnoDB internal SQL parser. This change is a followup to vasil.dimov@oracle.com-20110907145810-v98kldmho23vhhic which triggered the usage of the prefetch and valgrind tests spat lots of warnings. The prefetch code will be removed. Discussed with: Marko (over IM) --- storage/innodb_plugin/row/row0sel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index 241584eaa20..aa3f6283c4f 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -63,7 +63,13 @@ Created 12/19/1997 Heikki Tuuri /* Number of rows fetched, after which to start prefetching; MySQL interface has another parameter */ -#define SEL_PREFETCH_LIMIT 1 +/* The prefetch code in the internal SQL is disabled because it has probably +never been used and has been found to contain a memory leak and a bug of +accessing uninitialized memory. Some simple performance tests show that +disabling it makes no difference in performance. It will be removed, but +until the removal happens we disable it by setting SEL_PREFETCH_LIMIT to a +high value. */ +#define SEL_PREFETCH_LIMIT 1000000000 /* When a select has accessed about this many pages, it returns control back to que_run_threads: this is to allow canceling runaway queries */ From 607a3e83ff30ed7596f9a3f428d7c014a1bbc7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 12 Sep 2011 10:12:15 +0300 Subject: [PATCH 17/29] Bug#12601439 CONSISTENT READ FAILURE IN COLUMN PREFIX INDEX When there is a secondary index on a column prefix of an externally stored column and an entry in the secondary index is shorter than the reserved prefix length, it should mean that the secondary index entry is holding the complete column value. When comparing this secondary index column value to the column in the clustered index row, we must compare the entire prefix that was fetched from the clustered index. The bug was that we would just compare that the column in the clustered index starts with the value found in the secondary index column. This bug affects only the InnoDB Barracuda formats (ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED), in which columns that are stored off-page in the clustered index do not contain any prefix in the clustered index record. row_sel_sec_rec_is_for_blob(): Add the parameter prefix_len, for ifield->prefix_len. Add some assertions. Sorry, I did not manage to produce a test case. This patch does produce correct results on the data set that Michael isolated on our test machine. That was with the purge and background rollback suspended, because they would make the bug go away. rb:760 approved by Sunny Bains --- storage/innodb_plugin/ChangeLog | 5 +++++ storage/innodb_plugin/row/row0sel.c | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 130a0f9afa2..ff6bd10dbe6 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2011-09-12 The InnoDB Team + + * row/row0sel.c: + Fix Bug#12601439 CONSISTENT READ FAILURE IN COLUMN PREFIX INDEX + 2011-09-08 The InnoDB Team * btr/btr0cur.c, include/page0page.h, include/row0upd.ic: diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index aa3f6283c4f..c9b409cbedd 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -107,12 +107,17 @@ row_sel_sec_rec_is_for_blob( ulint clust_len, /*!< in: length of clust_field */ const byte* sec_field, /*!< in: column in secondary index */ ulint sec_len, /*!< in: length of sec_field */ + ulint prefix_len, /*!< in: index column prefix length + in bytes */ ulint zip_size) /*!< in: compressed page size, or 0 */ { ulint len; byte buf[DICT_MAX_INDEX_COL_LEN]; ut_a(clust_len >= BTR_EXTERN_FIELD_REF_SIZE); + ut_ad(prefix_len >= sec_len); + ut_ad(prefix_len > 0); + ut_a(prefix_len <= sizeof buf); if (UNIV_UNLIKELY (!memcmp(clust_field + clust_len - BTR_EXTERN_FIELD_REF_SIZE, @@ -124,7 +129,7 @@ row_sel_sec_rec_is_for_blob( return(FALSE); } - len = btr_copy_externally_stored_field_prefix(buf, sizeof buf, + len = btr_copy_externally_stored_field_prefix(buf, prefix_len, zip_size, clust_field, clust_len); @@ -138,7 +143,7 @@ row_sel_sec_rec_is_for_blob( } len = dtype_get_at_most_n_mbchars(prtype, mbminlen, mbmaxlen, - sec_len, len, (const char*) buf); + prefix_len, len, (const char*) buf); return(!cmp_data_data(mtype, prtype, buf, len, sec_field, sec_len)); } @@ -225,11 +230,20 @@ row_sel_sec_rec_is_for_clust_rec( if (rec_offs_nth_extern(clust_offs, clust_pos) && len < sec_len) { + /* This function should never be + invoked on an Antelope format table, + because they should always contain + enough prefix in the clustered index + record. */ + ut_ad(dict_table_get_format(clust_index->table) + >= DICT_TF_FORMAT_ZIP); + if (!row_sel_sec_rec_is_for_blob( col->mtype, col->prtype, col->mbminlen, col->mbmaxlen, clust_field, clust_len, sec_field, sec_len, + ifield->prefix_len, dict_table_zip_size( clust_index->table))) { goto inequal; From 7e6cc0cd179323bc9b806ff08f1e78037676921c Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 12 Sep 2011 14:16:38 +0200 Subject: [PATCH 18/29] Add support for RHEL6 and OL6. --- support-files/mysql.spec.sh | 73 +++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 0475f132b41..3396717034a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -139,43 +139,62 @@ %endif %endif %else - %if %(test -f /etc/redhat-release && echo 1 || echo 0) - %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') - %if "%rhelver" == "4" - %define distro_description Red Hat Enterprise Linux 4 - %define distro_releasetag rhel4 + %if %(test -f /etc/oracle-release && echo 1 || echo 0) + %define elver %(rpm -qf --qf '%%{version}\\n' /etc/enterprise-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') + %if "%elver" == "6" + %define distro_description Oracle Linux 6 + %define distro_releasetag el6 %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools %else - %if "%rhelver" == "5" - %define distro_description Red Hat Enterprise Linux 5 - %define distro_releasetag rhel5 - %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel - %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools - %else - %{error:Red Hat Enterprise Linux %{rhelver} is unsupported} - %endif + %{error:Oracle Linux %{oelver} is unsupported} %endif %else - %if %(test -f /etc/SuSE-release && echo 1 || echo 0) - %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release) - %if "%susever" == "10" - %define distro_description SUSE Linux Enterprise Server 10 - %define distro_releasetag sles10 - %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel - %define distro_requires aaa_base coreutils grep procps pwdutils + %if %(test -f /etc/redhat-release && echo 1 || echo 0) + %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') + %if "%rhelver" == "4" + %define distro_description Red Hat Enterprise Linux 4 + %define distro_releasetag rhel4 + %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools %else - %if "%susever" == "11" - %define distro_description SUSE Linux Enterprise Server 11 - %define distro_releasetag sles11 - %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel - %define distro_requires aaa_base coreutils grep procps pwdutils + %if "%rhelver" == "5" + %define distro_description Red Hat Enterprise Linux 5 + %define distro_releasetag rhel5 + %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools %else - %{error:SuSE %{susever} is unsupported} + %if "%rhelver" == "6" + %define distro_description Red Hat Enterprise Linux 6 + %define distro_releasetag rhel6 + %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools + %else + %{error:Red Hat Enterprise Linux %{rhelver} is unsupported} + %endif %endif %endif %else - %{error:Unsupported distribution} + %if %(test -f /etc/SuSE-release && echo 1 || echo 0) + %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release) + %if "%susever" == "10" + %define distro_description SUSE Linux Enterprise Server 10 + %define distro_releasetag sles10 + %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel + %define distro_requires aaa_base coreutils grep procps pwdutils + %else + %if "%susever" == "11" + %define distro_description SUSE Linux Enterprise Server 11 + %define distro_releasetag sles11 + %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel + %define distro_requires aaa_base coreutils grep procps pwdutils + %else + %{error:SuSE %{susever} is unsupported} + %endif + %endif + %else + %{error:Unsupported distribution} + %endif %endif %endif %endif From d9d80740003ca0814d24de3402bfa887b4a0264f Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 12 Sep 2011 20:43:36 +0200 Subject: [PATCH 19/29] Fix typos in last. --- support-files/mysql.spec.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 3396717034a..5e999793b5e 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -140,14 +140,14 @@ %endif %else %if %(test -f /etc/oracle-release && echo 1 || echo 0) - %define elver %(rpm -qf --qf '%%{version}\\n' /etc/enterprise-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') + %define elver %(rpm -qf --qf '%%{version}\\n' /etc/oracle-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') %if "%elver" == "6" %define distro_description Oracle Linux 6 %define distro_releasetag el6 %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools %else - %{error:Oracle Linux %{oelver} is unsupported} + %{error:Oracle Linux %{elver} is unsupported} %endif %else %if %(test -f /etc/redhat-release && echo 1 || echo 0) From b1f927f5be0ebed27a635a532121aa5a5c876d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 13 Sep 2011 09:18:34 +0300 Subject: [PATCH 20/29] Hopefully final fix of Bug#11766591 59733: Possible deadlock when buffered changes are to be discarded ibuf_add_free_page(): Lower the latching order of the newly allocated page to SYNC_IBUF_TREE_NODE_NEW after latching the insert buffer tree root. This bug always was bogus UNIV_SYNC_DEBUG alarm. The function buf_block_dbg_add_level() is a no-op unless UNIV_SYNC_DEBUG is defined. --- storage/innobase/ibuf/ibuf0ibuf.c | 4 ++-- storage/innodb_plugin/ibuf/ibuf0ibuf.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 8f151e39958..1406b2de4e9 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -1687,12 +1687,12 @@ ibuf_add_free_page( mutex_enter(&ibuf_mutex); + root = ibuf_tree_root_get(ibuf_data, space, &mtr); + #ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(page, SYNC_TREE_NODE_NEW); #endif /* UNIV_SYNC_DEBUG */ - root = ibuf_tree_root_get(ibuf_data, space, &mtr); - /* Add the page to the free list and update the ibuf size data */ flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, diff --git a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c index 7aaf8f95bc5..e4d8f79a944 100644 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c @@ -1770,13 +1770,13 @@ ibuf_add_free_page(void) mutex_enter(&ibuf_mutex); + root = ibuf_tree_root_get(&mtr); + buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); page = buf_block_get_frame(block); } - root = ibuf_tree_root_get(&mtr); - /* Add the page to the free list and update the ibuf size data */ flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, From 07d898ab619e9565b35c19e1d864aaf32f92d6c3 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 13 Sep 2011 12:32:53 +0200 Subject: [PATCH 21/29] Bug #58241 Please exclude make_binary_distribution from the distribution With cmake (5.5 and up), "make package" will do it, or cpack. The (generated) "scripts/make_binary_distribution" is just a wrapper around a "cpack" call, with path names set at build time. Similar, "make_win_bin_dist" is not needed any more. --- scripts/CMakeLists.txt | 4 +- scripts/make_binary_distribution.sh | 342 ---------------------- scripts/make_win_bin_dist | 425 ---------------------------- support-files/mysql.spec.sh | 6 +- 4 files changed, 7 insertions(+), 770 deletions(-) delete mode 100644 scripts/make_binary_distribution.sh delete mode 100755 scripts/make_win_bin_dist diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 2efb348fcd5..424d92e31e1 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ ADD_CUSTOM_TARGET(GenFixPrivs IF(UNIX) FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution - "cd ${CMAKE_BINARY_DIR} && '${CMAKE_CPACK_COMMAND}' -G TGZ --config CPackConfig.cmake" ) + "cd ${CMAKE_BINARY_DIR} && '${CMAKE_CPACK_COMMAND}' -G TGZ --config CPackConfig.cmake\n" ) EXECUTE_PROCESS( COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution ) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh deleted file mode 100644 index 5ccdb2b914c..00000000000 --- a/scripts/make_binary_distribution.sh +++ /dev/null @@ -1,342 +0,0 @@ -#!/bin/sh -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -############################################################################## -# -# This is a script to create a TAR or ZIP binary distribution out of a -# built source tree. The output file will be put at the top level of -# the source tree, as "mysql-....{tar.gz,zip}" -# -# Note that the structure created by this script is slightly different from -# what a normal "make install" would produce. No extra "mysql" sub directory -# will be created, i.e. no "$prefix/include/mysql", "$prefix/lib/mysql" or -# "$prefix/share/mysql". This is because the build system explicitly calls -# make with pkgdatadir=, etc. -# -# In GNU make/automake terms -# -# "pkglibdir" is set to the same as "libdir" -# "pkgincludedir" is set to the same as "includedir" -# "pkgdatadir" is set to the same as "datadir" -# "pkgplugindir" is set to "$pkglibdir/plugin" -# "pkgsuppdir" is set to "@prefix@/support-files", -# normally the same as "datadir" -# -# The temporary directory path given to "--tmp=" has to be -# absolute and with no spaces. -# -# Note that for best result, the original "make" should be done with -# the same arguments as used for "make install" below, especially the -# 'pkglibdir', as the RPATH should to be set correctly. -# -############################################################################## - -############################################################################## -# -# Read the command line arguments that control this script -# -############################################################################## - -machine=@MACHINE_TYPE@ -system=@SYSTEM_TYPE@ -SOURCE=`pwd` -CP="cp -p" -MV="mv" - -# There are platforms, notably OS X on Intel (x86 + x86_64), -# for which "uname" does not provide sufficient information. -# The value of CFLAGS as used during compilation is the most exact info -# we can get - after all, we care about _what_ we built, not _where_ we did it. -cflags="@CFLAGS@" - -STRIP=1 # Option ignored -SILENT=0 -MALLOC_LIB= -PLATFORM="" -TMP=/tmp -NEW_NAME="" # Final top directory and TAR package name -SUFFIX="" -SHORT_PRODUCT_TAG="" # If don't want server suffix in package name -NDBCLUSTER="" # Option ignored - -for arg do - case "$arg" in - --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; - --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; - --short-product-tag=*) SHORT_PRODUCT_TAG=`echo "$arg" | sed -e "s;--short-product-tag=;;"` ;; - --inject-malloc-lib=*) MALLOC_LIB=`echo "$arg" | sed -e 's;^[^=]*=;;'` ;; - --no-strip) STRIP=0 ;; - --machine=*) machine=`echo "$arg" | sed -e "s;--machine=;;"` ;; - --platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;; - --silent) SILENT=1 ;; - --with-ndbcluster) NDBCLUSTER=1 ;; - *) - echo "Unknown argument '$arg'" - exit 1 - ;; - esac -done - -# ---------------------------------------------------------------------- -# Adjust "system" output from "uname" to be more human readable -# ---------------------------------------------------------------------- - -if [ x"$PLATFORM" = x"" ] ; then - # FIXME move this to the build tools - # Remove vendor from $system - system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'` - - # Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2) - system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'` - system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'` - system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'` - system=`echo $system | sed -e 's/darwin9.*/osx10.5/g'` - system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'` - system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'` - system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'` - system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'` - system=`echo $system | sed -e 's/osf5.1b/tru64/g'` - system=`echo $system | sed -e 's/linux-gnu/linux/g'` - system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'` - system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'` -fi - -# Get the "machine", which really is the CPU architecture (including the size). -# The precedence is: -# 1) use an explicit argument, if given; -# 2) use platform-specific fixes, if there are any (see bug#37808); -# 3) stay with the default (determined during "configure", using predefined macros). - -if [ x"$MACHINE" != x"" ] ; then - machine=$MACHINE -else - case $system in - osx* ) - # Extract "XYZ" from CFLAGS "... -arch XYZ ...", or empty! - cflag_arch=`echo "$cflags" | sed -n -e 's=.* -arch \([^ ]*\) .*=\1=p'` - case "$cflag_arch" in - i386 ) case $system in - osx10.4 ) machine=i686 ;; # Used a different naming - * ) machine=x86 ;; - esac ;; - x86_64 ) machine=x86_64 ;; - ppc ) ;; # No treatment needed with PPC - ppc64 ) ;; - * ) # No matching compiler flag? "--platform" is needed - if [ x"$PLATFORM" != x"" ] ; then - : # See below: "$PLATFORM" will take precedence anyway - elif [ "$system" = "osx10.3" -a -z "$cflag_arch" ] ; then - : # Special case of OS X 10.3, which is PPC-32 only and doesn't use "-arch" - else - echo "On system '$system' only specific '-arch' values are expected." - echo "It is taken from the 'CFLAGS' whose value is:" - echo "$cflags" - echo "'-arch $cflag_arch' is unexpected, and no '--platform' was given: ABORT" - exit 1 - fi ;; - esac # "$cflag_arch" - ;; - esac # $system -fi - -# Combine OS and CPU to the "platform". Again, an explicit argument takes precedence. -if [ x"$PLATFORM" != x"" ] ; then - : -else - PLATFORM="$system-$machine" -fi - -# Print the platform name for build logs -echo "PLATFORM NAME: $PLATFORM" - -# Change the distribution to a long descriptive name -# For the cluster product, concentrate on the second part -VERSION_NAME=@VERSION@ -case $VERSION_NAME in - *-ndb-* ) VERSION_NAME=`echo $VERSION_NAME | sed -e 's/[.0-9]*-ndb-//'` ;; -esac -if [ x"$SHORT_PRODUCT_TAG" != x"" ] ; then - NEW_NAME=mysql-$SHORT_PRODUCT_TAG-$VERSION_NAME-$PLATFORM$SUFFIX -else - NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$VERSION_NAME-$PLATFORM$SUFFIX -fi - -# ---------------------------------------------------------------------- -# Define BASE, and remove the old BASE directory if any -# ---------------------------------------------------------------------- -BASE=$TMP/my_dist$SUFFIX -if [ -d $BASE ] ; then - rm -rf $BASE -fi - -# ---------------------------------------------------------------------- -# Find the TAR to use -# ---------------------------------------------------------------------- - -# This is needed to prefer GNU tar over platform tar because that can't -# always handle long filenames - -PATH_DIRS=`echo $PATH | \ - sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` - -which_1 () -{ - for cmd - do - for d in $PATH_DIRS - do - for file in $d/$cmd - do - if [ -x $file -a ! -d $file ] ; then - echo $file - exit 0 - fi - done - done - done - exit 1 -} - -tar=`which_1 gnutar gtar` -if [ $? -ne 0 -o x"$tar" = x"" ] ; then - tar=tar -fi - - -############################################################################## -# -# Handle the Unix/Linux packaging using "make install" -# -############################################################################## - -# ---------------------------------------------------------------------- -# Terminate on any base level error -# ---------------------------------------------------------------------- -set -e - -# ---------------------------------------------------------------------- -# Really ugly, one script, "mysql_install_db", needs prefix set to ".", -# i.e. makes access relative the current directory. This matches -# the documentation, so better not change this. And for another script, -# "mysql.server", we make some relative, others not. -# ---------------------------------------------------------------------- - -cd scripts -rm -f mysql_install_db -@MAKE@ mysql_install_db \ - prefix=. \ - bindir=./bin \ - sbindir=./bin \ - scriptdir=./bin \ - libexecdir=./bin \ - pkgdatadir=./share \ - localstatedir=./data -cd .. - -cd support-files -rm -f mysql.server -@MAKE@ mysql.server \ - bindir=./bin \ - sbindir=./bin \ - scriptdir=./bin \ - libexecdir=./bin \ - pkgdatadir=@pkgdatadir@ -cd .. - -# ---------------------------------------------------------------------- -# Do a install that we later are to pack. Use the same paths as in -# the build for the relevant directories. -# ---------------------------------------------------------------------- -@MAKE@ DESTDIR=$BASE install \ - pkglibdir=@pkglibdir@ \ - pkgincludedir=@pkgincludedir@ \ - pkgdatadir=@pkgdatadir@ \ - pkgplugindir=@pkgplugindir@ \ - pkgsuppdir=@pkgsuppdir@ \ - mandir=@mandir@ \ - infodir=@infodir@ - -# ---------------------------------------------------------------------- -# Rename top directory, and set DEST to the new directory -# ---------------------------------------------------------------------- -mv $BASE@prefix@ $BASE/$NEW_NAME -DEST=$BASE/$NEW_NAME - -# ---------------------------------------------------------------------- -# If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a -# ---------------------------------------------------------------------- -if [ x"@GXX@" = x"yes" ] ; then - gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true - if [ -z "$gcclib" ] ; then - echo "Warning: Compiler doesn't tell libgcc.a!" - elif [ -f "$gcclib" ] ; then - $CP $gcclib $DEST/lib/libmygcc.a - else - echo "Warning: Compiler result '$gcclib' not found / no file!" - fi -fi - -# If requested, add a malloc library .so into pkglibdir for use -# by mysqld_safe -if [ -n "$MALLOC_LIB" ]; then - cp "$MALLOC_LIB" "$DEST/lib/" -fi - -# FIXME let this script be in "bin/", where it is in the RPMs? -# http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html -mkdir $DEST/scripts -mv $DEST/bin/mysql_install_db $DEST/scripts/ - -# Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 - -# Copy readme and license files -cp README Docs/INSTALL-BINARY $DEST/ -if [ -f COPYING ] ; then - cp COPYING $DEST/ -elif [ -f LICENSE.mysql ] ; then - cp LICENSE.mysql $DEST/ -else - echo "ERROR: no license files found" - exit 1 -fi - -# FIXME should be handled by make file, and to other dir -mkdir -p $DEST/bin $DEST/support-files -cp scripts/mysqlaccess.conf $DEST/bin/ -cp support-files/magic $DEST/support-files/ - -# Create empty data directories, set permission (FIXME why?) -mkdir $DEST/data $DEST/data/mysql $DEST/data/test -chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test - -# ---------------------------------------------------------------------- -# Create the result tar file -# ---------------------------------------------------------------------- - -echo "Using $tar to create archive" -OPT=cvf -if [ x$SILENT = x1 ] ; then - OPT=cf -fi - -echo "Creating and compressing archive" -rm -f $NEW_NAME.tar.gz -(cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz -echo "$NEW_NAME.tar.gz created" - -echo "Removing temporary directory" -rm -rf $BASE -exit 0 diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist deleted file mode 100755 index 00ef9186d48..00000000000 --- a/scripts/make_win_bin_dist +++ /dev/null @@ -1,425 +0,0 @@ -#!/bin/sh -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Exit if failing to copy, we want exact specifications, not -# just "what happen to be built". -set -e - -# ---------------------------------------------------------------------- -# Read first argument that is the base name of the resulting TAR file. -# See usage() function below for a description on the arguments. -# -# NOTE: We will read the rest of the command line later on. -# NOTE: Pattern matching with "{..,..}" can't be used, not portable. -# ---------------------------------------------------------------------- - -# FIXME why "libmysql.dll" installed both in "bin" and "lib/opt"? - -usage() -{ - echo <> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Tue Sep 13 2011 Joerg Bruehe + +- "make_win_bin_dist" and its manual are dropped, cmake does it different. + * Tue Aug 30 2011 Joerg Bruehe - Add the manual page for "mysql_plugin" to the server package. From 3cd36cb0b854444a3d6eb181d62e47f1175d9e13 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 13 Sep 2011 17:18:06 +0300 Subject: [PATCH 22/29] Re-enable the prefetch code in InnoDB internal SQL parser and fix two bugs in it - accessing uninitialized ::len member (thanks, Jimmy!) and a memory leak. This is a followup to vasil.dimov@oracle.com-20110909070724-jvirxnpkbxieauz5 which disabled the prefetch code. --- storage/innodb_plugin/row/row0sel.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index c9b409cbedd..32f21dbe198 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -63,13 +63,7 @@ Created 12/19/1997 Heikki Tuuri /* Number of rows fetched, after which to start prefetching; MySQL interface has another parameter */ -/* The prefetch code in the internal SQL is disabled because it has probably -never been used and has been found to contain a memory leak and a bug of -accessing uninitialized memory. Some simple performance tests show that -disabling it makes no difference in performance. It will be removed, but -until the removal happens we disable it by setting SEL_PREFETCH_LIMIT to a -high value. */ -#define SEL_PREFETCH_LIMIT 1000000000 +#define SEL_PREFETCH_LIMIT 1 /* When a select has accessed about this many pages, it returns control back to que_run_threads: this is to allow canceling runaway queries */ @@ -514,7 +508,7 @@ sel_col_prefetch_buf_alloc( sel_buf = column->prefetch_buf + i; sel_buf->data = NULL; - + sel_buf->len = 0; sel_buf->val_buf_size = 0; } } @@ -539,6 +533,8 @@ sel_col_prefetch_buf_free( mem_free(sel_buf->data); } } + + mem_free(prefetch_buf); } /*********************************************************************//** From 3d09f32381ddc63896c763dd51f16f388aa5965c Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 13 Sep 2011 16:18:57 +0200 Subject: [PATCH 23/29] Complete support for OL/RH6. --- support-files/mysql.spec.sh | 47 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 78211a4bc38..19595f228ef 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -144,7 +144,7 @@ %if "%elver" == "6" %define distro_description Oracle Linux 6 %define distro_releasetag el6 - %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_buildreq gcc-c++ ncurses-devel perl readline-devel time zlib-devel %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools %else %{error:Oracle Linux %{elver} is unsupported} @@ -167,7 +167,7 @@ %if "%rhelver" == "6" %define distro_description Red Hat Enterprise Linux 6 %define distro_releasetag rhel6 - %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel + %define distro_buildreq gcc-c++ ncurses-devel perl readline-devel time zlib-devel %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools %else %{error:Red Hat Enterprise Linux %{rhelver} is unsupported} @@ -463,25 +463,6 @@ mkdir release make ${MAKE_JFLAG} VERBOSE=1 ) -# Use the build root for temporary storage of the shared libraries. -RBR=$RPM_BUILD_ROOT - -# Clean up the BuildRoot first -[ "$RBR" != "/" ] && [ -d "$RBR" ] && rm -rf "$RBR"; - -# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921). This -# needs to be during build phase as $CC is not set during install. -if "$CC" -v 2>&1 | grep '^gcc.version' >/dev/null 2>&1 -then - libgcc=`$CC $CFLAGS --print-libgcc-file` - if [ -f $libgcc ] - then - mkdir -p $RBR%{_libdir}/mysql - install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a - echo "%{_libdir}/mysql/libmygcc.a" >>optional-files-devel - fi -fi - ############################################################################## %install @@ -504,6 +485,23 @@ install -d $RBR%{_sbindir} make DESTDIR=$RBR install ) +# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921). Do +# this in a sub-shell to ensure we don't pollute the install environment +# with compiler bits. +( + PATH=${MYSQL_BUILD_PATH:-$PATH} + CC=${MYSQL_BUILD_CC:-${CC:-gcc}} + CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}} + if "${CC}" -v 2>&1 | grep '^gcc.version' >/dev/null 2>&1; then + libgcc=`${CC} ${CFLAGS} --print-libgcc-file` + if [ -f ${libgcc} ]; then + mkdir -p $RBR%{_libdir}/mysql + install -m 644 ${libgcc} $RBR%{_libdir}/mysql/libmygcc.a + echo "%{_libdir}/mysql/libmygcc.a" >>optional-files-devel + fi + fi +) + # FIXME: at some point we should stop doing this and just install everything # FIXME: directly into %{_libdir}/mysql - perhaps at the same time as renaming # FIXME: the shared libraries to use libmysql*-$major.$minor.so syntax @@ -1153,6 +1151,13 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Tue Sep 13 2011 Jonathan Perkin + +- Add support for Oracle Linux 6 and Red Hat Enterprise Linux 6. Due to + changes in RPM behaviour ($RPM_BUILD_ROOT is removed prior to %install) + this necessitated a move of the libmygcc.a installation from %build to + %install, which is probably where it belonged in the first place. + * Tue Sep 13 2011 Joerg Bruehe - "make_win_bin_dist" and its manual are dropped, cmake does it different. From 59e022c10d633aa06c20237ea10418af9736b715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 14 Sep 2011 15:39:36 +0300 Subject: [PATCH 24/29] Hopefully really final fix of Bug#11766591 59733: Possible deadlock when buffered changes are to be discarded sync_thread_add_level(level = SYNC_IBUF_INDEX_TREE): Relax a too strict condition that the thread must not be holding locks below SYNC_FSP_PAGE. It is perfectly valid to hold any latch above SYNC_IBUF_INDEX_TREE when acquiring the insert buffer tree latch. --- storage/innodb_plugin/sync/sync0sync.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innodb_plugin/sync/sync0sync.c b/storage/innodb_plugin/sync/sync0sync.c index 64aadffdfad..3640e204525 100644 --- a/storage/innodb_plugin/sync/sync0sync.c +++ b/storage/innodb_plugin/sync/sync0sync.c @@ -1258,8 +1258,7 @@ sync_thread_add_level( break; case SYNC_IBUF_INDEX_TREE: if (sync_thread_levels_contain(array, SYNC_FSP)) { - ut_a(sync_thread_levels_g( - array, SYNC_FSP_PAGE - 1, TRUE)); + ut_a(sync_thread_levels_g(array, level - 1, TRUE)); } else { ut_a(sync_thread_levels_g( array, SYNC_IBUF_TREE_NODE - 1, TRUE)); From 3b17a24effa6ba40ef4c3a8e14f2ffefc1997bdf Mon Sep 17 00:00:00 2001 From: Rafal Somla Date: Wed, 14 Sep 2011 16:10:18 +0200 Subject: [PATCH 25/29] Bug#12897501 REPLICATION DOES NOT SUPPORT WINDOWS AUTH PLUG-IN Connection of slave to master using a replication account which authenticates with an external plugin was not possible. Fixed by making sure that the CLIENT_PLUGIN_AUTH capability is set when client connects using mysql_real_connect(). Also, a plugin-dir path used by client library to locate authentication plugins is set based on the analogous server setting. This is done in connect_to_master() function before a call to mysql_real_connect(). --- libmysql/client_settings.h | 5 +++ mysql-test/r/auth_rpl.result | 22 +++++++++++ mysql-test/t/auth_rpl-master.opt | 2 + mysql-test/t/auth_rpl-slave.opt | 4 ++ mysql-test/t/auth_rpl.test | 64 ++++++++++++++++++++++++++++++++ sql/client_settings.h | 15 ++++++-- sql/slave.cc | 4 ++ 7 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 mysql-test/r/auth_rpl.result create mode 100644 mysql-test/t/auth_rpl-master.opt create mode 100644 mysql-test/t/auth_rpl-slave.opt create mode 100644 mysql-test/t/auth_rpl.test diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index d04d61067f2..ecc9a7773ca 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -22,6 +22,11 @@ extern uint mysql_port; extern char * mysql_unix_port; +/* + Note: CLIENT_CAPABILITIES is also defined in sql/client_settings.h. + When adding capabilities here, consider if they should be also added to + the server's version. +*/ #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | \ CLIENT_LONG_FLAG | \ CLIENT_TRANSACTIONS | \ diff --git a/mysql-test/r/auth_rpl.result b/mysql-test/r/auth_rpl.result new file mode 100644 index 00000000000..1c03461df9b --- /dev/null +++ b/mysql-test/r/auth_rpl.result @@ -0,0 +1,22 @@ +include/master-slave.inc +[connection master] +[connection slave] +include/stop_slave.inc +[connection master] +CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user'; +GRANT REPLICATION SLAVE ON *.* TO plug_user; +FLUSH PRIVILEGES; +[connection slave] +CHANGE MASTER TO MASTER_USER= 'plug_user'; +include/start_slave.inc +# Slave in-sync with master now. +SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user'; +user plugin authentication_string +plug_user test_plugin_server plug_user +# Cleanup (on slave). +include/stop_slave.inc +CHANGE MASTER TO MASTER_USER='root'; +DROP USER 'plug_user'; +# Cleanup (on master). +DROP USER 'plug_user'; +include/rpl_end.inc diff --git a/mysql-test/t/auth_rpl-master.opt b/mysql-test/t/auth_rpl-master.opt new file mode 100644 index 00000000000..3536d102387 --- /dev/null +++ b/mysql-test/t/auth_rpl-master.opt @@ -0,0 +1,2 @@ +$PLUGIN_AUTH_OPT +$PLUGIN_AUTH_LOAD diff --git a/mysql-test/t/auth_rpl-slave.opt b/mysql-test/t/auth_rpl-slave.opt new file mode 100644 index 00000000000..3f4af6e59bb --- /dev/null +++ b/mysql-test/t/auth_rpl-slave.opt @@ -0,0 +1,4 @@ +--master-retry-count=1 +$PLUGIN_AUTH_OPT +$PLUGIN_AUTH_LOAD + diff --git a/mysql-test/t/auth_rpl.test b/mysql-test/t/auth_rpl.test new file mode 100644 index 00000000000..9947d463acd --- /dev/null +++ b/mysql-test/t/auth_rpl.test @@ -0,0 +1,64 @@ +--source include/have_plugin_auth.inc +--source include/not_embedded.inc +--source include/master-slave.inc + +# +# Check that replication slave can connect to master using an account +# which authenticates with an external authentication plugin (bug#12897501). + +# +# First stop the slave to guarantee that nothing is replicated. +# +--connection slave +--echo [connection slave] +--source include/stop_slave.inc +# +# Create an replication account on the master. +# +--connection master +--echo [connection master] +CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user'; +GRANT REPLICATION SLAVE ON *.* TO plug_user; +FLUSH PRIVILEGES; + +# +# Now go to slave and change the replication user. +# +--connection slave +--echo [connection slave] +--let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1) +CHANGE MASTER TO MASTER_USER= 'plug_user'; + +# +# Start slave with new replication account - this should trigger connection +# to the master server. +# +--source include/start_slave.inc + +# Replicate all statements executed on master, in this case, +# (creation of the plug_user account). +# +--connection master +--sync_slave_with_master +--echo # Slave in-sync with master now. + +SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user'; + +# +# Now we can stop the slave and clean up. +# +# Note: it is important that slave is stopped at this +# moment - otherwise master's cleanup statements +# would be replicated on slave! +# +--echo # Cleanup (on slave). +--source include/stop_slave.inc +eval CHANGE MASTER TO MASTER_USER='$master_user'; +DROP USER 'plug_user'; + +--echo # Cleanup (on master). +--connection master +DROP USER 'plug_user'; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/sql/client_settings.h b/sql/client_settings.h index d9145bcce26..acae7907aa5 100644 --- a/sql/client_settings.h +++ b/sql/client_settings.h @@ -23,9 +23,18 @@ #include #include -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \ - CLIENT_SECURE_CONNECTION | CLIENT_TRANSACTIONS | \ - CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION) +/* + Note: CLIENT_CAPABILITIES is also defined in libmysql/client_settings.h. + When adding capabilities here, consider if they should be also added to + the libmysql version. +*/ +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | \ + CLIENT_LONG_FLAG | \ + CLIENT_SECURE_CONNECTION | \ + CLIENT_TRANSACTIONS | \ + CLIENT_PROTOCOL_41 | \ + CLIENT_SECURE_CONNECTION | \ + CLIENT_PLUGIN_AUTH) #define read_user_name(A) {} #undef HAVE_SMEM diff --git a/sql/slave.cc b/sql/slave.cc index d0b123c5c6f..7a3eee952c3 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4204,6 +4204,10 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, /* This one is not strictly needed but we have it here for completeness */ mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); + /* Set MYSQL_PLUGIN_DIR in case master asks for an external authentication plugin */ + if (opt_plugin_dir_ptr && *opt_plugin_dir_ptr) + mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr); + while (!(slave_was_killed = io_slave_killed(thd,mi)) && (reconnect ? mysql_reconnect(mysql) != 0 : mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, From 1ebc1e07038aa32e43dd5e0807559a4998b160ef Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 16 Sep 2011 15:30:31 +0400 Subject: [PATCH 26/29] BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES myisamchk may create incorrect fulltext index for compressed tables. Incorrect data pointer size was used while creating fulltext index. --- mysql-test/r/myisampack.result | 32 +++++++++++++++++++++ mysql-test/t/myisampack.test | 45 ++++++++++++++++++++++++++++++ storage/myisam/ft_boolean_search.c | 2 +- storage/myisam/ft_nlq_search.c | 2 +- storage/myisam/mi_check.c | 4 +-- storage/myisam/mi_write.c | 2 +- 6 files changed, 82 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index fbcd8aed17a..f19a9c49427 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -87,3 +87,35 @@ COUNT(*) 128 DROP TABLE mysql_db1.t1; DROP DATABASE mysql_db1; +# +# BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES +# +CREATE TABLE t1(a CHAR(4), FULLTEXT(a)); +INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc'); +FLUSH TABLE t1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE); +a +aaaa +SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa'); +a +aaaa +DROP TABLE t1; +# Test table with key_reflength > rec_reflength +CREATE TABLE t1(a CHAR(30), FULLTEXT(a)); +# Populating a table, so it's index file exceeds 65K +# Populating a table, so index file has second level fulltext tree +FLUSH TABLE t1; +# Compressing table +# Fixing index (repair by sort) +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +FLUSH TABLE t1; +# Fixing index (repair with keycache) +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test index 9d27ed53254..3bce8cfcfb8 100644 --- a/mysql-test/t/myisampack.test +++ b/mysql-test/t/myisampack.test @@ -107,3 +107,48 @@ SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5; # DROP TABLE mysql_db1.t1; DROP DATABASE mysql_db1; + +--echo # +--echo # BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES +--echo # +CREATE TABLE t1(a CHAR(4), FULLTEXT(a)); +INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc'); +FLUSH TABLE t1; +--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1 +--exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1 +CHECK TABLE t1; +SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE); +SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa'); +DROP TABLE t1; + +--echo # Test table with key_reflength > rec_reflength +CREATE TABLE t1(a CHAR(30), FULLTEXT(a)); +--disable_query_log +--echo # Populating a table, so it's index file exceeds 65K +let $1=1700; +while ($1) +{ + eval INSERT INTO t1 VALUES('$1aaaaaaaaaaaaaaaaaaaaaaaaaa'); + dec $1; +} + +--echo # Populating a table, so index file has second level fulltext tree +let $1=60; +while ($1) +{ + eval INSERT INTO t1 VALUES('aaaa'),('aaaa'),('aaaa'),('aaaa'),('aaaa'); + dec $1; +} +--enable_query_log + +FLUSH TABLE t1; +--echo # Compressing table +--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1 +--echo # Fixing index (repair by sort) +--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1 +CHECK TABLE t1; +FLUSH TABLE t1; +--echo # Fixing index (repair with keycache) +--exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1 +CHECK TABLE t1; +DROP TABLE t1; diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index fb1a03a2bd6..ac5da800ae3 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -361,7 +361,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) int subkeys=1; my_bool can_go_down; MI_INFO *info=ftb->info; - uint UNINIT_VAR(off), extra=HA_FT_WLEN+info->s->base.rec_reflength; + uint UNINIT_VAR(off), extra= HA_FT_WLEN + info->s->rec_reflength; uchar *lastkey_buf=ftbw->word+ftbw->off; if (ftbw->flags & FTB_FLAG_TRUNC) diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index cd2c7f61a66..567b1044995 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -74,7 +74,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) uchar *keybuff=aio->keybuff; MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr; my_off_t key_root=info->s->state.key_root[aio->keynr]; - uint extra=HA_FT_WLEN+info->s->base.rec_reflength; + uint extra= HA_FT_WLEN + info->s->rec_reflength; #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT float tmp_weight; #else diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 3bbd2fb0469..4a0c2da5559 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -3913,7 +3913,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) SORT_FT_BUF *ft_buf=sort_info->ft_buf; SORT_KEY_BLOCKS *key_block=sort_info->key_block; - val_len=HA_FT_WLEN+sort_info->info->s->base.rec_reflength; + val_len= HA_FT_WLEN + sort_info->info->s->rec_reflength; get_key_full_length_rdonly(a_len, (uchar *)a); if (!ft_buf) @@ -3923,7 +3923,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) and row format is NOT static - for _mi_dpointer not to garble offsets */ if ((sort_info->info->s->base.key_reflength <= - sort_info->info->s->base.rec_reflength) && + sort_info->info->s->rec_reflength) && (sort_info->info->s->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD))) ft_buf=(SORT_FT_BUF *)my_malloc(sort_param->keyinfo->block_length + diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 70487f397f1..81262c229ce 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -528,7 +528,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, { if (keyinfo->block_length - a_length < 32 && keyinfo->flag & HA_FULLTEXT && key_pos == endpos && - info->s->base.key_reflength <= info->s->base.rec_reflength && + info->s->base.key_reflength <= info->s->rec_reflength && info->s->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) { /* From 76f3c250d47601169aab64d6e5276bf4e66bbeba Mon Sep 17 00:00:00 2001 From: Rafal Somla Date: Fri, 16 Sep 2011 14:35:25 +0200 Subject: [PATCH 27/29] Update of auth_rpl test. For some reason the test authentication plugin accepted connection with arbitrary password. But the intention of the plugin is that password should equal to the authentication string and in the later versions of the server connection fails if password is wrong. So I have updated auth_rpl test to specify the correct password. --- mysql-test/r/auth_rpl.result | 4 +++- mysql-test/t/auth_rpl.test | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/auth_rpl.result b/mysql-test/r/auth_rpl.result index 1c03461df9b..70626b02b2b 100644 --- a/mysql-test/r/auth_rpl.result +++ b/mysql-test/r/auth_rpl.result @@ -7,7 +7,9 @@ CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user'; GRANT REPLICATION SLAVE ON *.* TO plug_user; FLUSH PRIVILEGES; [connection slave] -CHANGE MASTER TO MASTER_USER= 'plug_user'; +CHANGE MASTER TO +MASTER_USER= 'plug_user', +MASTER_PASSWORD= 'plug_user'; include/start_slave.inc # Slave in-sync with master now. SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user'; diff --git a/mysql-test/t/auth_rpl.test b/mysql-test/t/auth_rpl.test index 9947d463acd..c413a84b53c 100644 --- a/mysql-test/t/auth_rpl.test +++ b/mysql-test/t/auth_rpl.test @@ -27,7 +27,9 @@ FLUSH PRIVILEGES; --connection slave --echo [connection slave] --let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1) -CHANGE MASTER TO MASTER_USER= 'plug_user'; +CHANGE MASTER TO + MASTER_USER= 'plug_user', + MASTER_PASSWORD= 'plug_user'; # # Start slave with new replication account - this should trigger connection From 0595b00aa9a99cac8b95ea9800ad38f776c81907 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 19 Sep 2011 21:16:01 +0200 Subject: [PATCH 28/29] Don't use macro names in changelog comments. --- support-files/mysql.spec.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 19595f228ef..8ce97ec4974 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1154,9 +1154,9 @@ echo "=====" >> $STATUS_HISTORY * Tue Sep 13 2011 Jonathan Perkin - Add support for Oracle Linux 6 and Red Hat Enterprise Linux 6. Due to - changes in RPM behaviour ($RPM_BUILD_ROOT is removed prior to %install) - this necessitated a move of the libmygcc.a installation from %build to - %install, which is probably where it belonged in the first place. + changes in RPM behaviour ($RPM_BUILD_ROOT is removed prior to install) + this necessitated a move of the libmygcc.a installation to the install + phase, which is probably where it belonged in the first place. * Tue Sep 13 2011 Joerg Bruehe From 929c97db61265c95728a4b90e4681521ffb38abc Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 20 Sep 2011 10:59:48 +0200 Subject: [PATCH 29/29] Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY --- mysql-test/r/func_str.result | 35 +++++++++++++++++++++++++++++++++++ mysql-test/t/func_str.test | 19 +++++++++++++++++++ strings/dtoa.c | 7 +++++-- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 81fe2413725..755763e6994 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2785,5 +2785,40 @@ format(123,2,'no_NO') 123,00 DROP TABLE t1; # +# Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY +# +SELECT (rpad(1.0,2048,1)) IS NOT FALSE; +(rpad(1.0,2048,1)) IS NOT FALSE +1 +SELECT ((+0) IN +((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), +(32767.1))); +((+0) IN +((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), +(32767.1))) +0 +SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); +((rpad(1.0,2048,1)) = ('4(') ^ (0.1)) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '4(' +SELECT +pow((rpad(1.0,2048,1)),(b'1111111111111111111111111111111111111111111')); +ERROR 22003: DOUBLE value is out of range in 'pow(rpad(1.0,2048,1),0x07ffffffffff)' +SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../')); +((rpad(1.0,2048,1)) + (0) ^ ('../')) +1.011111111111111 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '../' +SELECT stddev_samp(rpad(1.0,2048,1)); +stddev_samp(rpad(1.0,2048,1)) +NULL +SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); +((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))) +1 +SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); +((0xf3) * (rpad(1.0,2048,1)) << (0xcc)) +0 +# # End of 5.5 tests # diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 9a9a8110a74..2a14648d6f6 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1436,6 +1436,25 @@ SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY +--echo # + +SELECT (rpad(1.0,2048,1)) IS NOT FALSE; +SELECT ((+0) IN +((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), +(32767.1))); +SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); + +--error 1690 +SELECT +pow((rpad(1.0,2048,1)),(b'1111111111111111111111111111111111111111111')); +SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../')); +SELECT stddev_samp(rpad(1.0,2048,1)); +SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); +SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); + + --echo # --echo # End of 5.5 tests --echo # diff --git a/strings/dtoa.c b/strings/dtoa.c index e4eb10bb6f8..05c9bb6e529 100644 --- a/strings/dtoa.c +++ b/strings/dtoa.c @@ -46,7 +46,7 @@ see if it is possible to get rid of malloc(). this constant is sufficient to avoid malloc() on all inputs I have tried. */ -#define DTOA_BUFF_SIZE (420 * sizeof(void *)) +#define DTOA_BUFF_SIZE (460 * sizeof(void *)) /* Magic value returned by dtoa() to indicate overflow */ #define DTOA_OVERFLOW 9999 @@ -659,6 +659,7 @@ typedef struct Stack_alloc static Bigint *Balloc(int k, Stack_alloc *alloc) { Bigint *rv; + DBUG_ASSERT(k <= Kmax); if (k <= Kmax && alloc->freelist[k]) { rv= alloc->freelist[k]; @@ -1005,7 +1006,7 @@ static Bigint p5_a[]= static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc) { - Bigint *b1, *p5, *p51; + Bigint *b1, *p5, *p51=NULL; int i; static int p05[3]= { 5, 25, 125 }; @@ -1037,6 +1038,8 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc) p5= p51; } } + if (p51) + Bfree(p51, alloc); return b; }