1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixes bug when we run bcmp() on row when the storage engine hasn't filled in all fields in the row.

This was triggered by innodb.innodb_multi_update, where we had a static length row without nulls and xtradb didn't fill in the delete-marker byte


include/my_bitmap.h:
  Added prototype for bitmap_union_is_set_all()
mysys/my_bitmap.c:
  Added function to check if union of two bit maps covers all bits.
sql/mysql_priv.h:
  Updated protype for compare_record()
sql/sql_insert.cc:
  Send to compare_record() flag if all fields are used.
sql/sql_select.cc:
  Set share->null_bytes_for_compare.
sql/sql_update.cc:
  In compare_record() don't use the fast cmp_record() (which is basically memcmp) if we don't know that all fields exists.
  Don't compare the null_bytes if there is no data there.
sql/table.cc:
  Store in share->null_bytes_for_compare the number of bytes that has null or bit fields (but not delete marker)
  Store in can_cmp_whole_record if we can use memcmp() (assuming all rows are read) to compare rows in compare_record()
sql/table.h:
  Added two elements in table->share to speed up checking how updated rows can be compared.
This commit is contained in:
Michael Widenius
2010-08-04 16:01:13 +03:00
parent 34e0c8f4c5
commit cd9706b27e
8 changed files with 64 additions and 16 deletions

View File

@ -1509,9 +1509,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
info->touched++;
if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
if (((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) &&
!bitmap_is_subset(table->write_set, table->read_set)) ||
compare_record(table))
compare_record(table, bitmap_union_is_set_all(table->write_set,
table->read_set)))
{
if ((error=table->file->ha_update_row(table->record[1],
table->record[0])) &&