WL#292: Fix bug in INSERT DELAYED with ANALYZE....

Status: Assigned   —   Priority: Low

ALTER TABLE, OPTIMIZE TABLE, ANALYZE TABLE and REPAIR TABLE
doesn't work
reliable with table on which one are executing INSERT DELAYED
statements
at the same time the command is running.

Symptoms are lockups or crashed tables.

Proposed fix in MySQL 4.0

When doing an open_ltable() (Table with lock) for any of the
above commands, it should be done in the following way:

- open table
- mark in shared structure that insert delayed is not allowed
- Kill insert-delayed thread for table if it exists
  This will flush all pending rows to disk.
- Get lock for table
- Execute operation
- Close table
- Send signal to possible insert-delayed-thread that it can  
continue.

- As long as the shared struct is marked, all tries to do 
TL_LOCK_DELAYED should be changed to TL_WRITE_LOW_PRIORITY. 
This will ensure that open_ltable() in handle_delay_insert()
will wait until the statement has executed.