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

MDEV-19235 MariaDB Server compiled for 128 Indexes crashes at startup

With MAX_INDEXIES=64(default), key_map=Bitmap<64> is just a wrapper around
ulonglong and thus "trivial" (can be bzero-ed, or memcpy-ed, and stays
valid still)

With MAX_INDEXES=128, key_map = Bitmap<128> is not a "trivial" type
anymore. The implementation uses MY_BITMAP, and MY_BITMAP contains pointers
which make Bitmap invalid, when it is memcpy-ed/bzero-ed.

The problem in 10.4 is that there are many new key_map members, inside TABLE
or KEY, and those are often memcopied and bzeroed

The fix makes Bitmap "trivial", by inlining most of MY_BITMAP functionality.
pointers/heap allocations are not used anymore.
This commit is contained in:
Vladislav Vaintroub
2019-05-09 17:38:22 +02:00
parent 44b8b002f5
commit ad36d38024
12 changed files with 339 additions and 246 deletions

View File

@ -29,14 +29,6 @@
#include <mysql_com.h> /* USERNAME_LENGTH */
#include "sql_bitmap.h"
#if MAX_INDEXES <= 64
typedef Bitmap<64> key_map; /* Used for finding keys */
#elif MAX_INDEXES > 128
#error "MAX_INDEXES values greater than 128 is not supported."
#else
typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
#endif
struct TABLE;
class Type_handler;
class Field;