diff options
-rw-r--r-- | config/ac-macros/readline.m4 | 39 | ||||
-rw-r--r-- | configure.in | 29 | ||||
-rw-r--r-- | mysql-test/std_data/bug887051.txt | 2 | ||||
-rw-r--r-- | mysql-test/suite/maria/r/maria-recovery3.result | 22 | ||||
-rw-r--r-- | mysql-test/suite/maria/t/maria-recovery3.test | 18 | ||||
-rw-r--r-- | sql/set_var.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 1 | ||||
-rw-r--r-- | sql/sql_show.cc | 9 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 12 | ||||
-rw-r--r-- | storage/maria/ma_delete.c | 5 | ||||
-rw-r--r-- | storage/maria/ma_key_recover.c | 5 | ||||
-rw-r--r-- | storage/maria/ma_recovery.c | 4 | ||||
-rw-r--r-- | storage/pbxt/src/lock_xt.h | 8 |
13 files changed, 126 insertions, 32 deletions
diff --git a/config/ac-macros/readline.m4 b/config/ac-macros/readline.m4 index e1ed8420bfb..9e62d9add3e 100644 --- a/config/ac-macros/readline.m4 +++ b/config/ac-macros/readline.m4 @@ -40,23 +40,44 @@ AC_DEFUN([MYSQL_CHECK_LIBEDIT_INTERFACE], [ ]) AC_DEFUN([MYSQL_CHECK_NEW_RL_INTERFACE], [ - AC_CACHE_CHECK([defined rl_compentry_func_t and rl_completion_func_t], mysql_cv_new_rl_interface, - AC_TRY_COMPILE( - [ + AC_CACHE_CHECK([for system libreadline], mysql_cv_new_rl_interface, + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([ #include "stdio.h" #include "readline/readline.h" - ], - [ rl_completion_func_t *func1= (rl_completion_func_t*)0; rl_compentry_func_t *func2= (rl_compentry_func_t*)0; - ], + ])], [ - mysql_cv_new_rl_interface=yes - AC_DEFINE_UNQUOTED([USE_NEW_READLINE_INTERFACE], [1], - [used new readline interface (are rl_completion_func_t and rl_compentry_func_t defined)]) + AC_PREPROC_IFELSE( + [AC_LANG_SOURCE([ + #include "stdio.h" + #include "readline/readline.h" + #if RL_VERSION_MAJOR > 5 + #error + #endif + ])], [ rl_v5=yes ], [ rl_v5=no ], + ) + if [test "$rl_v5" = "yes"] + then + mysql_cv_new_rl_interface=yes + else + if [test "$enable_distribution" = "yes"] + then + mysql_cv_new_rl_interface=no + else + mysql_cv_new_rl_interface=yes + enable_distribution=warn + fi + fi ], [mysql_cv_new_rl_interface=no] ) + if [test "$mysql_cv_new_rl_interface" = yes] + then + AC_DEFINE_UNQUOTED([USE_NEW_READLINE_INTERFACE], [1], + [used new readline interface (are rl_completion_func_t and rl_compentry_func_t defined)]) + fi ) ]) diff --git a/configure.in b/configure.in index 6b565f18610..e430e4f12f3 100644 --- a/configure.in +++ b/configure.in @@ -633,6 +633,14 @@ AC_ARG_WITH(other-libc, ) AC_SUBST(NOINST_LDFLAGS) +AC_ARG_ENABLE(distribution, + AC_HELP_STRING( + [--disable-distribution], + [Allow linking with system GPLv3 libraries. It may result in a binary that can not be legally distributed.]), + [ enable_distribution=$enableval ], + [ enable_distribution=yes ] + ) + # # Check if we are using Linux and a glibc compiled with static nss # (this is true on the MySQL build machines to avoid NSS problems) @@ -1575,7 +1583,7 @@ fi AC_MSG_CHECKING([for OpenSolaris Bug 6611808]) save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" -AC_COMPILE_IFELSE([ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ #include <pthread.h> void dummy() {} int main() @@ -1584,7 +1592,7 @@ AC_COMPILE_IFELSE([ pthread_once(&once_control, dummy); return 0; } -], [ +])], [ AC_DEFINE([PTHREAD_ONCE_INITIALIZER], [{PTHREAD_ONCE_INIT}], [See OpenSolaris Bug 6611808]) AC_MSG_RESULT([yes]) @@ -2724,6 +2732,8 @@ case $SYSTEM_TYPE in compile_libedit=yes AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) + AC_MSG_CHECKING([for libedit/readline]) + AC_MSG_RESULT([libedit bundled]) elif test "$with_readline" = "yes" then readline_topdir="cmd-line-utils" @@ -2734,6 +2744,8 @@ case $SYSTEM_TYPE in compile_readline=yes want_to_use_readline="yes" AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) + AC_MSG_CHECKING([for libedit/readline]) + AC_MSG_RESULT([readline bundled]) else # Use system readline library AC_LANG_SAVE @@ -2748,12 +2760,16 @@ case $SYSTEM_TYPE in # this way we avoid linking commercial source with GPL readline readline_link="-lreadline" want_to_use_readline="yes" + AC_MSG_CHECKING([for libedit/readline]) + AC_MSG_RESULT([readline system]) elif [test "$mysql_cv_libedit_interface" = "yes"] then # Use libedit readline_link="-ledit" + AC_MSG_CHECKING([for libedit/readline]) + AC_MSG_RESULT([libedit system]) else - AC_MSG_ERROR([Could not find system readline or libedit libraries + AC_MSG_ERROR([Could not find usable system readline or libedit libraries Use --with-readline or --with-libedit to use the bundled versions of libedit or readline]) fi @@ -2998,6 +3014,13 @@ if test X"$with_plugin_ndbcluster" = Xyes ; then echo for more details. fi +if test "$enable_distribution" = "warn" +then + echo "You have linked MariaDB with GPLv3 libraries!" + echo "You may not distribute the resulting binary. If you do, you will " + echo "put yourself into a legal problem with Free Software Foundation." +fi + # The first line "Thank you ..." is checked in ./Do-compile to verify that configure # ended sucessfully - don't remove it. echo "" diff --git a/mysql-test/std_data/bug887051.txt b/mysql-test/std_data/bug887051.txt new file mode 100644 index 00000000000..a1df5f35bb1 --- /dev/null +++ b/mysql-test/std_data/bug887051.txt @@ -0,0 +1,2 @@ +saved1 +saved2 diff --git a/mysql-test/suite/maria/r/maria-recovery3.result b/mysql-test/suite/maria/r/maria-recovery3.result index cab3fd55091..89643b7c7a0 100644 --- a/mysql-test/suite/maria/r/maria-recovery3.result +++ b/mysql-test/suite/maria/r/maria-recovery3.result @@ -89,6 +89,28 @@ check table t1 extended; Table Op Msg_type Msg_text mysqltest.t1 check status OK drop table t1; +CREATE TABLE t1 ( word VARCHAR(255) PRIMARY KEY ) ENGINE=Aria; +LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1; +SET AUTOCOMMIT=0; +DELETE FROM t1; +LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1 IGNORE 1 LINES; +COMMIT; +SET SESSION debug="+d,maria_flush_whole_log,maria_crash"; +* crashing mysqld intentionally +set global aria_checkpoint_interval=1; +ERROR HY000: Lost connection to MySQL server during query +* recovery happens +check table t1 extended; +Table Op Msg_type Msg_text +mysqltest.t1 check status OK +* testing that checksum after recovery is as expected +Checksum-check +failure +use mysqltest; +select * from t1; +word +saved2 +drop table t1; drop database mysqltest_for_feeding_recovery; drop database mysqltest_for_comparison; drop database mysqltest; diff --git a/mysql-test/suite/maria/t/maria-recovery3.test b/mysql-test/suite/maria/t/maria-recovery3.test index 192361633ca..c8333a66f30 100644 --- a/mysql-test/suite/maria/t/maria-recovery3.test +++ b/mysql-test/suite/maria/t/maria-recovery3.test @@ -109,6 +109,24 @@ truncate table t1; check table t1 extended; drop table t1; +# +# Test for BUG#887051; Failure in recovery with delete +# + +let $mvr_restore_old_snapshot=0; +let $mms_compare_physically=0; +let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash"; +let $mvr_crash_statement= set global aria_checkpoint_interval=1; +CREATE TABLE t1 ( word VARCHAR(255) PRIMARY KEY ) ENGINE=Aria; +LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1; +SET AUTOCOMMIT=0; +DELETE FROM t1; +LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1 IGNORE 1 LINES; +COMMIT; +-- source include/maria_verify_recovery.inc +select * from t1; +drop table t1; + # clean up everything let $mms_purpose=feeding_recovery; eval drop database mysqltest_for_$mms_purpose; diff --git a/sql/set_var.cc b/sql/set_var.cc index 12ec76327f4..e6c1bf94135 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -650,6 +650,8 @@ static sys_var_thd_enum sys_query_cache_type(&vars, "query_cache_type", static sys_var_thd_bool sys_query_cache_wlock_invalidate(&vars, "query_cache_wlock_invalidate", &SV::query_cache_wlock_invalidate); +static sys_var_bool_ptr sys_query_cache_strip_comments(&vars, "query_cache_strip_comments", + &opt_query_cache_strip_comments); #endif /* HAVE_QUERY_CACHE */ static sys_var_bool_ptr sys_secure_auth(&vars, "secure_auth", &opt_secure_auth); static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv", @@ -939,8 +941,6 @@ static sys_var_const_str sys_hostname(&vars, "hostname", glob_hostname); static sys_var_const_str_ptr sys_log_basename(&vars, "log_basename", &opt_log_basename); -static sys_var_bool_ptr sys_query_cache_strip_comments(&vars, "query_cache_strip_comments", - &opt_query_cache_strip_comments); #ifndef EMBEDDED_LIBRARY static sys_var_const_str_ptr sys_repl_report_host(&vars, "report_host", &report_host); static sys_var_const_str_ptr sys_repl_report_user(&vars, "report_user", &report_user); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 313159d33d1..7a8f4e854ec 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -14473,6 +14473,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, goto err; } status_var_increment(table->in_use->status_var.created_tmp_disk_tables); + table->in_use->query_plan_flags|= QPLAN_TMP_DISK; share->db_record_offset= 1; table->created= TRUE; DBUG_RETURN(0); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 21036554c91..0e8b919db53 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -760,7 +760,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) Protocol *protocol= thd->protocol; char buff[2048]; String buffer(buff, sizeof(buff), system_charset_info); - char *save_db, *save_table_name; bool retval= TRUE; // Assume error List<Item> field_list; DBUG_ENTER("mysqld_show_create"); @@ -770,10 +769,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) /* We want to preserve the tree for views. */ thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW; - /* Store original names if called from SP */ - save_db= table_list->db; - save_table_name= table_list->table_name; - { Show_create_error_handler view_error_suppressor(thd, table_list); thd->push_internal_handler(&view_error_suppressor); @@ -857,11 +852,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) retval= FALSE; // ok error: - /* Restore table list if called by stored procedure */ - table_list->db= save_db; - table_list->table_name= save_table_name; DBUG_RETURN(retval); - } bool mysqld_show_create_db(THD *thd, char *dbname, diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index df1817fcb1d..92b2a965706 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2561,9 +2561,17 @@ int ha_maria::extra_opt(enum ha_extra_function operation, ulong cache_size) int ha_maria::delete_all_rows() { +#ifdef EXTRA_DEBUG THD *thd= table->in_use; - (void) translog_log_debug_info(file->trn, LOGREC_DEBUG_INFO_QUERY, - (uchar*) thd->query(), thd->query_length()); + TRN *trn= file->trn; + if (trn && ! (trnman_get_flags(trn) & TRN_STATE_INFO_LOGGED)) + { + trnman_set_flags(trn, trnman_get_flags(trn) | TRN_STATE_INFO_LOGGED | + TRN_STATE_TABLES_CAN_CHANGE); + (void) translog_log_debug_info(trn, LOGREC_DEBUG_INFO_QUERY, + (uchar*) thd->query(), thd->query_length()); + } +#endif if (file->s->now_transactional && ((table->in_use->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) || table->in_use->locked_tables)) diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c index a2e2d9b040c..149a4316dcf 100644 --- a/storage/maria/ma_delete.c +++ b/storage/maria/ma_delete.c @@ -1481,8 +1481,9 @@ my_bool _ma_log_delete(MARIA_PAGE *ma_page, const uchar *key_pos, MARIA_SHARE *share= info->s; my_off_t page= ma_page->pos / share->block_size; DBUG_ENTER("_ma_log_delete"); - DBUG_PRINT("enter", ("page: %lu changed_length: %u move_length: %d", - (ulong) page, changed_length, move_length)); + DBUG_PRINT("enter", ("page: %lu offset: %u changed_length: %u move_length: %u append_length: %u page_size: %u", + (ulong) page, offset, changed_length, move_length, + append_length, ma_page->size)); DBUG_ASSERT(share->now_transactional && move_length); DBUG_ASSERT(offset + changed_length <= ma_page->size); DBUG_ASSERT(ma_page->org_size - move_length + append_length == ma_page->size); diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c index 48bb9cb13d0..c0d906117b6 100644 --- a/storage/maria/ma_key_recover.c +++ b/storage/maria/ma_key_recover.c @@ -945,7 +945,7 @@ uint _ma_apply_redo_index(MARIA_HA *info, const uchar *header_end= header + head_length; uint page_offset= 0, org_page_length; uint page_length, keypage_header, keynr; - uint max_page_size= share->max_index_block_size; + uint max_page_size= share->max_index_block_size, new_page_length= 0; int result; MARIA_PAGE page; DBUG_ENTER("_ma_apply_redo_index"); @@ -1106,6 +1106,8 @@ uint _ma_apply_redo_index(MARIA_HA *info, case KEY_OP_DEBUG_2: DBUG_PRINT("redo", ("org_page_length: %u new_page_length: %u", uint2korr(header), uint2korr(header+2))); + DBUG_ASSERT(uint2korr(header) == page_length); + new_page_length= uint2korr(header+2); header+= 4; break; case KEY_OP_MAX_PAGELENGTH: @@ -1171,6 +1173,7 @@ uint _ma_apply_redo_index(MARIA_HA *info, } } while (header < header_end); DBUG_ASSERT(header == header_end); + DBUG_ASSERT(new_page_length == 0 || new_page_length == page_length); /* Write modified page */ page.size= page_length; diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index cc81fea3869..37def17c4c3 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -3592,6 +3592,10 @@ my_bool _ma_reenable_logging_for_table(MARIA_HA *info, my_bool flush_pages) if (flush_pages) { + /* Ensure that recover is not executing any redo before this */ + if (!maria_in_recovery) + share->state.is_of_horizon= share->state.create_rename_lsn= + share->state.skip_redo_lsn= translog_get_horizon(); /* We are going to change callbacks; if a page is flushed at this moment this can cause race conditions, that's one reason to flush pages diff --git a/storage/pbxt/src/lock_xt.h b/storage/pbxt/src/lock_xt.h index 28737478d48..002636e3ffa 100644 --- a/storage/pbxt/src/lock_xt.h +++ b/storage/pbxt/src/lock_xt.h @@ -67,9 +67,9 @@ inline void xt_atomic_inc1(volatile xtWord1 *mptr) #elif defined(XT_ATOMIC_GNUC_X86) xtWord1 val; - asm volatile ("movb %1,%0" : "=r" (val) : "m" (*mptr) : "memory"); + asm volatile ("movb %1,%0" : "=q" (val) : "m" (*mptr) : "memory"); val++; - asm volatile ("xchgb %1,%0" : "=r" (val) : "m" (*mptr), "0" (val) : "memory"); + asm volatile ("xchgb %1,%0" : "=q" (val) : "m" (*mptr), "0" (val) : "memory"); #elif defined(XT_ATOMIC_SOLARIS_LIB) atomic_inc_8(mptr); #else @@ -91,9 +91,9 @@ inline xtWord1 xt_atomic_dec1(volatile xtWord1 *mptr) #elif defined(XT_ATOMIC_GNUC_X86) xtWord1 val2; - asm volatile ("movb %1, %0" : "=r" (val) : "m" (*mptr) : "memory"); + asm volatile ("movb %1, %0" : "=q" (val) : "m" (*mptr) : "memory"); val--; - asm volatile ("xchgb %1,%0" : "=r" (val2) : "m" (*mptr), "0" (val) : "memory"); + asm volatile ("xchgb %1,%0" : "=q" (val2) : "m" (*mptr), "0" (val) : "memory"); /* Should work, but compiler makes a mistake? * asm volatile ("xchgb %1, %0" : : "r" (val), "m" (*mptr) : "memory"); */ |