mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
f169114042
Now one can use user variables as target for data loaded from file (besides table's columns). Also LOAD DATA got new SET-clause in which one can specify values for table columns as expressions. For example the following is possible: LOAD DATA INFILE 'words.dat' INTO TABLE t1 (a, @b) SET c = @b + 1; This patch also implements new way of replicating LOAD DATA. Now we do it similarly to other queries. We store LOAD DATA query in new Execute_load_query event (which is last in the sequence of events representing LOAD DATA). When we are executing this event we simply rewrite part of query which holds name of file (we use name of temporary file) and then execute it as usual query. In the beggining of this sequence we use Begin_load_query event which is almost identical to Append_file event
85 lines
2.3 KiB
Text
85 lines
2.3 KiB
Text
# Test of replication of time zones.
|
|
source include/master-slave.inc;
|
|
|
|
# Some preparations
|
|
let $VERSION=`select version()`;
|
|
create table t1 (t timestamp);
|
|
create table t2 (t char(32));
|
|
|
|
#
|
|
# Let us check how well replication works when we are saving datetime
|
|
# value in TIMESTAMP field.
|
|
#
|
|
connection master;
|
|
select @@time_zone;
|
|
set time_zone='UTC';
|
|
insert into t1 values ('20040101000000'), ('20040611093902');
|
|
select * from t1;
|
|
# On slave we still in 'Europe/Moscow' so we should see equivalent but
|
|
# textually different values.
|
|
sync_slave_with_master;
|
|
select * from t1;
|
|
|
|
# Let us check also that setting of time_zone back to default also works
|
|
# well
|
|
connection master;
|
|
delete from t1;
|
|
set time_zone='Europe/Moscow';
|
|
insert into t1 values ('20040101000000'), ('20040611093902');
|
|
select * from t1;
|
|
sync_slave_with_master;
|
|
select * from t1;
|
|
connection master;
|
|
# We should not see SET ONE_SHOT time_zone before second insert
|
|
--replace_result $VERSION VERSION
|
|
--replace_column 2 # 5 #
|
|
show binlog events;
|
|
|
|
#
|
|
# Now let us check how well we replicate statments reading TIMESTAMP fields
|
|
# (We should see the same data on master and on slave but it should differ
|
|
# from originally inserted)
|
|
#
|
|
set time_zone='MET';
|
|
insert into t2 (select t from t1);
|
|
select * from t1;
|
|
sync_slave_with_master;
|
|
select * from t2;
|
|
|
|
#
|
|
# Now let us check how well we replicate various CURRENT_* functions
|
|
#
|
|
connection master;
|
|
delete from t2;
|
|
set timestamp=1000072000;
|
|
insert into t2 values (current_timestamp), (current_date), (current_time);
|
|
sync_slave_with_master;
|
|
# Values in ouput of these to queries should differ because we are in
|
|
# in 'MET' on master and in 'Europe/Moscow on slave...
|
|
set timestamp=1000072000;
|
|
select current_timestamp, current_date, current_time;
|
|
select * from t2;
|
|
|
|
#
|
|
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
|
|
#
|
|
connection master;
|
|
delete from t2;
|
|
insert into t2 values (from_unixtime(1000000000)),
|
|
(unix_timestamp('2001-09-09 03:46:40'));
|
|
select * from t2;
|
|
sync_slave_with_master;
|
|
# We should get same result on slave as on master
|
|
select * from t2;
|
|
|
|
#
|
|
# Let us check that we are not allowing to set global time_zone with
|
|
# replication
|
|
#
|
|
connection master;
|
|
--error 1387
|
|
set global time_zone='MET';
|
|
|
|
# Clean up
|
|
drop table t1, t2;
|
|
sync_slave_with_master;
|