272
288
connection master;
273
289
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
274
290
sync_slave_with_master;
293
# BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars
296
# We have 4 combinations to test with respect to the field length
297
# (i.e., the number of bytes) of the CHAR fields:
299
# 1. Replicating from CHAR<256 to CHAR<256
300
# 2. Replicating from CHAR<256 to CHAR>255
301
# 3. Replicating from CHAR>255 to CHAR<256
302
# 4. Replicating from CHAR>255 to CHAR>255
304
# We also make a special case of using the max size of a field on the
305
# master, i.e. CHAR(255) in UTF-8, giving another three cases.
307
# 5. Replicating UTF-8 CHAR(255) to CHAR(<256)
308
# 6. Replicating UTF-8 CHAR(255) to CHAR(>255)
309
# 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8
312
CREATE TABLE t1 (i INT NOT NULL,
313
c CHAR(16) CHARACTER SET utf8 NOT NULL,
316
CREATE TABLE t2 (i INT NOT NULL,
317
c CHAR(16) CHARACTER SET utf8 NOT NULL,
320
sync_slave_with_master;
321
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
324
CREATE TABLE t3 (i INT NOT NULL,
325
c CHAR(128) CHARACTER SET utf8 NOT NULL,
327
sync_slave_with_master;
328
ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
331
CREATE TABLE t4 (i INT NOT NULL,
332
c CHAR(128) CHARACTER SET utf8 NOT NULL,
335
CREATE TABLE t5 (i INT NOT NULL,
336
c CHAR(255) CHARACTER SET utf8 NOT NULL,
338
sync_slave_with_master;
339
ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
342
CREATE TABLE t6 (i INT NOT NULL,
343
c CHAR(255) CHARACTER SET utf8 NOT NULL,
345
sync_slave_with_master;
346
ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
349
CREATE TABLE t7 (i INT NOT NULL,
350
c CHAR(255) CHARACTER SET utf8 NOT NULL,
353
--echo [expecting slave to replicate correctly]
355
INSERT INTO t1 VALUES (1, "", 1);
356
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
358
let $diff_table_1=master:test.t1;
359
let $diff_table_2=slave:test.t1;
360
source include/diff_tables.inc;
362
--echo [expecting slave to replicate correctly]
364
INSERT INTO t2 VALUES (1, "", 1);
365
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
367
let $diff_table_1=master:test.t2;
368
let $diff_table_2=slave:test.t2;
369
source include/diff_tables.inc;
371
--echo [expecting slave to stop]
373
INSERT INTO t3 VALUES (1, "", 1);
374
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
377
source include/wait_for_slave_sql_to_stop.inc;
378
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
380
eval SELECT "$last_error" AS Last_SQL_Error;
382
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
384
source include/wait_for_slave_to_start.inc;
386
--echo [expecting slave to replicate correctly]
388
INSERT INTO t4 VALUES (1, "", 1);
389
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
391
let $diff_table_1=master:test.t4;
392
let $diff_table_2=slave:test.t4;
393
source include/diff_tables.inc;
395
--echo [expecting slave to stop]
397
INSERT INTO t5 VALUES (1, "", 1);
398
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
401
source include/wait_for_slave_sql_to_stop.inc;
402
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
404
eval SELECT "$last_error" AS Last_SQL_Error;
406
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
408
source include/wait_for_slave_to_start.inc;
410
--echo [expecting slave to stop]
412
INSERT INTO t6 VALUES (1, "", 1);
413
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
416
source include/wait_for_slave_sql_to_stop.inc;
417
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
419
eval SELECT "$last_error" AS Last_SQL_Error;
421
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
423
source include/wait_for_slave_to_start.inc;
425
--echo [expecting slave to replicate correctly]
427
INSERT INTO t7 VALUES (1, "", 1);
428
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
430
let $diff_table_1=master:test.t7;
431
let $diff_table_2=slave:test.t7;
432
source include/diff_tables.inc;
435
drop table t1, t2, t3, t4, t5, t6, t7;
436
sync_slave_with_master;