From 74b064933267f58b9201c46eb67454237d7664d3 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 28 Mar 2012 13:22:21 +0300 Subject: [PATCH 1/9] Fixed lp:944422 "mysql_upgrade destroys Maria tables?" The issue was that check/optimize/anaylze did not zerofill the table before they started to work on it. Added one more element to not often used function handler::auto_repair() to allow handler to decide when to auto repair. mysql-test/suite/maria/r/maria-autozerofill.result: Test case for lp:944422 mysql-test/suite/maria/t/maria-autozerofill.test: Test case for lp:944422 sql/ha_partition.cc: Added argument to auto_repair() sql/ha_partition.h: Added argument to auto_repair() sql/handler.h: Added argument to auto_repair() sql/table.cc: Let auto_repair() decide which errors to trigger auto-repair storage/archive/ha_archive.h: Added argument to auto_repair() storage/csv/ha_tina.h: Added argument to auto_repair() storage/maria/ha_maria.cc: Give better error & warning messages for auto-repaired tables. storage/maria/ha_maria.h: Added argument to auto_repair() Always auto-repair in case of moved table. storage/maria/ma_open.c: Remove special handling of HA_ERR_OLD_FILE (this is now handled in auto_repair()) storage/myisam/ha_myisam.h: Added argument to auto_repair() --- .../suite/maria/r/maria-autozerofill.result | 29 +++++++++++++++++-- .../suite/maria/t/maria-autozerofill.test | 20 ++++++++++++- sql/ha_partition.cc | 4 +-- sql/ha_partition.h | 2 +- sql/handler.h | 2 +- sql/table.cc | 3 +- storage/archive/ha_archive.h | 4 ++- storage/csv/ha_tina.h | 2 ++ storage/maria/ha_maria.cc | 23 +++++++++++++++ storage/maria/ha_maria.h | 10 +++++-- storage/maria/ma_open.c | 2 -- storage/myisam/ha_myisam.h | 6 +++- 12 files changed, 92 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/maria/r/maria-autozerofill.result b/mysql-test/suite/maria/r/maria-autozerofill.result index e31cf9fa19b..7fa47814ee5 100644 --- a/mysql-test/suite/maria/r/maria-autozerofill.result +++ b/mysql-test/suite/maria/r/maria-autozerofill.result @@ -4,18 +4,43 @@ create database mysqltest; use mysqltest; create table t1(a int) engine=maria; insert into t1 values(1); -flush table t1; +create table t2 (a int) engine=maria; +INSERT INTO t2 VALUES (1),(2); +create table t3 (a int) engine=maria; +INSERT INTO t3 VALUES (1),(2); +create table t4 (a int) engine=maria; +INSERT INTO t4 VALUES (1),(2); +flush tables; create_rename_lsn has non-magic value * shut down mysqld, removed logs, restarted it select * from t1; a 1 Warnings: -Error 1194 t1' is marked as crashed and should be repaired +Note 1194 Zerofilling moved table ./mysqltest/t1 flush table t1; Status: changed,sorted index pages,zerofilled,movable create_rename_lsn has magic value insert into t1 values(2); flush table t1; create_rename_lsn has non-magic value +check table t2; +Table Op Msg_type Msg_text +mysqltest.t2 check error Table is from another system and must be zerofilled or repaired to be usable on this system +mysqltest.t2 check error Corrupt +check table t2; +Table Op Msg_type Msg_text +mysqltest.t2 check error Table is from another system and must be zerofilled or repaired to be usable on this system +mysqltest.t2 check error Corrupt +repair table t2; +Table Op Msg_type Msg_text +mysqltest.t2 repair status OK +optimize table t3; +Table Op Msg_type Msg_text +mysqltest.t3 optimize Note Zerofilling moved table ./mysqltest/t3 +mysqltest.t3 optimize status OK +analyze table t4; +Table Op Msg_type Msg_text +mysqltest.t4 analyze Note Zerofilling moved table ./mysqltest/t4 +mysqltest.t4 analyze status OK drop database mysqltest; diff --git a/mysql-test/suite/maria/t/maria-autozerofill.test b/mysql-test/suite/maria/t/maria-autozerofill.test index b46b458d89e..637b7dafe92 100644 --- a/mysql-test/suite/maria/t/maria-autozerofill.test +++ b/mysql-test/suite/maria/t/maria-autozerofill.test @@ -22,9 +22,17 @@ connection default; use mysqltest; --enable_reconnect +# Create some tables for future tests create table t1(a int) engine=maria; insert into t1 values(1); -flush table t1; +create table t2 (a int) engine=maria; +INSERT INTO t2 VALUES (1),(2); +create table t3 (a int) engine=maria; +INSERT INTO t3 VALUES (1),(2); +create table t4 (a int) engine=maria; +INSERT INTO t4 VALUES (1),(2); +flush tables; + # Check that table is not zerofilled, not movable let $MYSQLD_DATADIR= `select @@datadir`; --exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt @@ -80,4 +88,14 @@ perl; close FILE; EOF +# +# BUG#44422 "mysql_upgrade destroys Maria tables?" +# Check repair and optimize of moved table +# +check table t2; +check table t2; +repair table t2; +optimize table t3; +analyze table t4; + drop database mysqltest; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e70eacfab5d..cc343eb6e75 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1223,7 +1223,7 @@ bool ha_partition::check_and_repair(THD *thd) @retval FALSE Cannot be auto repaired */ -bool ha_partition::auto_repair() const +bool ha_partition::auto_repair(int error) const { DBUG_ENTER("ha_partition::auto_repair"); @@ -1231,7 +1231,7 @@ bool ha_partition::auto_repair() const As long as we only support one storage engine per table, we can use the first partition for this function. */ - DBUG_RETURN(m_file[0]->auto_repair()); + DBUG_RETURN(m_file[0]->auto_repair(error)); } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index adb8214aae4..08e5a99f609 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1105,7 +1105,7 @@ public: virtual int check(THD* thd, HA_CHECK_OPT *check_opt); virtual int repair(THD* thd, HA_CHECK_OPT *check_opt); virtual bool check_and_repair(THD *thd); - virtual bool auto_repair() const; + virtual bool auto_repair(int error) const; virtual bool is_crashed() const; private: diff --git a/sql/handler.h b/sql/handler.h index e8f6abdca65..605b6bd0a87 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1668,7 +1668,7 @@ public: virtual bool low_byte_first() const { return 1; } virtual uint checksum() const { return 0; } virtual bool is_crashed() const { return 0; } - virtual bool auto_repair() const { return 0; } + virtual bool auto_repair(int error) const { return 0; } #define CHF_CREATE_FLAG 0 #define CHF_DELETE_FLAG 1 diff --git a/sql/table.cc b/sql/table.cc index 0bfa74dba75..0a564f8ad1d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1929,8 +1929,7 @@ partititon_err: HA_OPEN_IGNORE_IF_LOCKED) | ha_open_flags)))) { /* Set a flag if the table is crashed and it can be auto. repaired */ - share->crashed= ((ha_err == HA_ERR_CRASHED_ON_USAGE) && - outparam->file->auto_repair() && + share->crashed= (outparam->file->auto_repair(ha_err) && !(ha_open_flags & HA_OPEN_FOR_REPAIR)); switch (ha_err) diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 653a13b242d..6f0c0b529fb 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -125,7 +125,9 @@ public: int free_share(); int init_archive_writer(); int init_archive_reader(); - bool auto_repair() const { return 1; } // For the moment we just do this + // Always try auto_repair in case of HA_ERR_CRASHED_ON_USAGE + bool auto_repair(int error) const + { return error == HA_ERR_CRASHED_ON_USAGE; } int read_data_header(azio_stream *file_to_read); void position(const uchar *record); int info(uint); diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 8572a53a94d..54860ecb3fb 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -151,6 +151,8 @@ public: int rnd_end(); int repair(THD* thd, HA_CHECK_OPT* check_opt); /* This is required for SQL layer to know that we support autorepair */ + bool auto_repair(int error) const + { return error == HA_ERR_CRASHED_ON_USAGE; } bool auto_repair() const { return 1; } void position(const uchar *record); int info(uint); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index e02c8c5e2cd..6c0914ab751 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -52,6 +52,9 @@ C_MODE_END ulong pagecache_division_limit, pagecache_age_threshold; ulonglong pagecache_buffer_size; +const char *zerofill_error_msg= + "Table is from another system and must be zerofilled or repaired to be " + "usable on this system"; /** As the auto-repair is initiated when opened from the SQL layer @@ -972,7 +975,15 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) } if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER))) + { + if (my_errno == HA_ERR_OLD_FILE) + { + push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_CRASHED_ON_USAGE, + zerofill_error_msg); + } return (my_errno ? my_errno : -1); + } file->s->chst_invalidator= query_cache_invalidate_by_MyISAM_filename_ref; @@ -1074,6 +1085,13 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) return HA_ADMIN_ALREADY_DONE; maria_chk_init_for_check(¶m, file); + if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) == + STATE_MOVED) + { + _ma_check_print_error(¶m, zerofill_error_msg); + return HA_ADMIN_CORRUPT; + } + (void) maria_chk_status(¶m, file); // Not fatal error= maria_chk_size(¶m, file); if (!error) @@ -2024,6 +2042,11 @@ bool ha_maria::check_and_repair(THD *thd) if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) == STATE_MOVED) { + /* Remove error about crashed table */ + mysql_reset_errors(thd, true); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_CRASHED_ON_USAGE, + "Zerofilling moved table %s", table->s->path.str); sql_print_information("Zerofilling moved table: '%s'", table->s->path.str); if (!(error= zerofill(thd, &check_opt))) diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 47545b67ff3..343675e9452 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -142,8 +142,14 @@ public: bool check_and_repair(THD * thd); bool is_crashed() const; bool is_changed() const; - bool auto_repair() const - { return test(maria_recover_options & HA_RECOVER_ANY); } + bool auto_repair(int error) const + { + /* Always auto-repair moved tables (error == HA_ERR_OLD_FILE) */ + return ((test(maria_recover_options & HA_RECOVER_ANY) && + error == HA_ERR_CRASHED_ON_USAGE) || + error == HA_ERR_OLD_FILE); + + } int optimize(THD * thd, HA_CHECK_OPT * check_opt); int restore(THD * thd, HA_CHECK_OPT * check_opt); int backup(THD * thd, HA_CHECK_OPT * check_opt); diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index eb7ef510d88..cf2e2ceb704 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -968,8 +968,6 @@ err: tmp_name.length= strlen(name); _ma_report_error(save_errno, &tmp_name); } - if (save_errno == HA_ERR_OLD_FILE) /* uuid is different ? */ - save_errno= HA_ERR_CRASHED_ON_USAGE; /* the code to trigger auto-repair */ switch (errpos) { case 5: if (data_file >= 0) diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index ea9db8f0f2b..98a0d393bbb 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -128,7 +128,11 @@ class ha_myisam: public handler int repair(THD* thd, HA_CHECK_OPT* check_opt); bool check_and_repair(THD *thd); bool is_crashed() const; - bool auto_repair() const { return myisam_recover_options != 0; } + bool auto_repair(int error) const + { + return (myisam_recover_options != 0 && + error == HA_ERR_CRASHED_ON_USAGE); + } int optimize(THD* thd, HA_CHECK_OPT* check_opt); int restore(THD* thd, HA_CHECK_OPT* check_opt); int backup(THD* thd, HA_CHECK_OPT* check_opt); From 29ac38b734a4c6e8ba9356cde1d2912f326032a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Mar 2012 21:58:40 +0200 Subject: [PATCH 2/9] Add missing include (fixes compile failure with gcc 4.7). --- plugin/handler_socket/libhsclient/fatal.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/handler_socket/libhsclient/fatal.cpp b/plugin/handler_socket/libhsclient/fatal.cpp index 8f8751da382..5cdd8879ab1 100644 --- a/plugin/handler_socket/libhsclient/fatal.cpp +++ b/plugin/handler_socket/libhsclient/fatal.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "fatal.hpp" From 20c2cea4f49bf48efbc562849c0a425448e4d3a5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 29 Mar 2012 16:32:35 +0200 Subject: [PATCH 3/9] remove race conditions from the test --- .../suite/innodb/r/innodb-autoinc-61209.result | 12 +++++------- mysql-test/suite/innodb/t/innodb-autoinc-61209.test | 10 ++-------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-61209.result b/mysql-test/suite/innodb/r/innodb-autoinc-61209.result index 9c1e75c22e7..1ae672fcf98 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc-61209.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc-61209.result @@ -9,7 +9,9 @@ INSERT INTO bug_61209 VALUES (), (); # Connection con1 SET SESSION auto_increment_increment=3; SET SESSION auto_increment_offset=2; -SELECT GET_LOCK('a', 10); +SELECT GET_LOCK('a', 9); +GET_LOCK('a', 9) +1 # Connection con2 SET SESSION auto_increment_increment=3; @@ -17,16 +19,12 @@ SET SESSION auto_increment_offset=2; INSERT INTO bug_61209 (a) VALUES (NULL), (NULL), (NULL + GET_LOCK('a', 10)); # Connection con1 reap -GET_LOCK('a', 10) -1 INSERT INTO bug_61209 (a) VALUES (NULL), (NULL), (NULL); SELECT RELEASE_LOCK('a'); +RELEASE_LOCK('a') +1 # Connection con2 reap Warnings: Warning 1265 Data truncated for column 'a' at row 3 - -# Connection con1 reap -RELEASE_LOCK('a') -1 DROP TABLE bug_61209; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-61209.test b/mysql-test/suite/innodb/t/innodb-autoinc-61209.test index 12bdc236b90..cf0b7cf2415 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc-61209.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc-61209.test @@ -29,7 +29,7 @@ INSERT INTO bug_61209 VALUES (), (); --connection con1 SET SESSION auto_increment_increment=3; SET SESSION auto_increment_offset=2; -send SELECT GET_LOCK('a', 10); +SELECT GET_LOCK('a', 9); --echo --echo # Connection con2 @@ -41,20 +41,14 @@ send INSERT INTO bug_61209 (a) VALUES (NULL), (NULL), (NULL + GET_LOCK('a', 10)) --echo --echo # Connection con1 reap --connection con1 -reap; INSERT INTO bug_61209 (a) VALUES (NULL), (NULL), (NULL); -send SELECT RELEASE_LOCK('a'); +SELECT RELEASE_LOCK('a'); --echo --echo # Connection con2 reap --connection con2 reap; ---echo ---echo # Connection con1 reap ---connection con1 -reap; - # # Clean up # From 5a8da660a853047e6877e42631b1911bcf54b340 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 29 Mar 2012 16:36:06 +0200 Subject: [PATCH 4/9] make the code compile again --- storage/maria/ha_maria.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 6c0914ab751..ed554c4c24c 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1088,7 +1088,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) == STATE_MOVED) { - _ma_check_print_error(¶m, zerofill_error_msg); + _ma_check_print_error(¶m, "%s", zerofill_error_msg); return HA_ADMIN_CORRUPT; } From bbf1a7961a37daa08e9818d381df1bca9e562bed Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 29 Mar 2012 18:06:08 +0200 Subject: [PATCH 5/9] fix the test case for windows: replace_result \\ / --- mysql-test/suite/maria/t/maria-autozerofill.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/suite/maria/t/maria-autozerofill.test b/mysql-test/suite/maria/t/maria-autozerofill.test index 637b7dafe92..1a9445ed9f0 100644 --- a/mysql-test/suite/maria/t/maria-autozerofill.test +++ b/mysql-test/suite/maria/t/maria-autozerofill.test @@ -54,6 +54,7 @@ EOF disable_ps_protocol; # see maria-recover.test replace_regex /Table.*t1/t1/ ; +replace_result \\ /; select * from t1; enable_ps_protocol; flush table t1; @@ -95,7 +96,9 @@ EOF check table t2; check table t2; repair table t2; +replace_result \\ /; optimize table t3; +replace_result \\ /; analyze table t4; drop database mysqltest; From 9b8542a4f6abde851ff428d0b6cffb789c5ccede Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 30 Mar 2012 13:42:52 +0300 Subject: [PATCH 6/9] Fixed bug lp:967914 "CHECK TABLE persistently reports table corruption after removing Aria logs" Fixed that repair removes the 'table is moved' mark. mysql-test/suite/maria/r/maria-autozerofill.result: Test case for lp:967914 mysql-test/suite/maria/t/maria-autozerofill.test: Test case for lp:967914 storage/maria/ha_maria.cc: Fixed that repair removes the 'table is moved' mark. --- .../suite/maria/r/maria-autozerofill.result | 17 +++++++++++++++++ .../suite/maria/t/maria-autozerofill.test | 7 +++++++ storage/maria/ha_maria.cc | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/maria/r/maria-autozerofill.result b/mysql-test/suite/maria/r/maria-autozerofill.result index 7fa47814ee5..b719dbaebcb 100644 --- a/mysql-test/suite/maria/r/maria-autozerofill.result +++ b/mysql-test/suite/maria/r/maria-autozerofill.result @@ -10,6 +10,8 @@ create table t3 (a int) engine=maria; INSERT INTO t3 VALUES (1),(2); create table t4 (a int) engine=maria; INSERT INTO t4 VALUES (1),(2); +create table t5 (a int) engine=maria; +INSERT INTO t5 VALUES (1),(2); flush tables; create_rename_lsn has non-magic value * shut down mysqld, removed logs, restarted it @@ -35,6 +37,9 @@ mysqltest.t2 check error Corrupt repair table t2; Table Op Msg_type Msg_text mysqltest.t2 repair status OK +check table t2; +Table Op Msg_type Msg_text +mysqltest.t2 check status OK optimize table t3; Table Op Msg_type Msg_text mysqltest.t3 optimize Note Zerofilling moved table ./mysqltest/t3 @@ -43,4 +48,16 @@ analyze table t4; Table Op Msg_type Msg_text mysqltest.t4 analyze Note Zerofilling moved table ./mysqltest/t4 mysqltest.t4 analyze status OK +repair table t5; +Table Op Msg_type Msg_text +mysqltest.t5 repair status OK +check table t5; +Table Op Msg_type Msg_text +mysqltest.t5 check status OK +repair table t5; +Table Op Msg_type Msg_text +mysqltest.t5 repair status OK +check table t5; +Table Op Msg_type Msg_text +mysqltest.t5 check status OK drop database mysqltest; diff --git a/mysql-test/suite/maria/t/maria-autozerofill.test b/mysql-test/suite/maria/t/maria-autozerofill.test index 1a9445ed9f0..79e209d5d90 100644 --- a/mysql-test/suite/maria/t/maria-autozerofill.test +++ b/mysql-test/suite/maria/t/maria-autozerofill.test @@ -31,6 +31,8 @@ create table t3 (a int) engine=maria; INSERT INTO t3 VALUES (1),(2); create table t4 (a int) engine=maria; INSERT INTO t4 VALUES (1),(2); +create table t5 (a int) engine=maria; +INSERT INTO t5 VALUES (1),(2); flush tables; # Check that table is not zerofilled, not movable @@ -96,9 +98,14 @@ EOF check table t2; check table t2; repair table t2; +check table t2; replace_result \\ /; optimize table t3; replace_result \\ /; analyze table t4; +repair table t5; +check table t5; +repair table t5; +check table t5; drop database mysqltest; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index ed554c4c24c..b261451d8dc 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1562,7 +1562,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) { DBUG_PRINT("info", ("Reseting crashed state")); share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED_FLAGS | - STATE_IN_REPAIR); + STATE_IN_REPAIR | STATE_MOVED); file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; } /* From 3dc35ee493711f084efa682d2c8a3ba6780f6297 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 30 Mar 2012 16:00:10 +0300 Subject: [PATCH 7/9] Compatibility fixes by U Orsini --- cmd-line-utils/libedit/chartype.h | 2 +- cmd-line-utils/libedit/np/unvis.c | 2 +- cmd-line-utils/libedit/np/vis.c | 2 +- mysys/my_getsystime.c | 2 +- plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp | 1 + sql/mysqld.cc | 2 ++ 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd-line-utils/libedit/chartype.h b/cmd-line-utils/libedit/chartype.h index 40012afb47d..576abe13ad5 100644 --- a/cmd-line-utils/libedit/chartype.h +++ b/cmd-line-utils/libedit/chartype.h @@ -49,7 +49,7 @@ TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */ #if !defined(__NetBSD__) && !defined(__sun) \ && !(defined(__APPLE__) && defined(__MACH__)) \ - && !defined(__FreeBSD__) && !defined(_AIX) + && !defined(__FreeBSD__) && !defined(_AIX) && !defined(__OpenBSD__) #ifndef __STDC_ISO_10646__ /* In many places it is assumed that the first 127 code points are ASCII * compatible, so ensure wchar_t indeed does ISO 10646 and not some other diff --git a/cmd-line-utils/libedit/np/unvis.c b/cmd-line-utils/libedit/np/unvis.c index 812d280b2d8..a911720ad35 100644 --- a/cmd-line-utils/libedit/np/unvis.c +++ b/cmd-line-utils/libedit/np/unvis.c @@ -64,7 +64,7 @@ static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93"; #include "np/vis.h" #ifdef __weak_alias -__weak_alias(strnunvisx,_strnunvisx) +__weak_alias(strnunvisx,_strnunvisx); #endif #if !HAVE_VIS diff --git a/cmd-line-utils/libedit/np/vis.c b/cmd-line-utils/libedit/np/vis.c index d7cc37b4f47..884a7894332 100644 --- a/cmd-line-utils/libedit/np/vis.c +++ b/cmd-line-utils/libedit/np/vis.c @@ -77,7 +77,7 @@ #include #ifdef __weak_alias -__weak_alias(strvisx,_strvisx) +__weak_alias(strvisx,_strvisx); #endif #if !HAVE_VIS || !HAVE_SVIS diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c index 268619a1334..8a3e97cffa7 100644 --- a/mysys/my_getsystime.c +++ b/mysys/my_getsystime.c @@ -124,7 +124,7 @@ void my_time_init() ulonglong my_getcputime() { -#ifdef HAVE_CLOCK_GETTIME +#ifdef CLOCK_THREAD_CPUTIME_ID struct timespec tp; if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp)) return 0; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp b/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp index 85887d1d55c..c254d17dff5 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr_worker.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/sql/mysqld.cc b/sql/mysqld.cc index aa3942521ed..36be99fc25c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2678,6 +2678,7 @@ static void init_signals(void) my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! +#ifdef HAVE_STACKTRACE if (opt_stack_trace || (test_flags & TEST_CORE_ON_SIGNAL)) { sa.sa_flags = SA_RESETHAND | SA_NODEFER; @@ -2700,6 +2701,7 @@ static void init_signals(void) sigaction(SIGILL, &sa, NULL); sigaction(SIGFPE, &sa, NULL); } +#endif #ifdef HAVE_GETRLIMIT if (test_flags & TEST_CORE_ON_SIGNAL) From 99075c84b218fa5fd18cc6aca4b897f600fbcfe5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 30 Mar 2012 16:09:57 +0200 Subject: [PATCH 8/9] mdev-205 don't install libevent headers --- extra/libevent/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/libevent/Makefile.am b/extra/libevent/Makefile.am index 1c9066c3122..746b46ceab2 100644 --- a/extra/libevent/Makefile.am +++ b/extra/libevent/Makefile.am @@ -18,7 +18,7 @@ libevent_a_SOURCES = event.c buffer.c evbuffer.c log.c evutil.c \ select.c poll.c epoll.c epoll_sub.c devpoll.c kqueue.c \ evport.c signal.c -include_HEADERS = event.h evutil.h event-config.h +noinst_HEADERS = event.h evutil.h event-config.h BUILT_SOURCES = event-config.h From 398f754b542487d0b2258f47d088eb6c6c2824f7 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 2 Apr 2012 11:45:07 +0300 Subject: [PATCH 9/9] Fixed lp:886479 "[PATCH] plugin boolean result" Thanks to Maarten Vanraes for the patch sql/sql_plugin.cc: Fix plugin boolean variables to receive the value "1", not "-1", when they are set to 1. Aside from being bizarre, the existing behavior is unportable: machines where char is unsigned print "255" instead. --- sql/sql_plugin.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 5b7c2d285e6..1547e576eca 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -2203,7 +2203,7 @@ static int check_func_bool(THD *thd, struct st_mysql_sys_var *var, { if (value->val_int(value, &tmp) < 0) goto err; - if (tmp > 1) + if (tmp != 0 && tmp != 1) { llstr(tmp, buff); strvalue= buff; @@ -2211,7 +2211,7 @@ static int check_func_bool(THD *thd, struct st_mysql_sys_var *var, } result= (int) tmp; } - *(my_bool *) save= -result; + *(my_bool *) save= result ? 1 : 0; return 0; err: my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->name, strvalue); @@ -2392,7 +2392,7 @@ err: static void update_func_bool(THD *thd, struct st_mysql_sys_var *var, void *tgt, const void *save) { - *(my_bool *) tgt= *(my_bool *) save ? TRUE : FALSE; + *(my_bool *) tgt= *(my_bool *) save ? 1 : 0; }