|
| 1 | +=====1) hotbackup test===== |
| 2 | +CREATE TABLE test.t1 (c1 INT PRIMARY KEY, c2 INT, c3 INT) ENGINE=TOKUDB; |
| 3 | +INSERT INTO test.t1 VALUES(1111,1111,11111); |
| 4 | +CREATE TABLE test.t11 (c1 INT PRIMARY KEY, c2 INT, c3 INT) ENGINE=TOKUDB; |
| 5 | +CREATE TABLE test.t2 (c1 INT PRIMARY KEY, c2 INT) ENGINE=TOKUDB; |
| 6 | +INSERT INTO test.t2 VALUES(1122,1122); |
| 7 | +SET GLOBAL tokudb_checkpoint_on_flush_logs=ON; |
| 8 | +FLUSH LOGS; |
| 9 | +SET GLOBAL tokudb_checkpoint_on_flush_logs=OFF; |
| 10 | +INSERT INTO test.t1 VALUES(1,1,1); |
| 11 | +SET GLOBAL TOKUDB_CHECKPOINT_LOCK=ON; |
| 12 | +CREATE TABLE test.t22 (c1 INT PRIMARY KEY, c2 INT) ENGINE=TOKUDB; |
| 13 | +INSERT INTO test.t22 VALUES(1,1); |
| 14 | +INSERT INTO test.t1 VALUES(2,2,2); |
| 15 | +FLUSH TABLES WITH READ LOCK; |
| 16 | +UNLOCK TABLES; |
| 17 | +conn2 write(22,22,22), this row can't visible in new backup instance |
| 18 | +INSERT INTO test.t1 VALUES(22222,22222,22222); |
| 19 | +FLUSH TABLES; |
| 20 | +ALTER TABLE test.t11 RENAME test.t111; |
| 21 | +DROP TABLE test.t22; |
| 22 | +DROP TABLE test.t111; |
| 23 | +SET GLOBAL TOKUDB_CHECKPOINT_LOCK=OFF; |
| 24 | +shutdown server |
| 25 | +SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TOKUDB_FILE_MAP WHERE TABLE_SCHEMA='test' AND TABLE_DICTIONARY_NAME='main'; |
| 26 | +TABLE_NAME |
| 27 | +t1 |
| 28 | +t11 |
| 29 | +t2 |
| 30 | +t22 |
| 31 | +OPTIMIZE TABLE test.t1; |
| 32 | +Table Op Msg_type Msg_text |
| 33 | +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead |
| 34 | +test.t1 optimize status OK |
| 35 | +SELECT * FROM test.t1; |
| 36 | +c1 c2 c3 |
| 37 | +1 1 1 |
| 38 | +2 2 2 |
| 39 | +1111 1111 11111 |
| 40 | +SELECT * FROM test.t2; |
| 41 | +c1 c2 |
| 42 | +1122 1122 |
| 43 | +DROP TABLE test.t1; |
| 44 | +DROP TABLE test.t2; |
| 45 | +=====2) crash and recover test===== |
| 46 | +CREATE TABLE test.t2 (c1 INT, c2 INT, PRIMARY KEY(c1), CLUSTERING KEY(c2)) ENGINE=TOKUDB; |
| 47 | +1 |
| 48 | +SELECT COUNT(*) FROM test.t2; |
| 49 | +COUNT(*) |
| 50 | +1000 |
| 51 | +DROP TABLE test.t2; |
| 52 | +=====3) create empty table and shutdown with checkpoint lock===== |
| 53 | +CREATE TABLE test.t1 (c1 INT, c2 INT, PRIMARY KEY(c1), CLUSTERING KEY(c2)) ENGINE=TOKUDB; |
| 54 | +CREATE TABLE test.t2 (c1 INT) ENGINE=TOKUDB; |
| 55 | +shutdown server |
| 56 | +SELECT * FROM test.t1; |
| 57 | +c1 c2 |
| 58 | +SELECT * FROM test.t2; |
| 59 | +c1 |
| 60 | +CREATE TABLE test.t3 (c1 INT) ENGINE=TOKUDB; |
| 61 | +INSERT INTO test.t3 VALUES(1); |
| 62 | +shutdown server |
| 63 | +SELECT * FROM test.t3; |
| 64 | +c1 |
| 65 | +1 |
| 66 | +DROP TABLE test.t1; |
| 67 | +DROP TABLE test.t2; |
| 68 | +DROP TABLE test.t3; |
| 69 | +=====4) alter table with checkpoint lock===== |
| 70 | +CREATE TABLE test.t1 (c1 INT PRIMARY KEY, c2 INT) ENGINE=TOKUDB; |
| 71 | +INSERT INTO test.t1 VALUES(1,1); |
| 72 | +SET GLOBAL TOKUDB_CHECKPOINT_LOCK=ON; |
| 73 | +FLUSH TABLES WITH READ LOCK; |
| 74 | +UNLOCK TABLES; |
| 75 | +ALTER TABLE test.t1 ADD COLUMN `c3` INT; |
| 76 | +INSERT INTO test.t1 VALUES(2,2,3); |
| 77 | +SET GLOBAL TOKUDB_CHECKPOINT_LOCK=OFF; |
| 78 | +shutdown server |
| 79 | +OPTIMIZE TABLE test.t1; |
| 80 | +Table Op Msg_type Msg_text |
| 81 | +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead |
| 82 | +test.t1 optimize status OK |
| 83 | +SELECT * FROM test.t1; |
| 84 | +c1 c2 |
| 85 | +1 1 |
| 86 | +DROP TABLE test.t1; |
| 87 | +=====5) kill insert/alter/add index when checkpoint lock ON===== |
| 88 | +shutdown server |
| 89 | +CREATE TABLE test.t1 (c1 INT PRIMARY KEY, c2 INT) ENGINE=TOKUDB; |
| 90 | +SET GLOBAL TOKUDB_CHECKPOINT_LOCK=ON; |
| 91 | +CREATE TABLE test.t3 (c1 INT PRIMARY KEY, c2 INT) ENGINE=TOKUDB; |
| 92 | +ALTER TABLE test.t1 ADD COLUMN `c3` INT; |
| 93 | +INSERT INTO test.t1 VALUES(2,2,3); |
| 94 | +ALTER TABLE test.t3 ADD INDEX idx_c1c2(c1, c2); |
| 95 | +1 |
| 96 | +SHOW CREATE TABLE test.t1; |
| 97 | +Table Create Table |
| 98 | +t1 CREATE TABLE `t1` ( |
| 99 | + `c1` int(11) NOT NULL, |
| 100 | + `c2` int(11) DEFAULT NULL, |
| 101 | + `c3` int(11) DEFAULT NULL, |
| 102 | + PRIMARY KEY (`c1`) |
| 103 | +) ENGINE=TokuDB DEFAULT CHARSET=latin1 |
| 104 | +SHOW CREATE TABLE test.t3; |
| 105 | +Table Create Table |
| 106 | +t3 CREATE TABLE `t3` ( |
| 107 | + `c1` int(11) NOT NULL, |
| 108 | + `c2` int(11) DEFAULT NULL, |
| 109 | + PRIMARY KEY (`c1`), |
| 110 | + KEY `idx_c1c2` (`c1`,`c2`) |
| 111 | +) ENGINE=TokuDB DEFAULT CHARSET=latin1 |
| 112 | +DROP TABLE test.t1; |
| 113 | +DROP TABLE test.t3; |
0 commit comments