Bug #39892 Wrong usage of hander::info call in archive
Submitted: 6 Oct 2008 21:13 Modified: 9 Oct 2008 9:10
Reporter: Mattias Jonsson Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Archive storage engine Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: CPU Architecture:Any

[6 Oct 2008 21:13] Mattias Jonsson
Description:
When investigating bug#38751 I found that ha_archive rely on ::info calls for flushing written data from its write buffer to disk before reading. This seems like a violation of the handler api, and should be changed.

How to repeat:
in either gdb or by using the debug-output:

do a insert and then alter the same table.

Read the code in ha_archive.cc (ha_archive::info) and in sql_table.cc (mysql_prepare_alter_table)

Suggested fix:
Implement ha_archive::extra, and send a
HA_EXTRA_FLUSH_CACHE in mysql_prepare_alter_table, instead of doing the flush through:
mysql_alter_table
  mysql_prepare_alter_table
    table->file->update_create_info
      info(HA_STATUS_AUTO)
        flush of written records...

Should probably be:
mysql_alter_table
  mysql_prepare_alter_table
    table->file->extra(HA_EXTRA_FLUSH_CACHE)
      flush of written records...

And add comments for this use of HA_EXTRA_FLUSH_CACHE. (There might be a better flag to use, but this seems close enough for me)
[9 Oct 2008 9:10] Sveta Smirnova
Thank you for the report.

Verified as described.