From 98e2c17e9e20898bc8c1e58c57e0666502ec447e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 16 Jul 2020 16:31:23 +0300 Subject: [PATCH] Cleanup: Remove fil_check_adress_in_tablespace() --- storage/innobase/buf/buf0dblwr.cc | 14 ++++++++++---- storage/innobase/fil/fil0fil.cc | 21 +-------------------- storage/innobase/include/fil0fil.h | 12 +----------- storage/xtradb/buf/buf0dblwr.cc | 14 ++++++++++---- storage/xtradb/fil/fil0fil.cc | 21 +-------------------- storage/xtradb/include/fil0fil.h | 12 +----------- 6 files changed, 24 insertions(+), 70 deletions(-) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 32b4399b41d..8afed48b8c1 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -554,12 +554,18 @@ buf_dblwr_process() continue; } - if (!fil_check_adress_in_tablespace(space_id, page_no)) { + if (!space()->size) { + fil_space_get_size(space_id); + } + + if (UNIV_UNLIKELY(space()->size <= page_no)) { ib_logf(IB_LOG_LEVEL_WARN, - "A copy of page " ULINTPF ":" ULINTPF + "A copy of page " ULINTPF " in the doublewrite buffer slot " ULINTPF - " is not within space bounds", - space_id, page_no, page_no_dblwr); + " is beyond the end of the tablespace " + " %s (" ULINTPF " pages)", + page_no, page_no_dblwr, + space()->name, space()->size); continue; } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 7234a6c4102..ac48db75624 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, 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 @@ -1775,25 +1775,6 @@ fil_space_get_zip_size( return(flags); } -/*******************************************************************//** -Checks if the pair space, page_no refers to an existing page in a tablespace -file space. The tablespace must be cached in the memory cache. -@return TRUE if the address is meaningful */ -UNIV_INTERN -ibool -fil_check_adress_in_tablespace( -/*===========================*/ - ulint id, /*!< in: space id */ - ulint page_no)/*!< in: page number */ -{ - if (fil_space_get_size(id) > page_no) { - - return(TRUE); - } - - return(FALSE); -} - /****************************************************************//** Initializes the tablespace memory cache. */ UNIV_INTERN diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 4bd394ff94d..448532e249b 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, 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 @@ -568,16 +568,6 @@ ulint fil_space_get_zip_size( /*===================*/ ulint id); /*!< in: space id */ -/*******************************************************************//** -Checks if the pair space, page_no refers to an existing page in a tablespace -file space. The tablespace must be cached in the memory cache. -@return TRUE if the address is meaningful */ -UNIV_INTERN -ibool -fil_check_adress_in_tablespace( -/*===========================*/ - ulint id, /*!< in: space id */ - ulint page_no);/*!< in: page number */ /****************************************************************//** Initializes the tablespace memory cache. */ UNIV_INTERN diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc index 5df40b5f4e8..776e5ab06a2 100644 --- a/storage/xtradb/buf/buf0dblwr.cc +++ b/storage/xtradb/buf/buf0dblwr.cc @@ -554,12 +554,18 @@ buf_dblwr_process() continue; } - if (!fil_check_adress_in_tablespace(space_id, page_no)) { + if (!space()->size) { + fil_space_get_size(space_id); + } + + if (UNIV_UNLIKELY(space()->size <= page_no)) { ib_logf(IB_LOG_LEVEL_WARN, - "A copy of page " ULINTPF ":" ULINTPF + "A copy of page " ULINTPF " in the doublewrite buffer slot " ULINTPF - " is not within space bounds", - space_id, page_no, page_no_dblwr); + " is beyond the end of the tablespace " + " %s (" ULINTPF " pages)", + page_no, page_no_dblwr, + space()->name, space()->size); continue; } diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 766e9d91cfb..3c00c857a6d 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, 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 @@ -1815,25 +1815,6 @@ fil_space_get_zip_size( return(flags); } -/*******************************************************************//** -Checks if the pair space, page_no refers to an existing page in a tablespace -file space. The tablespace must be cached in the memory cache. -@return TRUE if the address is meaningful */ -UNIV_INTERN -ibool -fil_check_adress_in_tablespace( -/*===========================*/ - ulint id, /*!< in: space id */ - ulint page_no)/*!< in: page number */ -{ - if (fil_space_get_size(id) > page_no) { - - return(TRUE); - } - - return(FALSE); -} - /****************************************************************//** Initializes the tablespace memory cache. */ UNIV_INTERN diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index a4274f4d8a6..8831ea2e8cd 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, 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 @@ -574,16 +574,6 @@ ulint fil_space_get_zip_size( /*===================*/ ulint id); /*!< in: space id */ -/*******************************************************************//** -Checks if the pair space, page_no refers to an existing page in a tablespace -file space. The tablespace must be cached in the memory cache. -@return TRUE if the address is meaningful */ -UNIV_INTERN -ibool -fil_check_adress_in_tablespace( -/*===========================*/ - ulint id, /*!< in: space id */ - ulint page_no);/*!< in: page number */ /****************************************************************//** Initializes the tablespace memory cache. */ UNIV_INTERN