mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
BUG#49562: SBR out of sync when using numeric data types + user
variable The User_var_log_event was not serializing the unsigned flag. This would cause the slave to always assume signed values. We fix this by extending the User_var_log_event to also contain information on the unsigned_flag, meaning that it gets into the binlog as well, therefore the slave will get this information as well. Events without information on unsigned flag (old events) are treated as they were before (always signed: unsigned_flag= FALSE). The information on the unsigned_flag, is shipped in an extra byte appended to the end of the User_var_log_event and added by this patch. This extra byte holds values for general purpose User_var_log_event flags which are now packed in the binlog as well. One of these flags contains information about whether the value is signed or unsigned (currently this extra byte is only used to hold data on the unsigned flag, in the future we can use it to pack extra flags if there is the need to).
This commit is contained in:
271
mysql-test/suite/rpl/r/rpl_stm_user_variables.result
Normal file
271
mysql-test/suite/rpl/r/rpl_stm_user_variables.result
Normal file
@ -0,0 +1,271 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
SET @positive= 18446744073709551615;
|
||||
SET @negative= -9223372036854775808;
|
||||
CREATE TABLE t1 (`tinyint` TINYINT,
|
||||
`smallint` SMALLINT,
|
||||
`mediumint` MEDIUMINT,
|
||||
`integer` INTEGER,
|
||||
`bigint` BIGINT,
|
||||
`utinyint` TINYINT UNSIGNED,
|
||||
`usmallint` SMALLINT UNSIGNED,
|
||||
`umediumint` MEDIUMINT UNSIGNED,
|
||||
`uinteger` INTEGER UNSIGNED,
|
||||
`ubigint` BIGINT UNSIGNED,
|
||||
`double` DOUBLE,
|
||||
`float` FLOAT,
|
||||
`real` REAL(30,2),
|
||||
`decimal` DECIMAL(30,2)) ENGINE = MyISAM;
|
||||
### insert max unsigned
|
||||
### a) declarative
|
||||
INSERT INTO t1 VALUES (18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615,18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615);;
|
||||
#########################################
|
||||
#### [ on master ]
|
||||
SELECT * FROM t1;
|
||||
tinyint 127
|
||||
smallint 32767
|
||||
mediumint 8388607
|
||||
integer 2147483647
|
||||
bigint 9223372036854775807
|
||||
utinyint 255
|
||||
usmallint 65535
|
||||
umediumint 16777215
|
||||
uinteger 4294967295
|
||||
ubigint 18446744073709551615
|
||||
double 1.84467440737096e+19
|
||||
float 1.84467e+19
|
||||
real 18446744073709551616.00
|
||||
decimal 18446744073709551615.00
|
||||
#### [ on slave ]
|
||||
SELECT * FROM t1;
|
||||
tinyint 127
|
||||
smallint 32767
|
||||
mediumint 8388607
|
||||
integer 2147483647
|
||||
bigint 9223372036854775807
|
||||
utinyint 255
|
||||
usmallint 65535
|
||||
umediumint 16777215
|
||||
uinteger 4294967295
|
||||
ubigint 18446744073709551615
|
||||
double 1.84467440737096e+19
|
||||
float 1.84467e+19
|
||||
real 18446744073709551616.00
|
||||
decimal 18446744073709551615.00
|
||||
#########################################
|
||||
## assertion: master and slave tables are in sync
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
TRUNCATE t1;
|
||||
### b) user var
|
||||
INSERT INTO t1 VALUES (@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive);
|
||||
#########################################
|
||||
#### [ on master ]
|
||||
SELECT * FROM t1;
|
||||
tinyint 127
|
||||
smallint 32767
|
||||
mediumint 8388607
|
||||
integer 2147483647
|
||||
bigint 9223372036854775807
|
||||
utinyint 255
|
||||
usmallint 65535
|
||||
umediumint 16777215
|
||||
uinteger 4294967295
|
||||
ubigint 18446744073709551615
|
||||
double 1.84467440737096e+19
|
||||
float 1.84467e+19
|
||||
real 18446744073709551616.00
|
||||
decimal 18446744073709551615.00
|
||||
#### [ on slave ]
|
||||
SELECT * FROM t1;
|
||||
tinyint 127
|
||||
smallint 32767
|
||||
mediumint 8388607
|
||||
integer 2147483647
|
||||
bigint 9223372036854775807
|
||||
utinyint 255
|
||||
usmallint 65535
|
||||
umediumint 16777215
|
||||
uinteger 4294967295
|
||||
ubigint 18446744073709551615
|
||||
double 1.84467440737096e+19
|
||||
float 1.84467e+19
|
||||
real 18446744073709551616.00
|
||||
decimal 18446744073709551615.00
|
||||
#########################################
|
||||
## assertion: master and slave tables are in sync
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
TRUNCATE t1;
|
||||
### insert min signed
|
||||
### a) declarative
|
||||
INSERT INTO t1 VALUES (-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808,-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808);;
|
||||
#########################################
|
||||
#### [ on master ]
|
||||
SELECT * FROM t1;
|
||||
tinyint -128
|
||||
smallint -32768
|
||||
mediumint -8388608
|
||||
integer -2147483648
|
||||
bigint -9223372036854775808
|
||||
utinyint 0
|
||||
usmallint 0
|
||||
umediumint 0
|
||||
uinteger 0
|
||||
ubigint 0
|
||||
double -9.22337203685478e+18
|
||||
float -9.22337e+18
|
||||
real -9223372036854775808.00
|
||||
decimal -9223372036854775808.00
|
||||
#### [ on slave ]
|
||||
SELECT * FROM t1;
|
||||
tinyint -128
|
||||
smallint -32768
|
||||
mediumint -8388608
|
||||
integer -2147483648
|
||||
bigint -9223372036854775808
|
||||
utinyint 0
|
||||
usmallint 0
|
||||
umediumint 0
|
||||
uinteger 0
|
||||
ubigint 0
|
||||
double -9.22337203685478e+18
|
||||
float -9.22337e+18
|
||||
real -9223372036854775808.00
|
||||
decimal -9223372036854775808.00
|
||||
#########################################
|
||||
## assertion: master and slave tables are in sync
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
TRUNCATE t1;
|
||||
### b) user var
|
||||
INSERT INTO t1 VALUES (@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative);
|
||||
#########################################
|
||||
#### [ on master ]
|
||||
SELECT * FROM t1;
|
||||
tinyint -128
|
||||
smallint -32768
|
||||
mediumint -8388608
|
||||
integer -2147483648
|
||||
bigint -9223372036854775808
|
||||
utinyint 0
|
||||
usmallint 0
|
||||
umediumint 0
|
||||
uinteger 0
|
||||
ubigint 0
|
||||
double -9.22337203685478e+18
|
||||
float -9.22337e+18
|
||||
real -9223372036854775808.00
|
||||
decimal -9223372036854775808.00
|
||||
#### [ on slave ]
|
||||
SELECT * FROM t1;
|
||||
tinyint -128
|
||||
smallint -32768
|
||||
mediumint -8388608
|
||||
integer -2147483648
|
||||
bigint -9223372036854775808
|
||||
utinyint 0
|
||||
usmallint 0
|
||||
umediumint 0
|
||||
uinteger 0
|
||||
ubigint 0
|
||||
double -9.22337203685478e+18
|
||||
float -9.22337e+18
|
||||
real -9223372036854775808.00
|
||||
decimal -9223372036854775808.00
|
||||
#########################################
|
||||
## assertion: master and slave tables are in sync
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
TRUNCATE t1;
|
||||
## check: contents of both tables master's and slave's
|
||||
## assertion: checks that User_var_log_event::pack_info correctly
|
||||
## displays the binlog content by taking into account the
|
||||
## unsigned_flag
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (`tinyint` TINYINT,
|
||||
`smallint` SMALLINT,
|
||||
`mediumint` MEDIUMINT,
|
||||
`integer` INTEGER,
|
||||
`bigint` BIGINT,
|
||||
`utinyint` TINYINT UNSIGNED,
|
||||
`usmallint` SMALLINT UNSIGNED,
|
||||
`umediumint` MEDIUMINT UNSIGNED,
|
||||
`uinteger` INTEGER UNSIGNED,
|
||||
`ubigint` BIGINT UNSIGNED,
|
||||
`double` DOUBLE,
|
||||
`float` FLOAT,
|
||||
`real` REAL(30,2),
|
||||
`decimal` DECIMAL(30,2)) ENGINE = MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615,18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`positive`=18446744073709551615
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive,
|
||||
@positive)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808,-9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808, -9223372036854775808)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`negative`=-9223372036854775808
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative,
|
||||
@negative)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE t1
|
||||
DROP TABLE t1;
|
Reference in New Issue
Block a user