| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2016, 2026, Oracle and/or its affiliates. |
| 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, version 2.0, as published by the |
| 7 | Free Software Foundation. |
| 8 | |
| 9 | This program is designed to work with certain software (including |
| 10 | but not limited to OpenSSL) that is licensed under separate terms, |
| 11 | as designated in a particular file or component or in included license |
| 12 | documentation. The authors of MySQL hereby grant you an additional |
| 13 | permission to link the program and your derivative works with the |
| 14 | separately licensed software that they have either included with |
| 15 | the program or referenced in the documentation. |
| 16 | |
| 17 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 | FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 | for more details. |
| 21 | |
| 22 | You should have received a copy of the GNU General Public License along with |
| 23 | this program; if not, write to the Free Software Foundation, Inc., |
| 24 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 | |
| 26 | *****************************************************************************/ |
| 27 | |
| 28 | #include <ostream> |
| 29 | #include "lot0types.h" |
| 30 | |
| 31 | struct lob_tester_t { |
| 32 | void print_info(); |
| 33 | |
| 34 | /** Insert 10MB of data and fetch it. This LOB will have the FIRST page, |
| 35 | more than one DATA page and also more than one INDEX page. This test case |
| 36 | assumes a page size of 16K. */ |
| 37 | void fetch_full(); |
| 38 | |
| 39 | /** An LOB that will have one FIRST page and one DATA page. Do an |
| 40 | insert_middle() on the second page, which doesn't spill on other pages. This |
| 41 | is done by same transaction. This test case assumes a page size of 16K. */ |
| 42 | void test_4(); |
| 43 | |
| 44 | /** An LOB that will have only one FIRST page. Do remove_middle() on the |
| 45 | first page, which doesn't spill on other pages. This test case assumes a |
| 46 | page size of 16K. */ |
| 47 | void remove_middle_1(); |
| 48 | |
| 49 | /** A generic remove_middle() tester. */ |
| 50 | void remove_middle_gen(ulint lob_size, ulint offset, ulint rm_len); |
| 51 | |
| 52 | /** A generic replace() tester. */ |
| 53 | void replace_generic(ulint lob_size, ulint offset, ulint replace_len); |
| 54 | |
| 55 | /** A stress tester for insert_middle(). Fixed insert length, with |
| 56 | a variable offset. */ |
| 57 | void insert_middle_stress(); |
| 58 | |
| 59 | /** A generic insert_middle() tester. |
| 60 | @param[in] lob_size the size of the LOB. |
| 61 | @param[in] offset The offset into LOB where new data inserted. |
| 62 | @param[in] len The length of new data inserted.*/ |
| 63 | void insert_middle_generic(ulint lob_size, ulint offset, ulint len); |
| 64 | |
| 65 | /** A stress test for replace. */ |
| 66 | void replace_stress(); |
| 67 | |
| 68 | /** A stress tester for remove_middle(). Fixed removal length, with |
| 69 | a variable offset. */ |
| 70 | void remove_middle_stress_1(); |
| 71 | |
| 72 | /** Insert an LOB and then do rollback of the transaction. */ |
| 73 | void insert_rollback(); |
| 74 | |
| 75 | ulint get_page_size() const { return (UNIV_PAGE_SIZE); } |
| 76 | |
| 77 | static std::ostream &print_lob(std::ostream &out, byte *lob, ulint size) { |
| 78 | for (ulint i = 0; i < size; ++i) { |
| 79 | out << lob[i]; |
| 80 | } |
| 81 | out << std::endl; |
| 82 | return (out); |
| 83 | } |
| 84 | }; |