| 1 |
# |
| 2 |
# WL-8478 : Undo log speedup - parallel LGMAN applying |
| 3 |
# |
| 4 |
CREATE LOGFILE GROUP lg_1 |
| 5 |
ADD UNDOFILE 'undo_1.log' |
| 6 |
INITIAL_SIZE 16M |
| 7 |
UNDO_BUFFER_SIZE 2M |
| 8 |
ENGINE NDBCLUSTER; |
| 9 |
ALTER LOGFILE GROUP lg_1 |
| 10 |
ADD UNDOFILE 'undo_2.log' |
| 11 |
INITIAL_SIZE 12M |
| 12 |
ENGINE NDBCLUSTER; |
| 13 |
CREATE TABLESPACE ts_1 |
| 14 |
ADD DATAFILE 'data_1.dat' |
| 15 |
USE LOGFILE GROUP lg_1 |
| 16 |
INITIAL_SIZE 32M |
| 17 |
ENGINE NDBCLUSTER; |
| 18 |
ALTER TABLESPACE ts_1 |
| 19 |
ADD DATAFILE 'data_2.dat' |
| 20 |
INITIAL_SIZE 48M; |
| 21 |
CREATE TABLE dt_1 ( |
| 22 |
member_id INT |
| 23 |
) |
| 24 |
TABLESPACE ts_1 STORAGE DISK |
| 25 |
ENGINE NDBCLUSTER; |
| 26 |
# |
| 27 |
# Test UNDO_TUP_ALLOC by inserting 1000 * 100 rows in dt_1 |
| 28 |
# |
| 29 |
SELECT COUNT(*) AS "Records inserted into dt_1" FROM dt_1; |
| 30 |
Records inserted into dt_1 |
| 31 |
100000 |
| 32 |
CREATE TABLE dt_2 ( |
| 33 |
member_id INT |
| 34 |
) |
| 35 |
TABLESPACE ts_1 STORAGE DISK |
| 36 |
ENGINE NDBCLUSTER; |
| 37 |
# |
| 38 |
# Test UNDO_TUP_FREE by deleting rows with member_id 2 from dt_1 |
| 39 |
# |
| 40 |
SELECT COUNT(*) AS "Records in dt_1 after delete" FROM dt_1; |
| 41 |
Records in dt_1 after delete |
| 42 |
90000 |
| 43 |
# |
| 44 |
# Test UNDO_TUP_UPDATE by updating rows where member_id = 5 in dt_1 |
| 45 |
# |
| 46 |
SELECT COUNT(*) AS "Records in dt_1 after update" FROM dt_1; |
| 47 |
Records in dt_1 after update |
| 48 |
90000 |
| 49 |
# |
| 50 |
# Test UNDO_TUP_DROP by dropping table dt_2 |
| 51 |
# |
| 52 |
DROP TABLE dt_2; |
| 53 |
# Show number of rows in dt_1 before restart for easy comparison |
| 54 |
SELECT COUNT(*) AS "Number of rows before node restart" FROM dt_1; |
| 55 |
Number of rows before node restart |
| 56 |
90000 |
| 57 |
# Start LCP so that disk table pages are flushed to disk. |
| 58 |
# Otherwise, the undo log records are not sent to the LDM threads |
| 59 |
# for application |
| 60 |
# Sleep until LCP (hopefully) has completed |
| 61 |
# Restarting node 1 with nostart... |
| 62 |
# Wait for node to reach not-started state... |
| 63 |
Node 1: NOT_STARTED |
| 64 |
# Insert error to invalidate the latest LCP, so that the undo |
| 65 |
# records till the LCP start of the previous LCP are applied |
| 66 |
# Start node 1.. |
| 67 |
# Wait for node 1 to start... |
| 68 |
Node 1: STARTED |
| 69 |
Node 2: STARTED |
| 70 |
# Node 1 started |
| 71 |
# Clear error inserts |
| 72 |
# Check that existent data is still there |
| 73 |
SELECT COUNT(*) AS "Number of rows after node restart" FROM dt_1; |
| 74 |
Number of rows after node restart |
| 75 |
90000 |
| 76 |
# Check that table can still be used to insert data |
| 77 |
INSERT INTO dt_1 VALUES (2),(3),(4),(5); |
| 78 |
SELECT COUNT(*) as "Number of rows after four more rows inserted" FROM dt_1; |
| 79 |
Number of rows after four more rows inserted |
| 80 |
90004 |
| 81 |
# |
| 82 |
# Check that data can be removed from the table (can cause temporary |
| 83 |
# timeout errors?) by removing all rows with member_id 1 |
| 84 |
# |
| 85 |
SELECT COUNT(*) AS "Records in dt_1 after second delete" FROM dt_1; |
| 86 |
Records in dt_1 after second delete |
| 87 |
80004 |
| 88 |
# Check that table dt_2 still does not exist, it was removed |
| 89 |
# before node restart |
| 90 |
SELECT * FROM dt_2; |
| 91 |
ERROR 42S02: Table 'test.dt_2' doesn't exist |
| 92 |
# Cleanup |
| 93 |
DROP TABLE dt_1; |
| 94 |
ALTER TABLESPACE ts_1 |
| 95 |
DROP DATAFILE 'data_2.dat'; |
| 96 |
ALTER TABLESPACE ts_1 |
| 97 |
DROP DATAFILE 'data_1.dat'; |
| 98 |
DROP TABLESPACE ts_1; |
| 99 |
DROP LOGFILE GROUP lg_1 |
| 100 |
ENGINE NDBCLUSTER; |