From 3c92050d1c907cc548e848d0ab2891a06681ad92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 23 Sep 2022 17:37:52 +0300 Subject: Fix build without either ENABLED_DEBUG_SYNC or DBUG_OFF There are separate flags DBUG_OFF for disabling the DBUG facility and ENABLED_DEBUG_SYNC for enabling the DEBUG_SYNC facility. Let us allow debug builds without DEBUG_SYNC. Note: For CMAKE_BUILD_TYPE=Debug, CMakeLists.txt will continue to define ENABLED_DEBUG_SYNC. --- sql/sql_table.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a5fa36ffde6..f29fecd2744 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2115,10 +2115,12 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists, } } +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("ib_purge_virtual_mdev_16222_1", DBUG_ASSERT(!debug_sync_set_action( thd, STRING_WITH_LEN("now SIGNAL drop_started")));); +#endif /* mark for close and remove all cached entries */ thd->push_internal_handler(&err_handler); @@ -9654,7 +9656,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, DEBUG_SYNC(thd, "alter_opened_table"); -#ifdef WITH_WSREP +#if defined WITH_WSREP && defined ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.alter_opened_table", { const char act[]= -- cgit v1.2.1 From 1118e979c2ce7cbd05f4a33dbefcde63bb500b63 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 28 Sep 2022 18:49:09 +0400 Subject: MDEV-29672 Add MTR tests covering key and key segment flags and types --- sql/sql_table.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f29fecd2744..ceef0b84487 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -58,6 +58,7 @@ #ifdef WITH_WSREP #include "wsrep_mysqld.h" #endif +#include "sql_debug.h" #ifdef __WIN__ #include @@ -4458,6 +4459,13 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, thd->mem_root)) DBUG_RETURN(TRUE); +#ifndef DBUG_OFF + DBUG_EXECUTE_IF("key", + Debug_key::print_keys(thd, "prep_create_table: ", + *key_info_buffer, *key_count); + ); +#endif + DBUG_RETURN(FALSE); } -- cgit v1.2.1 From 3744b8ae3171fd423f89c64a83d3afc7e3722856 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Sat, 5 Oct 2019 18:16:37 +0400 Subject: MDEV-20760 Add Type_handler::KEY_pack_flags() Backporting from 10.5 to 10.4 This is needed to fix MDEV-28727 easier. --- sql/sql_table.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ceef0b84487..2436031200a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4143,16 +4143,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, /* Use packed keys for long strings on the first column */ if (!((*db_options) & HA_OPTION_NO_PACK_KEYS) && !((create_info->table_options & HA_OPTION_NO_PACK_KEYS)) && - (key_part_length >= KEY_DEFAULT_PACK_LENGTH && - (sql_field->real_field_type() == MYSQL_TYPE_STRING || - sql_field->real_field_type() == MYSQL_TYPE_VARCHAR || - f_is_blob(sql_field->pack_flag))) && !is_hash_field_needed) - { - if ((column_nr == 0 && f_is_blob(sql_field->pack_flag)) || - sql_field->real_field_type() == MYSQL_TYPE_VARCHAR) - key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; - else - key_info->flags|= HA_PACK_KEY; + (key_part_length >= KEY_DEFAULT_PACK_LENGTH) && + !is_hash_field_needed) + { + key_info->flags|= sql_field->type_handler()->KEY_pack_flags(column_nr); } /* Check if the key segment is partial, set the key flag accordingly */ if (key_part_length != sql_field->key_length && -- cgit v1.2.1