-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PS-9222 Include reordered fields when calculating mlog buffer size
https://perconadev.atlassian.net/browse/PS-9222 Problem ======= Upstream commit e6e13a8 tries to fix an issue that doesn't log the fields that changes orders when using ALGORITHM=instant, by checking if the fields are also reordered, then adding the columns into the list. However when calculating the size of the buffer this fix doesn't take account the extra fields that may be logged, and causing the assertion on the buffer size failed eventually. Solution ======== To calculate the buffer size correctly, we move the logic of finding reordered fiedls before buffer size calculation, then count the number of fields with the same logic when deciding if a field needs to be logged.
- Loading branch information
1 parent
2d41d23
commit 2bbb14b
Showing
3 changed files
with
91 additions
and
37 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
mysql-test/suite/innodb/r/instant_alter_stored_column_order.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# PS-9222 - Testing if ALGORITHM=instant crashes server | ||
CREATE TABLE t1 (c1 TINYTEXT COLLATE ascii_bin NOT NULL, c2 DATETIME(3) NOT NULL, c3 TEXT, PRIMARY KEY (c1(30))); | ||
INSERT INTO t1 (c1, c2, c3) VALUE ('k1','2021-12-21','something'); | ||
INSERT INTO t1 (c1, c2, c3) VALUE ('k3','2021-12-21','something else'); | ||
ALTER TABLE t1 ADD COLUMN c4 VARCHAR(18) NOT NULL, algorithm=instant; | ||
UPDATE t1 SET c4 = 'value' WHERE c1 = 'k1'; | ||
# Restart the server and reload the table to see if tables are corrupted. | ||
# Kill and restart | ||
# Run a select to confirm that the database started up successfully | ||
SELECT * FROM t1; | ||
c1 c2 c3 c4 | ||
k1 2021-12-21 00:00:00.000 something value | ||
k3 2021-12-21 00:00:00.000 something else | ||
DROP TABLE t1; |
31 changes: 31 additions & 0 deletions
31
mysql-test/suite/innodb/t/instant_alter_stored_column_order.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--disable_query_log | ||
--disable_warnings | ||
DROP DATABASE IF EXISTS instant_alter_stored_column_order; | ||
CREATE DATABASE instant_alter_stored_column_order; | ||
USE instant_alter_stored_column_order; | ||
--enable_warnings | ||
--enable_query_log | ||
|
||
# PS-9222 Testing regression introduced by e6e13a8f, which causes engine crashed | ||
|
||
--echo # PS-9222 - Testing if ALGORITHM=instant crashes server | ||
CREATE TABLE t1 (c1 TINYTEXT COLLATE ascii_bin NOT NULL, c2 DATETIME(3) NOT NULL, c3 TEXT, PRIMARY KEY (c1(30))); | ||
INSERT INTO t1 (c1, c2, c3) VALUE ('k1','2021-12-21','something'); | ||
INSERT INTO t1 (c1, c2, c3) VALUE ('k3','2021-12-21','something else'); | ||
|
||
ALTER TABLE t1 ADD COLUMN c4 VARCHAR(18) NOT NULL, algorithm=instant; | ||
UPDATE t1 SET c4 = 'value' WHERE c1 = 'k1'; | ||
|
||
--echo # Restart the server and reload the table to see if tables are corrupted. | ||
--source include/kill_and_restart_mysqld.inc | ||
|
||
-- echo # Run a select to confirm that the database started up successfully | ||
SELECT * FROM t1; | ||
DROP TABLE t1; | ||
|
||
# cleanup | ||
--disable_query_log | ||
--disable_warnings | ||
DROP DATABASE instant_alter_stored_column_order; | ||
--enable_warnings | ||
--enable_query_log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters