Commit 47f5632d authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-3837 Assertion `table->read_set == &table->def_read_set' failed on...

MDEV-3837 Assertion `table->read_set == &table->def_read_set' failed on updating a performance_schema table
This was failing not only for P_S, but for any engine that had
HA_PRIMARY_KEY_REQUIRED_FOR_DELETE flag set (in the tree - only P_S and federated).
Because of this flag, read_set and write_set were (possibly) changed
on update. But later the code modified these bitmaps and restored them to the default
state, losing HA_PRIMARY_KEY_REQUIRED_FOR_DELETE related changes.

sql/handler.cc:
  small optimization.
  don't change the *write* set only because all columns has to be *read*
parent 2217717f
UPDATE performance_schema.setup_instruments SET timed = 'YES' ORDER BY name;
--source include/not_embedded.inc
--source include/have_perfschema.inc
#
# MDEV-3837 Assertion `table->read_set == &table->def_read_set' failed on updating a performance_schema table
#
UPDATE performance_schema.setup_instruments SET timed = 'YES' ORDER BY name;
......@@ -5446,7 +5446,7 @@ int handler::ha_delete_row(const uchar *buf)
void handler::use_hidden_primary_key()
{
/* fallback to use all columns in the table to identify row */
table->use_all_columns();
table->column_bitmaps_set(&table->s->all_set, table->write_set);
}
......
......@@ -480,10 +480,8 @@ int mysql_update(THD *thd,
We can't update table directly; We must first search after all
matching rows before updating the table!
*/
// Verify that table->restore_column_maps_after_mark_index() will work
DBUG_ASSERT(table->read_set == &table->def_read_set);
DBUG_ASSERT(table->write_set == &table->def_write_set);
MY_BITMAP *save_read_set= table->read_set;
MY_BITMAP *save_write_set= table->write_set;
if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
table->add_read_columns_used_by_index(used_index);
......@@ -622,11 +620,8 @@ int mysql_update(THD *thd,
if (error >= 0)
goto err;
}
/*
This restore bitmaps, works for add_read_columns_used_by_index() and
use_all_columns():
*/
table->restore_column_maps_after_mark_index();
table->disable_keyread();
table->column_bitmaps_set(save_read_set, save_write_set);
}
if (ignore)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment