Merge with MariaDB 5.2

This commit is contained in:
Michael Widenius 2012-02-21 01:58:50 +02:00
commit 15c5a2686f
44 changed files with 931 additions and 328 deletions

View file

@ -773,6 +773,7 @@ uint32 ha_archive::max_row_length(const uchar *buf)
ptr != end ;
ptr++)
{
if (!table->field[*ptr]->is_null())
length += 2 + ((Field_blob*)table->field[*ptr])->get_length();
}
@ -1620,13 +1621,15 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc= 0;
const char *old_proc_info;
ha_rows count= share->rows_recorded;
ha_rows count;
DBUG_ENTER("ha_archive::check");
old_proc_info= thd_proc_info(thd, "Checking table");
/* Flush any waiting data */
pthread_mutex_lock(&share->mutex);
azflush(&(share->archive_write), Z_SYNC_FLUSH);
count= share->rows_recorded;
/* Flush any waiting data */
if (share->archive_write_open)
azflush(&(share->archive_write), Z_SYNC_FLUSH);
pthread_mutex_unlock(&share->mutex);
if (init_archive_reader())
@ -1639,18 +1642,34 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_RETURN(errno);
read_data_header(&archive);
for (ha_rows cur_count= count; cur_count; cur_count--)
{
if ((rc= get_row(&archive, table->record[0])))
goto error;
}
/*
Now read records that may have been inserted concurrently.
Acquire share->mutex so tail of the table is not modified by
concurrent writers.
*/
pthread_mutex_lock(&share->mutex);
count= share->rows_recorded - count;
if (share->archive_write_open)
azflush(&(share->archive_write), Z_SYNC_FLUSH);
while (!(rc= get_row(&archive, table->record[0])))
count--;
thd_proc_info(thd, old_proc_info);
pthread_mutex_unlock(&share->mutex);
if ((rc && rc != HA_ERR_END_OF_FILE) || count)
{
share->crashed= FALSE;
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
goto error;
thd_proc_info(thd, old_proc_info);
DBUG_RETURN(HA_ADMIN_OK);
error:
thd_proc_info(thd, old_proc_info);
share->crashed= FALSE;
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
/*

View file

@ -4798,7 +4798,6 @@ ha_innobase::innobase_get_index(
dict_index_t* index = 0;
DBUG_ENTER("innobase_get_index");
ha_statistic_increment(&SSV::ha_read_key_count);
ut_ad(user_thd == ha_thd());
ut_a(prebuilt->trx == thd_to_trx(user_thd));

View file

@ -1,3 +1,14 @@
2011-12-13 The InnoDB Team
* handler/ha_innodb.cc, innodb.test, innodb.result:
Fix Bug#13117023: InnoDB was incrementing the handler_read_key,
also the SSV::ha_read_key_count, at the wrong place.
2011-12-10 The InnoDB Team
* include/page0page.h, page/page0page.c:
Fix Bug#13418887 ERROR IN DIAGNOSTIC FUNCTION PAGE_REC_PRINT()
2011-11-10 The InnoDB Team
* handler/ha_innodb.cc, row/row0ins.c, innodb_replace.test:
@ -13,7 +24,12 @@
2011-10-27 The InnoDB Team
* row/row0mysql.c:
Fix Bug#12884631 62146: TABLES ARE LOST FOR DDL
Fix Bug #12884631 62146: TABLES ARE LOST FOR DDL
2011-10-25 The InnoDB Team
* handler/ha_innodb.cc, row/row0ins.c:
Fix Bug#13002783 PARTIALLY UNINITIALIZED CASCADE UPDATE VECTOR
2011-10-20 The InnoDB Team

View file

@ -5574,7 +5574,6 @@ ha_innobase::innobase_get_index(
dict_index_t* index = 0;
DBUG_ENTER("innobase_get_index");
ha_statistic_increment(&SSV::ha_read_key_count);
if (keynr != MAX_KEY && table->s->keys > 0) {
key = table->key_info + keynr;

View file

@ -892,6 +892,7 @@ page_parse_create(
ulint comp, /*!< in: nonzero=compact page format */
buf_block_t* block, /*!< in: block or NULL */
mtr_t* mtr); /*!< in: mtr or NULL */
#ifndef UNIV_HOTBACKUP
/************************************************************//**
Prints record contents including the data relevant only in
the index page context. */
@ -901,6 +902,7 @@ page_rec_print(
/*===========*/
const rec_t* rec, /*!< in: physical record */
const ulint* offsets);/*!< in: record descriptor */
# ifdef UNIV_BTR_PRINT
/***************************************************************//**
This is used to print the contents of the directory for
debugging purposes. */
@ -940,6 +942,8 @@ page_print(
in directory */
ulint rn); /*!< in: print rn first and last records
in directory */
# endif /* UNIV_BTR_PRINT */
#endif /* !UNIV_HOTBACKUP */
/***************************************************************//**
The following is used to validate a record on a page. This function
differs from rec_validate as it can also check the n_owned field and

View file

@ -1613,13 +1613,14 @@ page_rec_print(
" n_owned: %lu; heap_no: %lu; next rec: %lu\n",
(ulong) rec_get_n_owned_old(rec),
(ulong) rec_get_heap_no_old(rec),
(ulong) rec_get_next_offs(rec, TRUE));
(ulong) rec_get_next_offs(rec, FALSE));
}
page_rec_check(rec);
rec_validate(rec, offsets);
}
# ifdef UNIV_BTR_PRINT
/***************************************************************//**
This is used to print the contents of the directory for
debugging purposes. */
@ -1780,6 +1781,7 @@ page_print(
page_dir_print(page, dn);
page_print_list(block, index, rn);
}
# endif /* UNIV_BTR_PRINT */
#endif /* !UNIV_HOTBACKUP */
/***************************************************************//**

View file

@ -916,6 +916,9 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
*/
}
translog_unlock();
if (state_copy == state_copies)
break; /* Nothing to do */
/**
We are going to flush these states.
Before, all records describing how to undo such state must be
@ -940,13 +943,13 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
if (translog_flush(state_copies_horizon))
goto err;
/* now we have cached states and they are WAL-safe*/
state_copies_end= state_copy;
state_copies_end= state_copy-1;
state_copy= state_copies;
}
/* locate our state among these cached ones */
for ( ; state_copy->index != i; state_copy++)
DBUG_ASSERT(state_copy < state_copies_end);
DBUG_ASSERT(state_copy <= state_copies_end);
/* OS file descriptors are ints which we stored in 4 bytes */
compile_time_assert(sizeof(int) <= 4);

