| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2023, MariaDB Corporation. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it under |
| 6 | the terms of the GNU General Public License as published by the Free Software |
| 7 | Foundation; version 2 of the License. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License along with |
| 14 | this program; if not, write to the Free Software Foundation, Inc., |
| 15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 16 | |
| 17 | *****************************************************************************/ |
| 18 | |
| 19 | #include "db0err.h"cxx . . $ `<file>/storage/innobase/include/db0err.h`/ |
| 20 | |
| 21 | /* The purpose of the change buffer was to reduce random disk access. |
| 22 | When we wished to |
| 23 | (1) insert a record into a non-unique secondary index, |
| 24 | (2) delete-mark a secondary index record, |
| 25 | (3) delete a secondary index record as part of purge (but not ROLLBACK), |
| 26 | and the B-tree leaf page where the record belongs to is not in the buffer |
| 27 | pool, we inserted a record into the change buffer B-tree, indexed by |
| 28 | the page identifier. When the page was eventually read into the buffer |
| 29 | pool, we looked up the change buffer B-tree for any modifications to the |
| 30 | page, applied these upon the completion of the read operation. This |
| 31 | was called the insert buffer merge. |
| 32 | |
| 33 | There was a hash index of the change buffer B-tree, implemented as the |
| 34 | "change buffer bitmap". Bits in these bitmap pages indicated how full |
| 35 | the page roughly was, and whether any records for the page identifier |
| 36 | exist in the change buffer. The "free" bits had to be updated as part of |
| 37 | operations that modified secondary index leaf pages. |
| 38 | |
| 39 | Because the change buffer has been removed, we will no longer update |
| 40 | any change buffer bitmap pages. Instead, on database startup, we will |
| 41 | check if an upgrade needs to be performed, and apply any buffered |
| 42 | changes if that is the case. Finally, the change buffer will be |
| 43 | transformed to a format that will not be recognized by earlier |
| 44 | versions of MariaDB Server, to prevent downgrades from causing |
| 45 | corruption (due to the removed updates of the bitmap pages) when the |
| 46 | change buffer might be enabled. */ |
| 47 | |
| 48 | /** Check if ibuf_upgrade() is needed as part of server startup. |
| 49 | @return error code |
| 50 | @retval DB_SUCCESS if no upgrade is needed |
| 51 | @retval DB_FAIL if the change buffer is not empty (need ibuf_upgrade()) */ |
| 52 | dberr_tcxx . . $ dberr_t# ibuf_upgrade_neededcxx . . $ ibuf_upgrade_needed(629d9d73bf1a44e9).(); |
| 53 | |
| 54 | /** Upgrade the change buffer after all redo log has been applied. */ |
| 55 | dberr_tcxx . . $ dberr_t# ibuf_upgradecxx . . $ ibuf_upgrade(629d9d73bf1a44e9).(); |