summaryrefslogtreecommitdiff
path: root/mysys/my_bitmap.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-08-04 16:01:13 +0300
committerMichael Widenius <monty@askmonty.org>2010-08-04 16:01:13 +0300
commitcd9706b27ee113e0d448cb9c509fa9a4d553c5ee (patch)
treece0bac626c7b8d6339e735c8e8f1784d3e324da3 /mysys/my_bitmap.c
parent34e0c8f4c598e88a46eedea879e6a5b42b8606b5 (diff)
downloadmariadb-git-cd9706b27ee113e0d448cb9c509fa9a4d553c5ee.tar.gz
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.
Diffstat (limited to 'mysys/my_bitmap.c')
-rw-r--r--mysys/my_bitmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 137127a2fda..69e0ca18cb8 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -378,6 +378,24 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
}
}
+/* True if union of bitmaps have all bits set */
+
+my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
+
+ DBUG_ASSERT(map1->bitmap && map2->bitmap &&
+ map1->n_bits==map2->n_bits);
+ *map1->last_word_ptr|= map1->last_word_mask;
+
+ end= map1->last_word_ptr;
+ while ( m1 <= end)
+ if ((*m1++ | *m2++) != 0xFFFFFFFF)
+ return FALSE;
+ return TRUE;
+}
+
+
/*
Set/clear all bits above a bit.