View file

@ -90,7 +90,12 @@ int mi_close(register MI_INFO *info)
}
#ifdef HAVE_MMAP
if (share->file_map)
_mi_unmap_file(info);
{
if (share->options & HA_OPTION_COMPRESS_RECORD)
_mi_unmap_file(info);
else
mi_munmap_file(info);
}
#endif
if (share->decode_trees)
{

View file

@ -1554,13 +1554,14 @@ my_bool _mi_memmap_file(MI_INFO *info)
void _mi_unmap_file(MI_INFO *info)
{
VOID(my_munmap((char*) info->s->file_map,
(size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
DBUG_ASSERT(info->s->options & HA_OPTION_COMPRESS_RECORD);
VOID(my_munmap((char*) info->s->file_map, (size_t) info->s->mmaped_length));
if (myisam_mmap_size != SIZE_T_MAX)
{
pthread_mutex_lock(&THR_LOCK_myisam_mmap);
myisam_mmap_used-= info->s->mmaped_length + MEMMAP_EXTRA_MARGIN;
myisam_mmap_used-= info->s->mmaped_length;
pthread_mutex_unlock(&THR_LOCK_myisam_mmap);
}
}

View file

@ -56,6 +56,9 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
if (!keys || !mi_is_any_key_active(key_map) || key_file_length == pos)
DBUG_RETURN(0);
/* Preload into a non initialized key cache should never happen. */
DBUG_ASSERT(share->key_cache->key_cache_inited);
block_length= keyinfo[0].block_length;
if (ignore_leaves)

View file

@ -6273,7 +6273,6 @@ ha_innobase::innobase_get_index(
dict_index_t* index = 0;
DBUG_ENTER("innobase_get_index");
ha_statistic_increment(&SSV::ha_read_key_count);
if (keynr != MAX_KEY && table->s->keys > 0) {
key = table->key_info + keynr;

View file

@ -1625,7 +1625,7 @@ page_rec_print(
" n_owned: %lu; heap_no: %lu; next rec: %lu\n",
(ulong) rec_get_n_owned_old(rec),
(ulong) rec_get_heap_no_old(rec),
(ulong) rec_get_next_offs(rec, TRUE));
(ulong) rec_get_next_offs(rec, FALSE));
}
page_rec_check(rec);