mirror of
https://github.com/MariaDB/server.git
synced 2025-12-13 20:03:16 +03:00
WL#5151: Conversion between different types when replicating
Row-based replication requires the types of columns on the
master and slave to be approximately the same (some safe
conversions between strings are allowed), but does not
allow safe conversions between fields of similar types such
as TINYINT and INT.
This patch implement type conversions between similar fields
on the master and slave.
The conversions are controlled using a new variable
SLAVE_TYPE_CONVERSIONS of type SET('ALL_LOSSY','ALL_NON_LOSSY').
Non-lossy conversions are any conversions that do not run the
risk of losing any information, while lossy conversions can
potentially truncate the value. The column definitions are
checked to decide if the conversion is acceptable.
If neither conversion is enabled, it is required that the
definitions of the columns are identical on master and slave.
Conversion is done by creating an internal conversion table,
unpacking the master data into it, and then copy the data to
the real table on the slave.
This commit is contained in:
@@ -4,6 +4,8 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
SET @saved_slave_type_conversions = @@slave_type_conversions;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
|
||||
CREATE DATABASE track;
|
||||
USE track;
|
||||
CREATE TABLE `visits` (
|
||||
@@ -65,5 +67,6 @@ visits_id myid src ip cc org ref time host entry visit_exit user_id visit_start
|
||||
SELECT * FROM visits_events;
|
||||
event_id visit_id timestamp src data visits_events_id
|
||||
20000 21231038 2007-09-18 03:59:02 Downloads/MySQL-4.1/mysql-4.1.12a-win32.zip 33712207
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
DROP DATABASE track;
|
||||
End of 5.1 tests
|
||||
|
||||
Reference in New Issue
Block a user