BUG#11751793 - 42784: Merge from mysql-5.1 to mysql-5.5
This commit is contained in:
commit
0fa7fe90b4
@ -1689,12 +1689,14 @@ 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 */
|
||||
mysql_mutex_lock(&share->mutex);
|
||||
count= share->rows_recorded;
|
||||
/* Flush any waiting data */
|
||||
if (share->archive_write_open)
|
||||
azflush(&(share->archive_write), Z_SYNC_FLUSH);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
|
||||
@ -1705,18 +1707,34 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
start of the file.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
mysql_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);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
|
||||
if ((rc && rc != HA_ERR_END_OF_FILE) || count)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
DBUG_RETURN(HA_ADMIN_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user