Commit 76a16607 authored by peter@mysql.com's avatar peter@mysql.com

Merge mysql.com:/home/pz/mysql/mysql-4.1-root

into mysql.com:/home/pz/mysql/mysql-4.1
parents 03f97c19 fef10d9b
...@@ -30,7 +30,7 @@ dist-hook: ...@@ -30,7 +30,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r $(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
install-data-local: install-data-local:
$(mkinstalldirs) \ $(mkinstalldirs) \
......
reset master; reset master;
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79 master-bin.000001 79
reset slave; reset slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4 127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4
change master to master_host='127.0.0.1',master_user='root', change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT; master_password='',master_port=MASTER_PORT;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4 127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4
start slave; start slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 7 master-bin.001 79 slave-relay-bin.001 120 master-bin.001 Yes Yes 0 0 79 120 127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values (10),(45),(90); insert into t1 values (10),(45),(90);
......
...@@ -2,8 +2,8 @@ reset slave; ...@@ -2,8 +2,8 @@ reset slave;
start slave; start slave;
show binary logs; show binary logs;
Log_name Log_name
master-bin.001 master-bin.000001
master-bin.002 master-bin.000002
drop table if exists t1; drop table if exists t1;
create table t1(n int); create table t1(n int);
insert into t1 values (3351); insert into t1 values (3351);
......
...@@ -14,4 +14,4 @@ start slave; ...@@ -14,4 +14,4 @@ start slave;
flush logs; flush logs;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.001 119 slave-bin.001 Yes Yes 0 0 79 119 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000001 122 slave-bin.000001 Yes Yes 0 0 79 122
...@@ -16,25 +16,25 @@ load data infile '../../std_data/words.dat' into table t1; ...@@ -16,25 +16,25 @@ load data infile '../../std_data/words.dat' into table t1;
drop table t1; drop table t1;
show binlog events; show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 172 INSERT_ID=1 master-bin.000001 172 Intvar 1 172 INSERT_ID=1
master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL) master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
master-bin.001 263 Query 1 263 use `test`; drop table t1 master-bin.000001 263 Query 1 263 use `test`; drop table t1
master-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null) master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81 master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
master-bin.001 556 Exec_load 1 556 ;file_id=1 master-bin.000001 556 Exec_load 1 556 ;file_id=1
master-bin.001 579 Query 1 579 use `test`; drop table t1 master-bin.000001 579 Query 1 579 use `test`; drop table t1
show binlog events from 79 limit 1; show binlog events from 79 limit 1;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 79 limit 2; show binlog events from 79 limit 2;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 172 INSERT_ID=1 master-bin.000001 172 Intvar 1 172 INSERT_ID=1
show binlog events from 79 limit 2,1; show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL) master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs; flush logs;
start slave; start slave;
flush logs; flush logs;
...@@ -44,49 +44,49 @@ insert into t1 values (1); ...@@ -44,49 +44,49 @@ insert into t1 values (1);
drop table t1; drop table t1;
show binlog events; show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 172 INSERT_ID=1 master-bin.000001 172 Intvar 1 172 INSERT_ID=1
master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL) master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
master-bin.001 263 Query 1 263 use `test`; drop table t1 master-bin.000001 263 Query 1 263 use `test`; drop table t1
master-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null) master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81 master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
master-bin.001 556 Exec_load 1 556 ;file_id=1 master-bin.000001 556 Exec_load 1 556 ;file_id=1
master-bin.001 579 Query 1 579 use `test`; drop table t1 master-bin.000001 579 Query 1 579 use `test`; drop table t1
master-bin.001 627 Rotate 1 627 master-bin.002;pos=4 master-bin.000001 627 Rotate 1 627 master-bin.000002;pos=4
show binlog events in 'master-bin.002'; show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 4 Query 1 4 use `test`; create table t1 (n int) master-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
master-bin.002 62 Query 1 62 use `test`; insert into t1 values (1) master-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
master-bin.002 122 Query 1 122 use `test`; drop table t1 master-bin.000002 122 Query 1 122 use `test`; drop table t1
show binary logs; show binary logs;
Log_name Log_name
master-bin.001 master-bin.000001
master-bin.002 master-bin.000002
start slave; start slave;
show binary logs; show binary logs;
Log_name Log_name
slave-bin.001 slave-bin.000001
slave-bin.002 slave-bin.000002
show binlog events in 'slave-bin.001' from 4; show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3 slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
slave-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key) slave-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.001 172 Intvar 1 200 INSERT_ID=1 slave-bin.000001 172 Intvar 1 200 INSERT_ID=1
slave-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL) slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.001 263 Query 1 263 use `test`; drop table t1 slave-bin.000001 263 Query 1 263 use `test`; drop table t1
slave-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null) slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81 slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
slave-bin.001 565 Exec_load 1 556 ;file_id=1 slave-bin.000001 565 Exec_load 1 556 ;file_id=1
slave-bin.001 588 Query 1 579 use `test`; drop table t1 slave-bin.000001 588 Query 1 579 use `test`; drop table t1
slave-bin.001 636 Rotate 2 636 slave-bin.002;pos=4 slave-bin.000001 636 Rotate 2 636 slave-bin.000002;pos=4
show binlog events in 'slave-bin.002' from 4; show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.002 4 Query 1 4 use `test`; create table t1 (n int) slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
slave-bin.002 62 Query 1 62 use `test`; insert into t1 values (1) slave-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.002 122 Query 1 122 use `test`; drop table t1 slave-bin.000002 122 Query 1 122 use `test`; drop table t1
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961 127.0.0.1 root MASTER_PORT 1 master-bin.000002 170 slave-relay-bin.000002 969 master-bin.000002 Yes Yes 0 0 170 973
show binlog events in 'slave-bin.005' from 4; show binlog events in 'slave-bin.000005' from 4;
Error when executing command SHOW BINLOG EVENTS: Could not find target log Error when executing command SHOW BINLOG EVENTS: Could not find target log
...@@ -6,28 +6,28 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ...@@ -6,28 +6,28 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79 master-bin.000001 79
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127
change master to master_log_pos=73; change master to master_log_pos=73;
stop slave; stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No No 0 0 73 4 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4
start slave; start slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4
change master to master_log_pos=173; change master to master_log_pos=173;
start slave; start slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4 127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79 master-bin.000001 79
create table if not exists t1 (n int); create table if not exists t1 (n int);
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
......
...@@ -15,7 +15,7 @@ create table t1 (s text); ...@@ -15,7 +15,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard'); insert into t1 values('Could not break slave'),('Tried hard');
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 60 master-bin.001 417 slave-relay-bin.001 458 master-bin.001 Yes Yes 0 0 417 458 127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461
select * from t1; select * from t1;
s s
Could not break slave Could not break slave
...@@ -27,9 +27,9 @@ insert into t2 values (34),(67),(123); ...@@ -27,9 +27,9 @@ insert into t2 values (34),(67),(123);
flush logs; flush logs;
show binary logs; show binary logs;
Log_name Log_name
master-bin.001 master-bin.000001
master-bin.002 master-bin.000002
master-bin.003 master-bin.000003
create table t3 select * from temp_table; create table t3 select * from temp_table;
select * from t3; select * from t3;
a a
...@@ -40,14 +40,14 @@ set insert_id=1234; ...@@ -40,14 +40,14 @@ set insert_id=1234;
insert into t2 values(NULL); insert into t2 values(NULL);
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
start slave; start slave;
purge master logs to 'master-bin.003'; purge master logs to 'master-bin.000003';
show binary logs; show binary logs;
Log_name Log_name
master-bin.003 master-bin.000003
insert into t2 values (65); insert into t2 values (65);
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 60 master-bin.003 290 slave-relay-bin.001 1073 master-bin.003 Yes Yes 0 0 290 1073 127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088
select * from t2; select * from t2;
m m
34 34
...@@ -62,19 +62,19 @@ create table t3 (n int); ...@@ -62,19 +62,19 @@ create table t3 (n int);
create table t4 select * from temp_table; create table t4 select * from temp_table;
show binary logs; show binary logs;
Log_name Log_name
master-bin.003 master-bin.000003
master-bin.004 master-bin.000004
master-bin.005 master-bin.000005
master-bin.006 master-bin.000006
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.006 838 master-bin.000006 838
select * from t4; select * from t4;
a a
testing temporary tables part 2 testing temporary tables part 2
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 60 master-bin.006 838 slave-relay-bin.001 8034 master-bin.006 Yes Yes 0 0 838 8034 127.0.0.1 root MASTER_PORT 60 master-bin.000006 838 slave-relay-bin.000001 8067 master-bin.000006 Yes Yes 0 0 838 8067
lock tables t3 read; lock tables t3 read;
select count(*) from t3 where n >= 4; select count(*) from t3 where n >= 4;
count(*) count(*)
......
rm -f $MYSQL_TEST_DIR/var/log/*relay* rm -f $MYSQL_TEST_DIR/var/log/*relay*
rm -f $MYSQL_TEST_DIR/var/slave-data/relay-log.info rm -f $MYSQL_TEST_DIR/var/slave-data/relay-log.info
cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF
master-bin.001 master-bin.000001
4 4
127.0.0.1 127.0.0.1
replicate replicate
......
...@@ -39,7 +39,7 @@ insert into t1 values (1); ...@@ -39,7 +39,7 @@ insert into t1 values (1);
drop table t1; drop table t1;
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
show binlog events; show binlog events;
show binlog events in 'master-bin.002'; show binlog events in 'master-bin.000002';
show binary logs; show binary logs;
save_master_pos; save_master_pos;
connection slave; connection slave;
...@@ -47,19 +47,19 @@ start slave; ...@@ -47,19 +47,19 @@ start slave;
sync_with_master; sync_with_master;
show binary logs; show binary logs;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
show binlog events in 'slave-bin.001' from 4; show binlog events in 'slave-bin.000001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
show binlog events in 'slave-bin.002' from 4; show binlog events in 'slave-bin.000002' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
# Need to recode the following # Need to recode the following
#show new master for slave with master_log_file='master-bin.001' and master_log_pos=4 and master_server_id=1; #show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.001' and master_log_pos=79 and master_server_id=1; #show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.001' and master_log_pos=311 and master_server_id=1; #show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.002' and master_log_pos=4 and master_server_id=1; #show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.002' and master_log_pos=122 and master_server_id=1; #show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
--error 1220 --error 1220
show binlog events in 'slave-bin.005' from 4; show binlog events in 'slave-bin.000005' from 4;
...@@ -86,7 +86,7 @@ connection master; ...@@ -86,7 +86,7 @@ connection master;
#let slave catch up #let slave catch up
sync_slave_with_master; sync_slave_with_master;
connection master; connection master;
purge master logs to 'master-bin.003'; purge master logs to 'master-bin.000003';
show binary logs; show binary logs;
insert into t2 values (65); insert into t2 values (65);
sync_slave_with_master; sync_slave_with_master;
......
...@@ -45,16 +45,19 @@ static bool test_if_number(const char *str, ...@@ -45,16 +45,19 @@ static bool test_if_number(const char *str,
static int find_uniq_filename(char *name) static int find_uniq_filename(char *name)
{ {
long number; long number;
uint i,length; uint i;
char buff[FN_REFLEN]; char buff[FN_REFLEN];
struct st_my_dir *dir_info; struct st_my_dir *dir_info;
reg1 struct fileinfo *file_info; reg1 struct fileinfo *file_info;
ulong max_found=0; ulong max_found=0;
DBUG_ENTER("find_uniq_filename"); DBUG_ENTER("find_uniq_filename");
length=dirname_part(buff,name); uint length = dirname_part(buff,name);
char *start=name+length,*end=strend(start); char *start = name + length;
char *end = strend(start);
*end='.'; *end='.';
length= (uint) (end-start+1); length= (uint) (end-start+1);
...@@ -75,7 +78,7 @@ static int find_uniq_filename(char *name) ...@@ -75,7 +78,7 @@ static int find_uniq_filename(char *name)
my_dirend(dir_info); my_dirend(dir_info);
*end++='.'; *end++='.';
sprintf(end,"%03ld",max_found+1); sprintf(end,"%06ld",max_found+1);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -126,6 +126,7 @@ const char* Log_event::get_type_str() ...@@ -126,6 +126,7 @@ const char* Log_event::get_type_str()
case APPEND_BLOCK_EVENT: return "Append_block"; case APPEND_BLOCK_EVENT: return "Append_block";
case DELETE_FILE_EVENT: return "Delete_file"; case DELETE_FILE_EVENT: return "Delete_file";
case EXEC_LOAD_EVENT: return "Exec_load"; case EXEC_LOAD_EVENT: return "Exec_load";
case RAND_EVENT: return "RAND";
default: /* impossible */ return "Unknown"; default: /* impossible */ return "Unknown";
} }
} }
......
This diff is collapsed.
...@@ -7,22 +7,28 @@ ...@@ -7,22 +7,28 @@
#define MAX_SLAVE_ERRMSG 1024 #define MAX_SLAVE_ERRMSG 1024
#define MAX_SLAVE_ERROR 2000 #define MAX_SLAVE_ERROR 2000
/* /*****************************************************************************
The replication is accomplished by starting two threads - I/O
thread, and SQL thread. I/O thread is associated with its MySQL Replication
MASTER_INFO struct, so MASTER_INFO can be viewed as I/O thread
descriptor. SQL thread is associated with RELAY_LOG_INFO struct. Replication is implemented via two types of threads:
I/O thread reads maintains a connection to the master, and reads log I/O Thread - One of these threads is started for each master server.
events from the master as they arrive, queueing them by writing them They maintain a connection to their master server, read log
out into the temporary slave binary log (relay log). The SQL thread, events from the master as they arrive, and queues them into
in turn, reads the slave binary log executing each event. a single, shared relay log file. A MASTER_INFO struct
represents each of these threads.
Relay log is needed to be able to handle situations when there is a large
backlog of unprocessed events from the master (eg. one particular update SQL Thread - One of these threads is started and reads from the relay log
takes a day to finish), and to be able to restart the slave server without file, executing each event. A RELAY_LOG_INFO struct
having to re-read the master updates. represents this thread.
*/
Buffering in the relay log file makes it unnecessary to reread events from
a master server across a slave restart. It also decouples the slave from
the master where long-running updates and event logging are concerned--ie
it can continue to log new events while a slow query executes on the slave.
*****************************************************************************/
extern ulong slave_net_timeout, master_retry_count; extern ulong slave_net_timeout, master_retry_count;
extern MY_BITMAP slave_error_mask; extern MY_BITMAP slave_error_mask;
...@@ -48,11 +54,16 @@ struct st_master_info; ...@@ -48,11 +54,16 @@ struct st_master_info;
--active_mi_in_use; \ --active_mi_in_use; \
pthread_mutex_unlock(&LOCK_active_mi); } pthread_mutex_unlock(&LOCK_active_mi); }
/* /*****************************************************************************
st_relay_log_info contains information on the current relay log and
relay log offset, and master log name and log sequence corresponding to the Replication SQL Thread
last update. Additionally, misc information specific to the SQL thread is
included. st_relay_log_info contains:
- the current relay log
- the current relay log offset
- master log name
- master log sequence corresponding to the last update
- misc information specific to the SQL thread
st_relay_log_info is initialized from the slave.info file if such exists. st_relay_log_info is initialized from the slave.info file if such exists.
Otherwise, data members are intialized with defaults. The initialization is Otherwise, data members are intialized with defaults. The initialization is
...@@ -66,7 +77,8 @@ struct st_master_info; ...@@ -66,7 +77,8 @@ struct st_master_info;
master_log_pos master_log_pos
To clean up, call end_relay_log_info() To clean up, call end_relay_log_info()
*/
*****************************************************************************/
typedef struct st_relay_log_info typedef struct st_relay_log_info
{ {
...@@ -128,13 +140,18 @@ typedef struct st_relay_log_info ...@@ -128,13 +140,18 @@ typedef struct st_relay_log_info
uint32 cur_log_old_open_count; uint32 cur_log_old_open_count;
/* /*
Current offset in the relay log. relay_log_pos - Current offset in the relay log.
pending - in some cases we do not increment offset immediately after pending - In some cases we do not increment offset immediately
processing an event, because the following event needs to be processed after processing an event, because the following event
atomically together with this one ( so far, there is only one type of needs to be processed atomically together with this one
such event - Intvar_event that sets auto_increment value). However, once such as:
both events have been processed, we need to increment by the cumulative
offset. pending stored the extra offset to be added to the position. Intvar_event - sets auto_increment value
Rand_event - sets the random seed
However, once both events have been processed, we need to
increment by the cumulative offset. 'pending' stores the
extra offset to be added to the position.
*/ */
ulonglong relay_log_pos, pending; ulonglong relay_log_pos, pending;
ulonglong log_space_limit,log_space_total; ulonglong log_space_limit,log_space_total;
...@@ -230,10 +247,15 @@ typedef struct st_relay_log_info ...@@ -230,10 +247,15 @@ typedef struct st_relay_log_info
Log_event* next_event(RELAY_LOG_INFO* rli); Log_event* next_event(RELAY_LOG_INFO* rli);
/* /*****************************************************************************
st_master_info contains information about how to connect to a master,
current master log name, and current log offset, as well as misc Replication IO Thread
control variables
st_master_info contains:
- information about how to connect to a master
- current master log name
- current master log offset
- misc control variables
st_master_info is initialized once from the master.info file if such st_master_info is initialized once from the master.info file if such
exists. Otherwise, data members corresponding to master.info fields exists. Otherwise, data members corresponding to master.info fields
...@@ -255,9 +277,9 @@ Log_event* next_event(RELAY_LOG_INFO* rli); ...@@ -255,9 +277,9 @@ Log_event* next_event(RELAY_LOG_INFO* rli);
flush_master_info() is required. flush_master_info() is required.
To clean up, call end_master_info() To clean up, call end_master_info()
*/
*****************************************************************************/
typedef struct st_master_info typedef struct st_master_info
{ {
char master_log_name[FN_REFLEN]; char master_log_name[FN_REFLEN];
......
...@@ -108,6 +108,7 @@ THD::THD():user_time(0), fatal_error(0), ...@@ -108,6 +108,7 @@ THD::THD():user_time(0), fatal_error(0),
file_id = 0; file_id = 0;
cond_count=0; cond_count=0;
db_charset=default_charset_info; db_charset=default_charset_info;
thd_charset=default_charset_info;
mysys_var=0; mysys_var=0;
#ifndef DBUG_OFF #ifndef DBUG_OFF
dbug_sentry=THD_SENTRY_MAGIC; dbug_sentry=THD_SENTRY_MAGIC;
......
...@@ -481,6 +481,7 @@ public: ...@@ -481,6 +481,7 @@ public:
table_map used_tables; table_map used_tables;
USER_CONN *user_connect; USER_CONN *user_connect;
CHARSET_INFO *db_charset; CHARSET_INFO *db_charset;
CHARSET_INFO *thd_charset;
List <MYSQL_ERROR> warn_list; List <MYSQL_ERROR> warn_list;
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END]; uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
uint total_warn_count, old_total_warn_count; uint total_warn_count, old_total_warn_count;
......
...@@ -592,7 +592,7 @@ bool mysql_change_db(THD *thd, const char *name) ...@@ -592,7 +592,7 @@ bool mysql_change_db(THD *thd, const char *name)
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE); strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
load_db_opt(path, &create); load_db_opt(path, &create);
thd->db_charset=create.table_charset; thd->db_charset=create.table_charset;
thd->thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -3309,13 +3309,13 @@ opt_ignore_lines: ...@@ -3309,13 +3309,13 @@ opt_ignore_lines:
/* Common definitions */ /* Common definitions */
text_literal: text_literal:
TEXT_STRING { $$ = new Item_string($1.str,$1.length,default_charset_info); } TEXT_STRING { $$ = new Item_string($1.str,$1.length,current_thd->thd_charset); }
| UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); } | UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); }
| text_literal TEXT_STRING | text_literal TEXT_STRING
{ ((Item_string*) $1)->append($2.str,$2.length); }; { ((Item_string*) $1)->append($2.str,$2.length); };
text_string: text_string:
TEXT_STRING { $$= new String($1.str,$1.length,default_charset_info); } TEXT_STRING { $$= new String($1.str,$1.length,current_thd->thd_charset); }
| HEX_NUM | HEX_NUM
{ {
Item *tmp = new Item_varbinary($1.str,$1.length); Item *tmp = new Item_varbinary($1.str,$1.length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment