summaryrefslogtreecommitdiff
path: root/storage/spider
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2020-12-29 13:38:16 +1000
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-01-08 16:04:29 +1000
commite25623e78a3efde05e30070dc7362f8dc0d8c459 (patch)
treeac2c76ed505f669fc8fef07bb6caf1631d0059ff /storage/spider
parentf319c4265f0ae18e2703adaff951a6a6c87bcace (diff)
downloadmariadb-git-e25623e78a3efde05e30070dc7362f8dc0d8c459.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/spider')
-rw-r--r--storage/spider/ha_spider.cc12
-rw-r--r--storage/spider/spd_db_conn.cc48
-rw-r--r--storage/spider/spd_db_mysql.cc17
3 files changed, 38 insertions, 39 deletions
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 5e7b5a1e8ce..6dbc34706da 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -9737,12 +9737,12 @@ int ha_spider::write_row(
if (!table->auto_increment_field_not_null)
{
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
table->next_number_field->store((longlong) 0, TRUE);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
force_auto_increment = FALSE;
table->file->insert_id_for_cur_row = 0;
@@ -9750,13 +9750,13 @@ int ha_spider::write_row(
} else if (auto_increment_mode == 2)
{
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
table->next_number_field->store((longlong) 0, TRUE);
table->auto_increment_field_not_null = FALSE;
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
force_auto_increment = FALSE;
table->file->insert_id_for_cur_row = 0;
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index f77603d0d3a..8d4e9acda07 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -1624,7 +1624,7 @@ int spider_db_append_key_where_internal(
DBUG_PRINT("info", ("spider end_key_part_map=%lu", end_key_part_map));
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *tmp_map = dbug_tmp_use_all_columns(table, &table->read_set);
#endif
if (sql_kind == SPIDER_SQL_KIND_HANDLER)
@@ -2427,7 +2427,7 @@ end:
if (sql_kind == SPIDER_SQL_KIND_SQL)
dbton_hdl->set_order_pos(sql_type);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
DBUG_RETURN(0);
}
@@ -2928,15 +2928,15 @@ int spider_db_fetch_table(
bitmap_is_set(table->write_set, (*field)->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num =
spider_db_fetch_row(share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -3099,15 +3099,15 @@ int spider_db_fetch_key(
bitmap_is_set(table->write_set, field->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name));
if ((error_num =
spider_db_fetch_row(share, field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -3213,14 +3213,14 @@ int spider_db_fetch_minimum_columns(
bitmap_is_set(table->write_set, (*field)->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num = spider_db_fetch_row(share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -5128,15 +5128,15 @@ int spider_db_seek_tmp_table(
bitmap_is_set(table->write_set, (*field)->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num =
spider_db_fetch_row(spider->share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -5215,15 +5215,15 @@ int spider_db_seek_tmp_key(
bitmap_is_set(table->write_set, field->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name));
if ((error_num =
spider_db_fetch_row(spider->share, field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -5305,8 +5305,8 @@ int spider_db_seek_tmp_minimum_columns(
bitmap_is_set(table->write_set, (*field)->field_index)));
*/
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num =
@@ -5314,7 +5314,7 @@ int spider_db_seek_tmp_minimum_columns(
DBUG_RETURN(error_num);
row->next();
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
else if (bitmap_is_set(table->read_set, (*field)->field_index))
@@ -8680,8 +8680,8 @@ int spider_db_udf_fetch_table(
DBUG_RETURN(HA_ERR_END_OF_FILE);
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
for (
roop_count = 0,
@@ -8694,7 +8694,7 @@ int spider_db_udf_fetch_table(
spider_db_udf_fetch_row(trx, *field, row)))
{
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
DBUG_RETURN(error_num);
}
@@ -8704,7 +8704,7 @@ int spider_db_udf_fetch_table(
for (; roop_count < set_off; roop_count++, field++)
(*field)->set_default();
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
table->status = 0;
DBUG_RETURN(0);
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index 9ed29d015b3..1a24d80a95f 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -6528,8 +6528,7 @@ int spider_mysql_handler::append_update_set(
mysql_share->append_column_name(str, (*fields)->field_index);
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table,
- table->read_set);
+ MY_BITMAP *tmp_map = dbug_tmp_use_all_columns(table, &table->read_set);
#endif
if (
spider_db_mysql_utility.
@@ -6538,12 +6537,12 @@ int spider_mysql_handler::append_update_set(
str->reserve(SPIDER_SQL_COMMA_LEN)
) {
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
}
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
@@ -9172,8 +9171,8 @@ int spider_mysql_handler::append_insert_values(
bitmap_is_set(table->read_set, (*field)->field_index)
) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->read_set);
#endif
add_value = TRUE;
DBUG_PRINT("info",("spider is_null()=%s",
@@ -9195,7 +9194,7 @@ int spider_mysql_handler::append_insert_values(
if (str->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN))
{
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
str->length(0);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -9209,7 +9208,7 @@ int spider_mysql_handler::append_insert_values(
str->reserve(SPIDER_SQL_COMMA_LEN)
) {
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
str->length(0);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -9217,7 +9216,7 @@ int spider_mysql_handler::append_insert_values(
}
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
}
}