From a4effbf90f36f792e49b9c3b51f75d4c022513d1 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 8 Aug 2024 13:11:25 +0200 Subject: [PATCH] Fix of MDEV-33856, becaouse we have more then 64 fields and unsigned long long can not be used as bitfield. --- sql/sql_show.cc | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 73df0d6bf78..d4490d925fa 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9112,27 +9112,16 @@ static int make_slave_status_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table) Name_resolution_context *context= &thd->lex->first_select_lex()->context; DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_SLAVE_STAT); bool all_slaves= thd->lex->mi.show_all_slaves; - ulonglong used_fields= ~0ULL; - - if (!all_slaves) - { - /* - Remove 2 first fields (Connection_name and Slave_SQL_State) and all - fields above and including field 56 (Retried_transactions) - */ - used_fields&= ~((1ULL << SLAVE_STATUS_COL_CONNECTION_NAME) | - (1ULL << SLAVE_STATUS_COL_SLAVE_SQL_STATE)); - used_fields&= ((1ULL << SLAVE_STATUS_COL_RETRIED_TRANSACTIONS) - 1); - } for (uint i=0; !field_info->end_marker(); field_info++, i++) { - /* - We have all_slaves here to take into account that we some day may have - more than 64 fields in the list. If all_slaves is set we should show - all fields. - */ - if (all_slaves || (used_fields & ((1ULL << i)))) + if (all_slaves || + // not SLAVE_STATUS_COL_CONNECTION_NAME, + // SLAVE_STATUS_COL_SLAVE_SQL_STATE + // and less + // SLAVE_STATUS_COL_RETRIED_TRANSACTIONS + !(i <= SLAVE_STATUS_COL_SLAVE_SQL_STATE || + i >= SLAVE_STATUS_COL_RETRIED_TRANSACTIONS)) { LEX_CSTRING field_name= field_info->name(); Item_field *field= new (thd->mem_root)