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;
|
int rc= 0;
|
||||||
const char *old_proc_info;
|
const char *old_proc_info;
|
||||||
ha_rows count= share->rows_recorded;
|
ha_rows count;
|
||||||
DBUG_ENTER("ha_archive::check");
|
DBUG_ENTER("ha_archive::check");
|
||||||
|
|
||||||
old_proc_info= thd_proc_info(thd, "Checking table");
|
old_proc_info= thd_proc_info(thd, "Checking table");
|
||||||
/* Flush any waiting data */
|
|
||||||
mysql_mutex_lock(&share->mutex);
|
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);
|
azflush(&(share->archive_write), Z_SYNC_FLUSH);
|
||||||
mysql_mutex_unlock(&share->mutex);
|
mysql_mutex_unlock(&share->mutex);
|
||||||
|
|
||||||
@ -1705,20 +1707,36 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
|
|||||||
start of the file.
|
start of the file.
|
||||||
*/
|
*/
|
||||||
read_data_header(&archive);
|
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])))
|
while (!(rc= get_row(&archive, table->record[0])))
|
||||||
count--;
|
count--;
|
||||||
|
mysql_mutex_unlock(&share->mutex);
|
||||||
thd_proc_info(thd, old_proc_info);
|
|
||||||
|
|
||||||
if ((rc && rc != HA_ERR_END_OF_FILE) || count)
|
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;
|
share->crashed= FALSE;
|
||||||
DBUG_RETURN(HA_ADMIN_CORRUPT);
|
DBUG_RETURN(HA_ADMIN_CORRUPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_RETURN(HA_ADMIN_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check and repair the table if needed.
|
Check and repair the table if needed.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user