diff options
Diffstat (limited to 'storage/maria/ha_maria.cc')
-rw-r--r-- | storage/maria/ha_maria.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index ba8bb654a7d..d1237bba8f3 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -28,6 +28,7 @@ #include "maria_def.h" #include "ma_rt_index.h" +#include "ma_blockrec.h" ulong maria_recover_options= HA_RECOVER_NONE; @@ -108,7 +109,6 @@ static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type, } - /* Convert TABLE object to Maria key and column definition @@ -512,6 +512,26 @@ double ha_maria::scan_time() return handler::scan_time(); } +/* + We need to be able to store at least two keys on an index page as the + splitting algorithms depends on this. (With only one key on a page + we also can't use any compression, which may make the index file much + larger) + We use HA_MAX_KEY_BUFF as this is a stack restriction imposed by the + handler interface. + + We also need to reserve place for a record pointer (8) and 3 bytes + per key segment to store the length of the segment + possible null bytes. + These extra bytes are required here so that maria_create() will surely + accept any keys created which the returned key data storage length. +*/ + +uint ha_maria::max_supported_key_length() const +{ + uint tmp= (maria_max_key_length() - 8 - HA_MAX_KEY_SEG*3); + return min(HA_MAX_KEY_BUFF, tmp); +} + #ifdef HAVE_REPLICATION int ha_maria::net_read_dump(NET * net) |