1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

bug#2831 - --extenral-locking does not fully work with --myisam-recover.

Changed the semantics of open_count so that it is decremented
at every unlock (if it was incremented due to data changes).
So it indicates a crash, if it is non-zero after a lock.
The table will then be repaired.
This commit is contained in:
ingo@mysql.com
2004-09-18 20:33:39 +02:00
parent cda336b928
commit 7afb03b7ed
4 changed files with 111 additions and 11 deletions

View File

@ -2208,7 +2208,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (!(copy= new Copy_field[to->fields]))
DBUG_RETURN(-1); /* purecov: inspected */
to->file->external_lock(thd,F_WRLCK);
if (to->file->external_lock(thd, F_WRLCK))
{
/* We must always unlock, even when lock failed. */
(void) to->file->external_lock(thd, F_UNLCK);
DBUG_RETURN(-1);
}
to->file->extra(HA_EXTRA_WRITE_CACHE);
from->file->info(HA_STATUS_VARIABLE);
to->file->deactivate_non_unique_index(from->file->records);
@ -2308,11 +2313,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
error=1;
if (ha_commit(thd))
error=1;
if (to->file->external_lock(thd,F_UNLCK))
error=1;
err:
free_io_cache(from);
*copied= found_count;
*deleted=delete_count;
/* we must always unlock the table on return. */
if (to->file->external_lock(thd,F_UNLCK))
error=1;
DBUG_RETURN(error > 0 ? -1 : 0);
}