Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
We have bitmaps in the TABLE object to mark columns that can be written to or read from. There are asserts in the Field class to verify that the field is marked appropriately (a read or write bit is set for this field, depending on whether it's a read or write method of the Field class).
But storage engines use fields to convert the data from the internal engine format to the server record format. That is, when a server wants to read a field value, the engine populates the record buffer using the field's write method. And when a server writes a record to the engine, the engine uses field's read method to get the value from the record buffer.
In other words, engines use read-marked fields for writing and write-marked fields for reading, always hitting the assert. Thus all engines that use fields this way have adopted a rule of wrapping reading/writing code in the following incantation:
my_bitmap_map *orig= dbug_tmp_use_all_columns(table, table->read_set);
|
// ... use fields ...
|
dbug_tmp_restore_column_map(table->read_set, orig);
|
which temporarily resets the bitmap. This is ugly — engines should not care about server internal debugging asserts.
To fix this the server should reset bitmaps in handler::ha_write_row() and other methods, providing the clear API to the engine not contaminated by internal server debugging tools.