| 1 |
# |
| 2 |
# |
| 3 |
# Bug#34312769 NdbSqlUtil.cpp:498: require((lb + m1 <= n1 && lb + m2 <= n2)) failed |
| 4 |
# |
| 5 |
# Test to verify that pk varchar column values of different lengths can be |
| 6 |
# compared successfully even with any of the charsets enabled. |
| 7 |
# |
| 8 |
|
| 9 |
--source include/have_ndb.inc |
| 10 |
--source include/have_binlog_format_mixed_or_row.inc |
| 11 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 12 |
|
| 13 |
--connection master |
| 14 |
|
| 15 |
################# |
| 16 |
# |
| 17 |
create table t1 |
| 18 |
(id varchar(50) NOT NULL, |
| 19 |
str varchar(50) NOT NULL, |
| 20 |
primary key (`id`,`str`)) |
| 21 |
engine = ndb default charset=latin1; |
| 22 |
|
| 23 |
# Insert 'one ' (with multiple trailing spaces) |
| 24 |
insert into t1(id, str) values ("1","one "); |
| 25 |
|
| 26 |
########## |
| 27 |
# Verify that 'one ' compares equal to 'one'. |
| 28 |
# Both when used as part of a key, as well as in a condition. |
| 29 |
select "'one' IS EQUAL 'one ...'" from dual where "one" = "one "; |
| 30 |
select concat("<<<",str,">>>") from t1 where str = "one" and id="1"; |
| 31 |
select concat("<<<",str,">>>") from t1 where str = "one"; |
| 32 |
|
| 33 |
########## |
| 34 |
# Replica should see the same contents as well: |
| 35 |
--echo Check content on replica |
| 36 |
--sync_slave_with_master |
| 37 |
--connection slave |
| 38 |
select concat("<<<",str,">>>") from t1 where str = "one" and id="1"; |
| 39 |
select concat("<<<",str,">>>") from t1 where str = "one"; |
| 40 |
|
| 41 |
########## |
| 42 |
# Update the pk 'str'-column by removing the trailing space. |
| 43 |
# The key should still compare equal to the old value though, |
| 44 |
# even if the binary representation changed. |
| 45 |
# |
| 46 |
# Note that the failing ::checkUpdateOfPrimaryKey() was only called on the |
| 47 |
# slave: Operation is executed as a delete+insert on the primary. |
| 48 |
# The replication process however will merge that into |
| 49 |
# an update of the primary key - where it fails... |
| 50 |
--echo Update content on primary, remove trailing spaces |
| 51 |
--connection master |
| 52 |
update t1 set str="one" where id="1"; |
| 53 |
select concat("<<<",str,">>>") from t1; |
| 54 |
|
| 55 |
######### |
| 56 |
--echo Verify the replica update, no trailing spaces anymore! |
| 57 |
--sync_slave_with_master |
| 58 |
--connection slave |
| 59 |
select concat("<<<",str,">>>") from t1; |
| 60 |
|
| 61 |
######## |
| 62 |
--echo Double check: Primary update it back to original value |
| 63 |
--connection master |
| 64 |
update t1 set str="one " where id="1"; |
| 65 |
select concat("<<<",str,">>>") from t1; |
| 66 |
|
| 67 |
######### |
| 68 |
--echo Verify the replica update, see trailing space again |
| 69 |
--sync_slave_with_master |
| 70 |
--connection slave |
| 71 |
select concat("<<<",str,">>>") from t1; |
| 72 |
|
| 73 |
--connection master |
| 74 |
drop table t1; |
| 75 |
|
| 76 |
|
| 77 |
--echo ########################################## |
| 78 |
--echo # bug#34388068 NDB:Update to char data type columns in |
| 79 |
--echo # primay keys are lost on replica. |
| 80 |
|
| 81 |
############################### |
| 82 |
## Test all different combinations of ndb_log_update* |
| 83 |
## Change to primary key char columns should be correctly |
| 84 |
## replicated independent of these settings |
| 85 |
|
| 86 |
set global ndb_log_updated_only=0; |
| 87 |
set global ndb_log_update_as_write=0; |
| 88 |
set global ndb_log_update_minimal=0; |
| 89 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 90 |
|
| 91 |
set global ndb_log_updated_only=1; |
| 92 |
set global ndb_log_update_as_write=0; |
| 93 |
set global ndb_log_update_minimal=0; |
| 94 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 95 |
|
| 96 |
set global ndb_log_updated_only=0; |
| 97 |
set global ndb_log_update_as_write=1; |
| 98 |
set global ndb_log_update_minimal=0; |
| 99 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 100 |
|
| 101 |
set global ndb_log_updated_only=1; |
| 102 |
set global ndb_log_update_as_write=1; |
| 103 |
set global ndb_log_update_minimal=0; |
| 104 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 105 |
|
| 106 |
set global ndb_log_updated_only=0; |
| 107 |
set global ndb_log_update_as_write=1; |
| 108 |
set global ndb_log_update_minimal=1; |
| 109 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 110 |
|
| 111 |
set global ndb_log_updated_only=1; |
| 112 |
set global ndb_log_update_as_write=1; |
| 113 |
set global ndb_log_update_minimal=1; |
| 114 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 115 |
|
| 116 |
set global ndb_log_updated_only=0; |
| 117 |
set global ndb_log_update_as_write=0; |
| 118 |
set global ndb_log_update_minimal=1; |
| 119 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 120 |
|
| 121 |
set global ndb_log_updated_only=1; |
| 122 |
set global ndb_log_update_as_write=0; |
| 123 |
set global ndb_log_update_minimal=1; |
| 124 |
--source ndb_rpl_cmp_varchar_charset.inc |
| 125 |
|
| 126 |
## Reset to default |
| 127 |
set global ndb_log_updated_only=default; |
| 128 |
set global ndb_log_update_as_write=default; |
| 129 |
set global ndb_log_update_minimal=default; |
| 130 |
|
| 131 |
--source include/rpl_end.inc |