summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-01-16 23:10:53 +0100
committerSergei Golubchik <serg@mariadb.org>2018-01-16 23:31:29 +0100
commitb80fa4000d6aa4b8f952049523d4fffb7e1e5438 (patch)
tree5b003fac5480de29a7b947bb8718bc17f6ec407a /storage
parent444587d8a3c4b91421cd4cfd7bda2e3f4d1aebe4 (diff)
downloadmariadb-git-b80fa4000d6aa4b8f952049523d4fffb7e1e5438.tar.gz
bug: ha_heap was unilaterally increasing reclength
MEMORY engine needs the record length to be at least sizeof(void*), because it stores a pointer there (linking deleted records into a list). So when the reclength is less than sizeof(void*), it's set to sizeof(void*). That is done inside heap_create(), and the upper layer doesn't know that the engine writes beyond share->reclength. While it's usually safe (in-memory record size is rounded up to sizeof(double), so even if share->reclength is too small, share->rec_buff_len is not), it could cause problems in the code that copies records and expects them to fix in share->reclength, e.g. in partitioning.
Diffstat (limited to 'storage')
-rw-r--r--storage/heap/ha_heap.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index ec219c1590d..345ebb8419f 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -100,6 +100,7 @@ const char **ha_heap::bas_ext() const
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
+ set_if_bigger(table->s->reclength, sizeof (uchar*));
internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);
if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT))
{