summaryrefslogtreecommitdiff
path: root/storage/federatedx/ha_federatedx.cc
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/federatedx/ha_federatedx.cc
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/federatedx/ha_federatedx.cc')
-rw-r--r--storage/federatedx/ha_federatedx.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 18756cff17c..9bf66d00f78 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -862,7 +862,7 @@ uint ha_federatedx::convert_row_to_internal_format(uchar *record,
ulong *lengths;
Field **field;
int column= 0;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
Time_zone *saved_time_zone= table->in_use->variables.time_zone;
DBUG_ENTER("ha_federatedx::convert_row_to_internal_format");
@@ -891,7 +891,7 @@ uint ha_federatedx::convert_row_to_internal_format(uchar *record,
(*field)->move_field_offset(-old_ptr);
}
table->in_use->variables.time_zone= saved_time_zone;
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(0);
}
@@ -1220,7 +1220,6 @@ bool ha_federatedx::create_where_from_key(String *to,
String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info);
const key_range *ranges[2]= { start_key, end_key };
Time_zone *saved_time_zone= table->in_use->variables.time_zone;
- my_bitmap_map *old_map;
DBUG_ENTER("ha_federatedx::create_where_from_key");
tmp.length(0);
@@ -1228,7 +1227,7 @@ bool ha_federatedx::create_where_from_key(String *to,
DBUG_RETURN(1);
table->in_use->variables.time_zone= UTC;
- old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
for (uint i= 0; i <= 1; i++)
{
bool needs_quotes;
@@ -1404,7 +1403,7 @@ prepare_for_next_key_part:
tmp.c_ptr_quick()));
}
}
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
table->in_use->variables.time_zone= saved_time_zone;
if (both_not_null)
@@ -1420,7 +1419,7 @@ prepare_for_next_key_part:
DBUG_RETURN(0);
err:
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
table->in_use->variables.time_zone= saved_time_zone;
DBUG_RETURN(1);
}
@@ -1995,7 +1994,7 @@ int ha_federatedx::write_row(uchar *buf)
sizeof(insert_field_value_buffer),
&my_charset_bin);
Time_zone *saved_time_zone= table->in_use->variables.time_zone;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->read_set);
DBUG_ENTER("ha_federatedx::write_row");
table->in_use->variables.time_zone= UTC;
@@ -2050,7 +2049,7 @@ int ha_federatedx::write_row(uchar *buf)
values_string.append(STRING_WITH_LEN(", "));
}
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
table->in_use->variables.time_zone= saved_time_zone;
/*
@@ -2375,7 +2374,7 @@ int ha_federatedx::update_row(const uchar *old_data, const uchar *new_data)
else
{
/* otherwise = */
- my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= tmp_use_all_columns(table, &table->read_set);
bool needs_quote= (*field)->str_needs_quotes();
(*field)->val_str(&field_value);
if (needs_quote)
@@ -2384,7 +2383,7 @@ int ha_federatedx::update_row(const uchar *old_data, const uchar *new_data)
if (needs_quote)
update_string.append(value_quote_char);
field_value.length(0);
- tmp_restore_column_map(table->read_set, old_map);
+ tmp_restore_column_map(&table->read_set, old_map);
}
update_string.append(STRING_WITH_LEN(", "));
}