summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2020-12-29 13:38:16 +1000
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-01-27 00:50:55 +1000
commit21809f9a450df1bc44cef36377f96b516ac4a9ae (patch)
tree0a41aaf587677a1f5319c02ab9e6cec5b1e1f397 /storage/perfschema
parentc207f04eccf2a1f35e6bac2b8146f6c5e0643857 (diff)
downloadmariadb-git-21809f9a450df1bc44cef36377f96b516ac4a9ae.tar.gz
MDEV-17556 Assertion `bitmap_is_set_all(&table->s->all_set)' failed
The assertion failed in handler::ha_reset upon SELECT under READ UNCOMMITTED from table with index on virtual column. This was the debug-only failure, though the problem is mush wider: * MY_BITMAP is a structure containing my_bitmap_map, the latter is a raw bitmap. * read_set, write_set and vcol_set of TABLE are the pointers to MY_BITMAP * The rest of MY_BITMAPs are stored in TABLE and TABLE_SHARE * The pointers to the stored MY_BITMAPs, like orig_read_set etc, and sometimes all_set and tmp_set, are assigned to the pointers. * Sometimes tmp_use_all_columns is used to substitute the raw bitmap directly with all_set.bitmap * Sometimes even bitmaps are directly modified, like in TABLE::update_virtual_field(): bitmap_clear_all(&tmp_set) is called. The last three bullets in the list, when used together (which is mostly always) make the program flow cumbersome and impossible to follow, notwithstanding the errors they cause, like this MDEV-17556, where tmp_set pointer was assigned to read_set, write_set and vcol_set, then its bitmap was substituted with all_set.bitmap by dbug_tmp_use_all_columns() call, and then bitmap_clear_all(&tmp_set) was applied to all this. To untangle this knot, the rule should be applied: * Never substitute bitmaps! This patch is about this. orig_*, all_set bitmaps are never substituted already. This patch changes the following function prototypes: * tmp_use_all_columns, dbug_tmp_use_all_columns to accept MY_BITMAP** and to return MY_BITMAP * instead of my_bitmap_map* * tmp_restore_column_map, dbug_tmp_restore_column_maps to accept MY_BITMAP* instead of my_bitmap_map* These functions now will substitute read_set/write_set/vcol_set directly, and won't touch underlying bitmaps.
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/pfs_engine_table.cc23
1 files changed, 8 insertions, 15 deletions
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 08ad7d31c88..46937d00ecf 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -188,17 +188,15 @@ ha_rows PFS_engine_table_share::get_row_count(void) const
int PFS_engine_table_share::write_row(TABLE *table, unsigned char *buf,
Field **fields) const
{
- my_bitmap_map *org_bitmap;
-
if (m_write_row == NULL)
{
return HA_ERR_WRONG_COMMAND;
}
/* We internally read from Fields to support the write interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
int result= m_write_row(table, buf, fields);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return result;
}
@@ -256,7 +254,6 @@ int PFS_engine_table::read_row(TABLE *table,
unsigned char *buf,
Field **fields)
{
- my_bitmap_map *org_bitmap;
Field *f;
Field **fields_reset;
@@ -264,7 +261,7 @@ int PFS_engine_table::read_row(TABLE *table,
bool read_all= !bitmap_is_clear_all(table->write_set);
/* We internally write to Fields to support the read interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->write_set);
/*
Some callers of the storage engine interface do not honor the
@@ -276,7 +273,7 @@ int PFS_engine_table::read_row(TABLE *table,
f->reset();
int result= read_row_values(table, buf, fields, read_all);
- dbug_tmp_restore_column_map(table->write_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->write_set, org_bitmap);
return result;
}
@@ -294,12 +291,10 @@ int PFS_engine_table::update_row(TABLE *table,
const unsigned char *new_buf,
Field **fields)
{
- my_bitmap_map *org_bitmap;
-
/* We internally read from Fields to support the write interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
int result= update_row_values(table, old_buf, new_buf, fields);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return result;
}
@@ -308,12 +303,10 @@ int PFS_engine_table::delete_row(TABLE *table,
const unsigned char *buf,
Field **fields)
{
- my_bitmap_map *org_bitmap;
-
/* We internally read from Fields to support the delete interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
int result= delete_row_values(table, buf, fields);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return result;
}