Merge with 5.2

This commit is contained in:
Michael Widenius 2011-12-14 20:36:51 +02:00
commit 511fd82b26
11 changed files with 123 additions and 30 deletions

View file

@ -2562,8 +2562,16 @@ int ha_maria::extra_opt(enum ha_extra_function operation, ulong cache_size)
int ha_maria::delete_all_rows()
{
THD *thd= table->in_use;
(void) translog_log_debug_info(file->trn, LOGREC_DEBUG_INFO_QUERY,
(uchar*) thd->query(), thd->query_length());
#ifdef EXTRA_DEBUG
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))

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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");
*/