# Copyright (c) 2018, 2021 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 Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA # # Derivate of table_stress_innodb_nocopy.yy which # - focuses on DDL algorithm NOCOPY only # - avoids table rebuilds which would be caused by manipulating col1 # or TRUNCATE TABLE, ADD DROP PRIMARY KEY # - avoids BLOCK STAGE because of frequent trouble # The grammar is dedicated to stress tables with # - DDL direct or indirect # Examples: # ALTER TABLE test.t1 ADD COLUMN # DROP TABLE test.t1 # RENAME TABLE test.t1 TO new_test.t1 # DROP SCHEMA new_test (affects the tables stored within the schema) # DROP several tables at once # Perform more than change affecting the definition of a table # - DML trying to modify data and (combine with and/or) # - hitting frequent duplicate key or foreign key constraint violations # - being in some transaction which get intentional rolled back later # - DDL and DML being "attacked" by KILL QUERY and KILL # - DDL-DDL, DDL-DML, DML-DML locking conflicts caused by concurrency # as efficient as possible regarding costs in # - grammar development # - at test runtime # - in analysis (grammar simplification) and replay of bad effects met. # In order to achieve that certain decisions had to be made # 1. SQL statements should be kept as simple as possible. # 2. No coverage for features like for the example the stored program language. # Nevertheless # - creating, use and drop of triggers needs to be checked because # they are bound to tables # - stored procedures might be used for auxiliary purposes # 3. We focus on coarse grained bad effects like crashes and similar. # Some immediate (just after finishing statement execution) and deep # (table definition or table content) checking via some validator is mostly # impossible because of various reasons. # # The current grammar is partially based on the code of conf/runtime/alter_online.yy # Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. # and should become the successor of that test. # # Even with threads = 1 an ALTER TABLE ... ADD COLUMN could fail. # Example: # ALTER TABLE t1 ADD COLUMN IF NOT EXISTS col3_copy INT FIRST, # LOCK = NONE, ALGORITHM = COPY # 1846 LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED. # Impact: # 1. 1054 Unknown column '%s' in 'field list' for # UPDATE t1 SET col3_copy = col3 # 2. ALTER TABLE t1 DROP COLUMN IF EXISTS col3 works # ALTER TABLE t1 CHANGE COLUMN <...> col3_copy col3 INT, LOCK = EXCLUSIVE makes no replacement # and the table is incomplete. # Possible solutions: # a) Try ALTER TABLE t1 ADD COLUMN IF NOT EXISTS and than fill it via # UPDATE t1 ....