From 3d9b350a9cab7faaf718313c197ff868c4af3c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Oct 2022 11:00:34 +0300 Subject: Fix clang -Wunused-but-set-variable --- storage/innobase/data/data0data.cc | 8 +++----- storage/innobase/gis/gis0rtree.cc | 6 +++--- storage/innobase/include/ut0lst.h | 31 +++++++++++++------------------ 3 files changed, 19 insertions(+), 26 deletions(-) (limited to 'storage/innobase') diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index 3e23cd6f662..885f79d1239 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -575,7 +575,6 @@ dtuple_convert_big_rec( dfield_t* dfield; dict_field_t* ifield; ulint size; - ulint n_fields; ulint local_prefix_len; if (!dict_index_is_clust(index)) { @@ -604,7 +603,7 @@ dtuple_convert_big_rec( a variable-length field that yields the biggest savings when stored externally */ - n_fields = 0; + ut_d(ulint n_fields = 0); while (page_zip_rec_needs_ext(rec_get_converted_size(index, entry, *n_ext), @@ -700,9 +699,8 @@ skip_field: dfield_set_data(dfield, data, local_len); dfield_set_ext(dfield); - n_fields++; (*n_ext)++; - ut_ad(n_fields < dtuple_get_n_fields(entry)); + ut_ad(++n_fields < dtuple_get_n_fields(entry)); if (upd && !upd->is_modified(longest_i)) { diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index bbcf36b74fe..350d1689977 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -998,7 +998,7 @@ rtr_page_split_and_insert( lock_prdt_t new_prdt; rec_t* first_rec = NULL; int first_rec_group = 1; - ulint n_iterations = 0; + IF_DBUG(bool iterated = false,); if (!*heap) { *heap = mem_heap_create(1024); @@ -1207,7 +1207,7 @@ func_start: the page, and it'll need the second round split in this case. We test this scenario here*/ DBUG_EXECUTE_IF("rtr_page_need_second_split", - if (n_iterations == 0) { + if (!iterated) { rec = NULL; goto after_insert; } ); @@ -1272,7 +1272,7 @@ after_insert: parent. */ rtr_clean_rtr_info(cursor->rtr_info, true); cursor->rtr_info = NULL; - n_iterations++; + IF_DBUG(iterated=true,); rec_t* i_rec = page_rec_get_next(page_get_infimum_rec( buf_block_get_frame(block))); diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h index 9a5f3059826..fb15d6276f8 100644 --- a/storage/innobase/include/ut0lst.h +++ b/storage/innobase/include/ut0lst.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, MariaDB Corporation. +Copyright (c) 2019, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -25,8 +25,7 @@ Created 9/10/1995 Heikki Tuuri Rewritten by Sunny Bains Dec 2011. ***********************************************************************/ -#ifndef ut0lst_h -#define ut0lst_h +#pragma once /* Do not include univ.i because univ.i includes this. */ @@ -474,17 +473,17 @@ template void ut_list_validate(const List& list, Functor& functor) { ut_list_map(list, functor); - +#ifdef UNIV_DEBUG /* Validate the list backwards. */ - ulint count = 0; + auto count = list.count; for (typename List::elem_type* elem = list.end; elem != 0; elem = (elem->*list.node).prev) { - ++count; + --count; } - - ut_a(count == list.count); + ut_ad(!count); +#endif } /** Check the consistency of a doubly linked list. @@ -494,23 +493,24 @@ template inline void ut_list_validate(const List& list, const Functor& functor) { ut_list_map(list, functor); - +#ifdef UNIV_DEBUG /* Validate the list backwards. */ - ulint count = 0; + auto count = list.count; for (typename List::elem_type* elem = list.end; elem != 0; elem = (elem->*list.node).prev) { - ++count; + --count; } - ut_a(count == list.count); + ut_ad(!count); +#endif } template inline void ut_list_validate(const List& list) { - ut_list_validate(list, NullValidate()); + ut_d(ut_list_validate(list, NullValidate())); } #ifdef UNIV_DEBUG @@ -561,8 +561,3 @@ ut_list_move_to_front( ut_list_prepend(list, elem); } } - -#ifdef UNIV_DEBUG -#endif - -#endif /* ut0lst.h */ -- cgit v1.2.1 From 78030b67b9cbc7b2c29f1d7aeaf3b9942bf94bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Oct 2022 11:54:05 +0300 Subject: Do not use C++11 before MariaDB 10.4 This fixes up 3d9b350a9cab7faaf718313c197ff868c4af3c6a --- storage/innobase/include/ut0lst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'storage/innobase') diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h index fb15d6276f8..7b7ed7b8e80 100644 --- a/storage/innobase/include/ut0lst.h +++ b/storage/innobase/include/ut0lst.h @@ -475,7 +475,7 @@ void ut_list_validate(const List& list, Functor& functor) ut_list_map(list, functor); #ifdef UNIV_DEBUG /* Validate the list backwards. */ - auto count = list.count; + ulint count = list.count; for (typename List::elem_type* elem = list.end; elem != 0; @@ -495,7 +495,7 @@ inline void ut_list_validate(const List& list, const Functor& functor) ut_list_map(list, functor); #ifdef UNIV_DEBUG /* Validate the list backwards. */ - auto count = list.count; + ulint count = list.count; for (typename List::elem_type* elem = list.end; elem != 0; -- cgit v1.2.1 From e1414fc7e38e561dba74ed8bf694828d1277b714 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 20 Oct 2022 08:29:56 +0530 Subject: MDEV-29778 Having Unique index interference with MATCH from a FULLTEXT InnoDB fails to fetch FTS_DOC_ID if the select query uses secondary index. So always do extra lookup on clustered index in case of fts query --- storage/innobase/handler/ha_innodb.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'storage/innobase') diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 0fe60ccabe6..cd2d36df112 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7703,6 +7703,11 @@ ha_innobase::build_template( m_prebuilt->versioned_write = table->versioned_write(VERS_TRX_ID); m_prebuilt->need_to_access_clustered = (index == clust_index); + if (m_prebuilt->in_fts_query) { + /* Do clustered index lookup to fetch the FTS_DOC_ID */ + m_prebuilt->need_to_access_clustered = true; + } + /* Either m_prebuilt->index should be a secondary index, or it should be the clustered index. */ ut_ad(dict_index_is_clust(index) == (index == clust_index)); -- cgit v1.2.1