Commit dd3c7bbc authored by Michael Widenius's avatar Michael Widenius

Merge

parents efb57a8e 511fd82b
...@@ -40,23 +40,44 @@ AC_DEFUN([MYSQL_CHECK_LIBEDIT_INTERFACE], [ ...@@ -40,23 +40,44 @@ AC_DEFUN([MYSQL_CHECK_LIBEDIT_INTERFACE], [
]) ])
AC_DEFUN([MYSQL_CHECK_NEW_RL_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_CACHE_CHECK([for system libreadline], mysql_cv_new_rl_interface,
AC_TRY_COMPILE( AC_COMPILE_IFELSE(
[ [AC_LANG_SOURCE([
#include "stdio.h" #include "stdio.h"
#include "readline/readline.h" #include "readline/readline.h"
],
[
rl_completion_func_t *func1= (rl_completion_func_t*)0; rl_completion_func_t *func1= (rl_completion_func_t*)0;
rl_compentry_func_t *func2= (rl_compentry_func_t*)0; rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
], ])],
[ [
mysql_cv_new_rl_interface=yes AC_PREPROC_IFELSE(
AC_DEFINE_UNQUOTED([USE_NEW_READLINE_INTERFACE], [1], [AC_LANG_SOURCE([
[used new readline interface (are rl_completion_func_t and rl_compentry_func_t defined)]) #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] [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
) )
]) ])
......
...@@ -633,6 +633,14 @@ AC_ARG_WITH(other-libc, ...@@ -633,6 +633,14 @@ AC_ARG_WITH(other-libc,
) )
AC_SUBST(NOINST_LDFLAGS) 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 # 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) # (this is true on the MySQL build machines to avoid NSS problems)
...@@ -1575,7 +1583,7 @@ fi ...@@ -1575,7 +1583,7 @@ fi
AC_MSG_CHECKING([for OpenSolaris Bug 6611808]) AC_MSG_CHECKING([for OpenSolaris Bug 6611808])
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <pthread.h> #include <pthread.h>
void dummy() {} void dummy() {}
int main() int main()
...@@ -1584,7 +1592,7 @@ AC_COMPILE_IFELSE([ ...@@ -1584,7 +1592,7 @@ AC_COMPILE_IFELSE([
pthread_once(&once_control, dummy); pthread_once(&once_control, dummy);
return 0; return 0;
} }
], [ ])], [
AC_DEFINE([PTHREAD_ONCE_INITIALIZER], [{PTHREAD_ONCE_INIT}], AC_DEFINE([PTHREAD_ONCE_INITIALIZER], [{PTHREAD_ONCE_INIT}],
[See OpenSolaris Bug 6611808]) [See OpenSolaris Bug 6611808])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
...@@ -2724,6 +2732,8 @@ case $SYSTEM_TYPE in ...@@ -2724,6 +2732,8 @@ case $SYSTEM_TYPE in
compile_libedit=yes compile_libedit=yes
AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1) AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1)
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1) AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
AC_MSG_CHECKING([for libedit/readline])
AC_MSG_RESULT([libedit bundled])
elif test "$with_readline" = "yes" elif test "$with_readline" = "yes"
then then
readline_topdir="cmd-line-utils" readline_topdir="cmd-line-utils"
...@@ -2734,6 +2744,8 @@ case $SYSTEM_TYPE in ...@@ -2734,6 +2744,8 @@ case $SYSTEM_TYPE in
compile_readline=yes compile_readline=yes
want_to_use_readline="yes" want_to_use_readline="yes"
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
AC_MSG_CHECKING([for libedit/readline])
AC_MSG_RESULT([readline bundled])
else else
# Use system readline library # Use system readline library
AC_LANG_SAVE AC_LANG_SAVE
...@@ -2748,12 +2760,16 @@ case $SYSTEM_TYPE in ...@@ -2748,12 +2760,16 @@ case $SYSTEM_TYPE in
# this way we avoid linking commercial source with GPL readline # this way we avoid linking commercial source with GPL readline
readline_link="-lreadline" readline_link="-lreadline"
want_to_use_readline="yes" want_to_use_readline="yes"
AC_MSG_CHECKING([for libedit/readline])
AC_MSG_RESULT([readline system])
elif [test "$mysql_cv_libedit_interface" = "yes"] elif [test "$mysql_cv_libedit_interface" = "yes"]
then then
# Use libedit # Use libedit
readline_link="-ledit" readline_link="-ledit"
AC_MSG_CHECKING([for libedit/readline])
AC_MSG_RESULT([libedit system])
else 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 Use --with-readline or --with-libedit to use the bundled
versions of libedit or readline]) versions of libedit or readline])
fi fi
...@@ -2998,6 +3014,13 @@ if test X"$with_plugin_ndbcluster" = Xyes ; then ...@@ -2998,6 +3014,13 @@ if test X"$with_plugin_ndbcluster" = Xyes ; then
echo for more details. echo for more details.
fi 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 # The first line "Thank you ..." is checked in ./Do-compile to verify that configure
# ended sucessfully - don't remove it. # ended sucessfully - don't remove it.
echo "" echo ""
......
...@@ -89,6 +89,28 @@ check table t1 extended; ...@@ -89,6 +89,28 @@ check table t1 extended;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysqltest.t1 check status OK mysqltest.t1 check status OK
drop table t1; 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_feeding_recovery;
drop database mysqltest_for_comparison; drop database mysqltest_for_comparison;
drop database mysqltest; drop database mysqltest;
...@@ -109,6 +109,24 @@ truncate table t1; ...@@ -109,6 +109,24 @@ truncate table t1;
check table t1 extended; check table t1 extended;
drop table t1; 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 # clean up everything
let $mms_purpose=feeding_recovery; let $mms_purpose=feeding_recovery;
eval drop database mysqltest_for_$mms_purpose; eval drop database mysqltest_for_$mms_purpose;
......
...@@ -650,6 +650,7 @@ static sys_var_thd_enum sys_query_cache_type(&vars, "query_cache_type", ...@@ -650,6 +650,7 @@ static sys_var_thd_enum sys_query_cache_type(&vars, "query_cache_type",
static sys_var_thd_bool static sys_var_thd_bool
sys_query_cache_wlock_invalidate(&vars, "query_cache_wlock_invalidate", sys_query_cache_wlock_invalidate(&vars, "query_cache_wlock_invalidate",
&SV::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 */ #endif /* HAVE_QUERY_CACHE */
static sys_var_bool_ptr sys_secure_auth(&vars, "secure_auth", &opt_secure_auth); 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", static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
......
...@@ -760,7 +760,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) ...@@ -760,7 +760,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
char buff[2048]; char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info); String buffer(buff, sizeof(buff), system_charset_info);
char *save_db, *save_table_name;
bool retval= TRUE; // Assume error bool retval= TRUE; // Assume error
List<Item> field_list; List<Item> field_list;
DBUG_ENTER("mysqld_show_create"); DBUG_ENTER("mysqld_show_create");
...@@ -770,10 +769,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) ...@@ -770,10 +769,6 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
/* We want to preserve the tree for views. */ /* We want to preserve the tree for views. */
thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW; 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); Show_create_error_handler view_error_suppressor(thd, table_list);
thd->push_internal_handler(&view_error_suppressor); thd->push_internal_handler(&view_error_suppressor);
...@@ -857,11 +852,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) ...@@ -857,11 +852,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
retval= FALSE; // ok retval= FALSE; // ok
error: error:
/* Restore table list if called by stored procedure */
table_list->db= save_db;
table_list->table_name= save_table_name;
DBUG_RETURN(retval); DBUG_RETURN(retval);
} }
bool mysqld_show_create_db(THD *thd, char *dbname, bool mysqld_show_create_db(THD *thd, char *dbname,
......
...@@ -2562,8 +2562,16 @@ int ha_maria::extra_opt(enum ha_extra_function operation, ulong cache_size) ...@@ -2562,8 +2562,16 @@ int ha_maria::extra_opt(enum ha_extra_function operation, ulong cache_size)
int ha_maria::delete_all_rows() int ha_maria::delete_all_rows()
{ {
THD *thd= table->in_use; THD *thd= table->in_use;
(void) translog_log_debug_info(file->trn, LOGREC_DEBUG_INFO_QUERY, #ifdef EXTRA_DEBUG
(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 && if (file->s->now_transactional &&
((table->in_use->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) || ((table->in_use->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
table->in_use->locked_tables)) table->in_use->locked_tables))
......
...@@ -1481,8 +1481,9 @@ my_bool _ma_log_delete(MARIA_PAGE *ma_page, const uchar *key_pos, ...@@ -1481,8 +1481,9 @@ my_bool _ma_log_delete(MARIA_PAGE *ma_page, const uchar *key_pos,
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
my_off_t page= ma_page->pos / share->block_size; my_off_t page= ma_page->pos / share->block_size;
DBUG_ENTER("_ma_log_delete"); DBUG_ENTER("_ma_log_delete");
DBUG_PRINT("enter", ("page: %lu changed_length: %u move_length: %d", DBUG_PRINT("enter", ("page: %lu offset: %u changed_length: %u move_length: %u append_length: %u page_size: %u",
(ulong) page, changed_length, move_length)); (ulong) page, offset, changed_length, move_length,
append_length, ma_page->size));
DBUG_ASSERT(share->now_transactional && move_length); DBUG_ASSERT(share->now_transactional && move_length);
DBUG_ASSERT(offset + changed_length <= ma_page->size); DBUG_ASSERT(offset + changed_length <= ma_page->size);
DBUG_ASSERT(ma_page->org_size - move_length + append_length == ma_page->size); DBUG_ASSERT(ma_page->org_size - move_length + append_length == ma_page->size);
......
...@@ -945,7 +945,7 @@ uint _ma_apply_redo_index(MARIA_HA *info, ...@@ -945,7 +945,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
const uchar *header_end= header + head_length; const uchar *header_end= header + head_length;
uint page_offset= 0, org_page_length; uint page_offset= 0, org_page_length;
uint page_length, keypage_header, keynr; 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; int result;
MARIA_PAGE page; MARIA_PAGE page;
DBUG_ENTER("_ma_apply_redo_index"); DBUG_ENTER("_ma_apply_redo_index");
...@@ -1106,6 +1106,8 @@ uint _ma_apply_redo_index(MARIA_HA *info, ...@@ -1106,6 +1106,8 @@ uint _ma_apply_redo_index(MARIA_HA *info,
case KEY_OP_DEBUG_2: case KEY_OP_DEBUG_2:
DBUG_PRINT("redo", ("org_page_length: %u new_page_length: %u", DBUG_PRINT("redo", ("org_page_length: %u new_page_length: %u",
uint2korr(header), uint2korr(header+2))); uint2korr(header), uint2korr(header+2)));
DBUG_ASSERT(uint2korr(header) == page_length);
new_page_length= uint2korr(header+2);
header+= 4; header+= 4;
break; break;
case KEY_OP_MAX_PAGELENGTH: case KEY_OP_MAX_PAGELENGTH:
...@@ -1171,6 +1173,7 @@ uint _ma_apply_redo_index(MARIA_HA *info, ...@@ -1171,6 +1173,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
} }
} while (header < header_end); } while (header < header_end);
DBUG_ASSERT(header == header_end); DBUG_ASSERT(header == header_end);
DBUG_ASSERT(new_page_length == 0 || new_page_length == page_length);
/* Write modified page */ /* Write modified page */
page.size= page_length; page.size= page_length;
......
...@@ -3592,6 +3592,10 @@ my_bool _ma_reenable_logging_for_table(MARIA_HA *info, my_bool flush_pages) ...@@ -3592,6 +3592,10 @@ my_bool _ma_reenable_logging_for_table(MARIA_HA *info, my_bool flush_pages)
if (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 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 this can cause race conditions, that's one reason to flush pages
......
...@@ -67,9 +67,9 @@ inline void xt_atomic_inc1(volatile xtWord1 *mptr) ...@@ -67,9 +67,9 @@ inline void xt_atomic_inc1(volatile xtWord1 *mptr)
#elif defined(XT_ATOMIC_GNUC_X86) #elif defined(XT_ATOMIC_GNUC_X86)
xtWord1 val; xtWord1 val;
asm volatile ("movb %1,%0" : "=r" (val) : "m" (*mptr) : "memory"); asm volatile ("movb %1,%0" : "=q" (val) : "m" (*mptr) : "memory");
val++; 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) #elif defined(XT_ATOMIC_SOLARIS_LIB)
atomic_inc_8(mptr); atomic_inc_8(mptr);
#else #else
...@@ -91,9 +91,9 @@ inline xtWord1 xt_atomic_dec1(volatile xtWord1 *mptr) ...@@ -91,9 +91,9 @@ inline xtWord1 xt_atomic_dec1(volatile xtWord1 *mptr)
#elif defined(XT_ATOMIC_GNUC_X86) #elif defined(XT_ATOMIC_GNUC_X86)
xtWord1 val2; xtWord1 val2;
asm volatile ("movb %1, %0" : "=r" (val) : "m" (*mptr) : "memory"); asm volatile ("movb %1, %0" : "=q" (val) : "m" (*mptr) : "memory");
val--; 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? /* Should work, but compiler makes a mistake?
* asm volatile ("xchgb %1, %0" : : "r" (val), "m" (*mptr) : "memory"); * asm volatile ("xchgb %1, %0" : : "r" (val), "m" (*mptr) : "memory");
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment