Skip to content

Commit 0a45e25

Browse files
committed
MDEV-40740: Optimizer Context Replay: innodb.xa_unlock_unmodified fails assert
Optimizer Context code changed format_and_store_row() to check both table->read_set and table->write_set (when required). It used to use one of those depending on the lock level. But we don't set the table->read_set bit so we can get an assertion failure when dumping the column value. This is fairly rare as Optimizer Context now reads all columns, and the only other user is statements like "DBUG_PRINT("dml", dbug_format_row(..."
1 parent 9dfe5b4 commit 0a45e25

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

sql/filesort.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3104,11 +3104,19 @@ void format_and_store_row(TABLE *table, const uchar *rec, bool print_names,
31043104
bool require_quote= false;
31053105

31063106
bool print_col= false;
3107-
if ((check_also_write_set &&
3108-
bitmap_is_set(table->write_set, field->field_index)) ||
3109-
(table->read_set &&
3110-
bitmap_is_set(table->read_set, field->field_index)))
3107+
bool clear_read_bit= false;
3108+
if (table->read_set && bitmap_is_set(table->read_set, field->field_index))
31113109
print_col= true;
3110+
else
3111+
{
3112+
if ((check_also_write_set && bitmap_is_set(table->write_set,
3113+
field->field_index)))
3114+
{
3115+
print_col= true;
3116+
bitmap_set_bit(table->read_set, field->field_index);
3117+
clear_read_bit= true;
3118+
}
3119+
}
31123120
if (!print_col)
31133121
continue;
31143122

@@ -3149,6 +3157,8 @@ void format_and_store_row(TABLE *table, const uchar *rec, bool print_names,
31493157
}
31503158
field->val_str(&tmp);
31513159
}
3160+
if (clear_read_bit)
3161+
bitmap_clear_bit(table->read_set, field->field_index);
31523162
/*
31533163
Emit non-empty values as a hex literal whenever converting field's
31543164
charset to the output charset conversion is lossy; otherwise emit the

0 commit comments

Comments
 (0)