Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
76a16607
Commit
76a16607
authored
Oct 30, 2002
by
peter@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/pz/mysql/mysql-4.1-root
into mysql.com:/home/pz/mysql/mysql-4.1
parents
03f97c19
fef10d9b
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
449 additions
and
176 deletions
+449
-176
mysql-test/Makefile.am
mysql-test/Makefile.am
+1
-1
mysql-test/r/rpl000015.result
mysql-test/r/rpl000015.result
+4
-4
mysql-test/r/rpl000018.result
mysql-test/r/rpl000018.result
+2
-2
mysql-test/r/rpl_flush_log_loop.result
mysql-test/r/rpl_flush_log_loop.result
+1
-1
mysql-test/r/rpl_log.result
mysql-test/r/rpl_log.result
+48
-48
mysql-test/r/rpl_log_pos.result
mysql-test/r/rpl_log_pos.result
+6
-6
mysql-test/r/rpl_rotate_logs.result
mysql-test/r/rpl_rotate_logs.result
+13
-13
mysql-test/std_data/master-bin.000001
mysql-test/std_data/master-bin.000001
+0
-0
mysql-test/t/rpl000017-slave.sh
mysql-test/t/rpl000017-slave.sh
+1
-1
mysql-test/t/rpl_log.test
mysql-test/t/rpl_log.test
+9
-9
mysql-test/t/rpl_rotate_logs.test
mysql-test/t/rpl_rotate_logs.test
+1
-1
sql/log.cc
sql/log.cc
+11
-8
sql/log_event.cc
sql/log_event.cc
+1
-0
sql/slave.cc
sql/slave.cc
+289
-44
sql/slave.h
sql/slave.h
+57
-35
sql/sql_class.cc
sql/sql_class.cc
+1
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_db.cc
sql/sql_db.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
mysql-test/Makefile.am
View file @
76a16607
...
...
@@ -30,7 +30,7 @@ dist-hook:
$(INSTALL_DATA)
$(srcdir)
/t/
*
.test
$(srcdir)
/t/
*
.opt
$(srcdir)
/t/
*
.sh
$(distdir)
/t
$(INSTALL_DATA)
$(srcdir)
/include/
*
.inc
$(distdir)
/include
$(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/
*
.00
000
1
$(distdir)
/std_data
install-data-local
:
$(mkinstalldirs)
\
...
...
mysql-test/r/rpl000015.result
View file @
76a16607
reset master;
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79
master-bin.00
000
1 79
reset slave;
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
change master to master_host='127.0.0.1';
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
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.00
000
1 4 No No 0 0 0 4
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
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
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.00
000
1 4 No No 0 0 0 4
start slave;
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
127.0.0.1 root MASTER_PORT 7 master-bin.00
1 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.00
0001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
...
...
mysql-test/r/rpl000018.result
View file @
76a16607
...
...
@@ -2,8 +2,8 @@ reset slave;
start slave;
show binary logs;
Log_name
master-bin.001
master-bin.002
master-bin.00
000
1
master-bin.00
000
2
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
...
...
mysql-test/r/rpl_flush_log_loop.result
View file @
76a16607
...
...
@@ -14,4 +14,4 @@ start slave;
flush logs;
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
127.0.0.1 root SLAVE_PORT 60 slave-bin.00
1 79 relay-log.001 119 slave-bin.001 Yes Yes 0 0 79 119
127.0.0.1 root SLAVE_PORT 60 slave-bin.00
0001 79 relay-log.000001 122 slave-bin.000001 Yes Yes 0 0 79 122
mysql-test/r/rpl_log.result
View file @
76a16607
...
...
@@ -16,25 +16,25 @@ load data infile '../../std_data/words.dat' into table t1;
drop table t1;
show binlog events;
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.001 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.001 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.001 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.001 556 Exec_load 1 556 ;file_id=1
master-bin.001 579 Query 1 579 use `test`; drop table t1
master-bin.00
000
1 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.00
000
1 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.00
000
1 172 Intvar 1 172 INSERT_ID=1
master-bin.00
000
1 200 Query 1 200 use `test`; insert into t1 values (NULL)
master-bin.00
000
1 263 Query 1 263 use `test`; drop table t1
master-bin.00
000
1 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.00
000
1 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
master-bin.00
000
1 556 Exec_load 1 556 ;file_id=1
master-bin.00
000
1 579 Query 1 579 use `test`; drop table t1
show binlog events from 79 limit 1;
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.00
000
1 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 79 limit 2;
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.001 172 Intvar 1 172 INSERT_ID=1
master-bin.00
000
1 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.00
000
1 172 Intvar 1 172 INSERT_ID=1
show binlog events from 79 limit 2,1;
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.00
000
1 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs;
start slave;
flush logs;
...
...
@@ -44,49 +44,49 @@ insert into t1 values (1);
drop table t1;
show binlog events;
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.001 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.001 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.001 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.001 556 Exec_load 1 556 ;file_id=1
master-bin.001 579 Query 1 579 use `test`; drop table t1
master-bin.00
1 627 Rotate 1 627 master-bin.
002;pos=4
show binlog events in 'master-bin.002';
master-bin.00
000
1 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.00
000
1 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.00
000
1 172 Intvar 1 172 INSERT_ID=1
master-bin.00
000
1 200 Query 1 200 use `test`; insert into t1 values (NULL)
master-bin.00
000
1 263 Query 1 263 use `test`; drop table t1
master-bin.00
000
1 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.00
000
1 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
master-bin.00
000
1 556 Exec_load 1 556 ;file_id=1
master-bin.00
000
1 579 Query 1 579 use `test`; drop table t1
master-bin.00
0001 627 Rotate 1 627 master-bin.000
002;pos=4
show binlog events in 'master-bin.00
000
2';
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.002 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.00
000
2 4 Query 1 4 use `test`; create table t1 (n int)
master-bin.00
000
2 62 Query 1 62 use `test`; insert into t1 values (1)
master-bin.00
000
2 122 Query 1 122 use `test`; drop table t1
show binary logs;
Log_name
master-bin.001
master-bin.002
master-bin.00
000
1
master-bin.00
000
2
start slave;
show binary logs;
Log_name
slave-bin.001
slave-bin.002
show binlog events in 'slave-bin.001' from 4;
slave-bin.00
000
1
slave-bin.00
000
2
show binlog events in 'slave-bin.00
000
1' from 4;
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.001 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.001 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.001 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.001 565 Exec_load 1 556 ;file_id=1
slave-bin.001 588 Query 1 579 use `test`; drop table t1
slave-bin.00
1 636 Rotate 2 636 slave-bin.
002;pos=4
show binlog events in 'slave-bin.002' from 4;
slave-bin.00
000
1 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
slave-bin.00
000
1 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.00
000
1 172 Intvar 1 200 INSERT_ID=1
slave-bin.00
000
1 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.00
000
1 263 Query 1 263 use `test`; drop table t1
slave-bin.00
000
1 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.00
000
1 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
slave-bin.00
000
1 565 Exec_load 1 556 ;file_id=1
slave-bin.00
000
1 588 Query 1 579 use `test`; drop table t1
slave-bin.00
0001 636 Rotate 2 636 slave-bin.000
002;pos=4
show binlog events in 'slave-bin.00
000
2' from 4;
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.002 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.00
000
2 4 Query 1 4 use `test`; create table t1 (n int)
slave-bin.00
000
2 62 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.00
000
2 122 Query 1 122 use `test`; drop table t1
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
127.0.0.1 root MASTER_PORT 1 master-bin.00
2 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961
show binlog events in 'slave-bin.005' from 4;
127.0.0.1 root MASTER_PORT 1 master-bin.00
0002 170 slave-relay-bin.000002 969 master-bin.000002 Yes Yes 0 0 170 973
show binlog events in 'slave-bin.00
000
5' from 4;
Error when executing command SHOW BINLOG EVENTS: Could not find target log
mysql-test/r/rpl_log_pos.result
View file @
76a16607
...
...
@@ -6,28 +6,28 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79
master-bin.00
000
1 79
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
127.0.0.1 root MASTER_PORT 1 master-bin.00
1 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.00
0001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127
change master to master_log_pos=73;
stop slave;
change master to master_log_pos=73;
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
127.0.0.1 root MASTER_PORT 1 master-bin.00
1 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.00
0001 73 slave-relay-bin.000001 4 master-bin.000
001 No No 0 0 73 4
start slave;
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
127.0.0.1 root MASTER_PORT 1 master-bin.00
1 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.00
0001 73 slave-relay-bin.000001 4 master-bin.000
001 No Yes 0 0 73 4
change master to master_log_pos=173;
start slave;
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
127.0.0.1 root MASTER_PORT 1 master-bin.00
1 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.00
0001 173 slave-relay-bin.000001 4 master-bin.000
001 No Yes 0 0 173 4
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79
master-bin.00
000
1 79
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
...
...
mysql-test/r/rpl_rotate_logs.result
View file @
76a16607
...
...
@@ -15,7 +15,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
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
127.0.0.1 root MASTER_PORT 60 master-bin.00
1 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.00
0001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461
select * from t1;
s
Could not break slave
...
...
@@ -27,9 +27,9 @@ insert into t2 values (34),(67),(123);
flush logs;
show binary logs;
Log_name
master-bin.001
master-bin.002
master-bin.003
master-bin.00
000
1
master-bin.00
000
2
master-bin.00
000
3
create table t3 select * from temp_table;
select * from t3;
a
...
...
@@ -40,14 +40,14 @@ set insert_id=1234;
insert into t2 values(NULL);
set global sql_slave_skip_counter=1;
start slave;
purge master logs to 'master-bin.003';
purge master logs to 'master-bin.00
000
3';
show binary logs;
Log_name
master-bin.003
master-bin.00
000
3
insert into t2 values (65);
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
127.0.0.1 root MASTER_PORT 60 master-bin.00
3 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.00
0003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088
select * from t2;
m
34
...
...
@@ -62,19 +62,19 @@ create table t3 (n int);
create table t4 select * from temp_table;
show binary logs;
Log_name
master-bin.003
master-bin.004
master-bin.005
master-bin.006
master-bin.00
000
3
master-bin.00
000
4
master-bin.00
000
5
master-bin.00
000
6
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.006 838
master-bin.00
000
6 838
select * from t4;
a
testing temporary tables part 2
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
127.0.0.1 root MASTER_PORT 60 master-bin.00
6 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.00
0006 838 slave-relay-bin.000001 8067 master-bin.000006 Yes Yes 0 0 838 8067
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
...
...
mysql-test/std_data/master-bin.000001
0 → 100644
View file @
76a16607
File added
mysql-test/t/rpl000017-slave.sh
View file @
76a16607
rm
-f
$MYSQL_TEST_DIR
/var/log/
*
relay
*
rm
-f
$MYSQL_TEST_DIR
/var/slave-data/relay-log.info
cat
>
$MYSQL_TEST_DIR
/var/slave-data/master.info
<<
EOF
master-bin.001
master-bin.00
000
1
4
127.0.0.1
replicate
...
...
mysql-test/t/rpl_log.test
View file @
76a16607
...
...
@@ -39,7 +39,7 @@ insert into t1 values (1);
drop
table
t1
;
--
replace_result
$VERSION
VERSION
show
binlog
events
;
show
binlog
events
in
'master-bin.002'
;
show
binlog
events
in
'master-bin.00
000
2'
;
show
binary
logs
;
save_master_pos
;
connection
slave
;
...
...
@@ -47,19 +47,19 @@ start slave;
sync_with_master
;
show
binary
logs
;
--
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.00
000
1'
from
4
;
--
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.00
000
2'
from
4
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
# 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.001' 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.002' 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.00
000
1' and master_log_pos=4 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.00
000
1' and master_log_pos=79 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.00
000
1' and master_log_pos=311 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.00
000
2' and master_log_pos=4 and master_server_id=1;
#show new master for slave with master_log_file='master-bin.00
000
2' and master_log_pos=122 and master_server_id=1;
--
error
1220
show
binlog
events
in
'slave-bin.005'
from
4
;
show
binlog
events
in
'slave-bin.00
000
5'
from
4
;
mysql-test/t/rpl_rotate_logs.test
View file @
76a16607
...
...
@@ -86,7 +86,7 @@ connection master;
#let slave catch up
sync_slave_with_master
;
connection
master
;
purge
master
logs
to
'master-bin.003'
;
purge
master
logs
to
'master-bin.00
000
3'
;
show
binary
logs
;
insert
into
t2
values
(
65
);
sync_slave_with_master
;
...
...
sql/log.cc
View file @
76a16607
...
...
@@ -45,16 +45,19 @@ static bool test_if_number(const char *str,
static
int
find_uniq_filename
(
char
*
name
)
{
long
number
;
uint
i
,
length
;
char
buff
[
FN_REFLEN
];
struct
st_my_dir
*
dir_info
;
long
number
;
uint
i
;
char
buff
[
FN_REFLEN
];
struct
st_my_dir
*
dir_info
;
reg1
struct
fileinfo
*
file_info
;
ulong
max_found
=
0
;
ulong
max_found
=
0
;
DBUG_ENTER
(
"find_uniq_filename"
);
length
=
dirname_part
(
buff
,
name
);
char
*
start
=
name
+
length
,
*
end
=
strend
(
start
);
uint
length
=
dirname_part
(
buff
,
name
);
char
*
start
=
name
+
length
;
char
*
end
=
strend
(
start
);
*
end
=
'.'
;
length
=
(
uint
)
(
end
-
start
+
1
);
...
...
@@ -75,7 +78,7 @@ static int find_uniq_filename(char *name)
my_dirend
(
dir_info
);
*
end
++=
'.'
;
sprintf
(
end
,
"%0
3
ld"
,
max_found
+
1
);
sprintf
(
end
,
"%0
6
ld"
,
max_found
+
1
);
DBUG_RETURN
(
0
);
}
...
...
sql/log_event.cc
View file @
76a16607
...
...
@@ -126,6 +126,7 @@ const char* Log_event::get_type_str()
case
APPEND_BLOCK_EVENT
:
return
"Append_block"
;
case
DELETE_FILE_EVENT
:
return
"Delete_file"
;
case
EXEC_LOAD_EVENT
:
return
"Exec_load"
;
case
RAND_EVENT
:
return
"RAND"
;
default:
/* impossible */
return
"Unknown"
;
}
}
...
...
sql/slave.cc
View file @
76a16607
This diff is collapsed.
Click to expand it.
sql/slave.h
View file @
76a16607
...
...
@@ -7,22 +7,28 @@
#define MAX_SLAVE_ERRMSG 1024
#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
MASTER_INFO struct, so MASTER_INFO can be viewed as I/O thread
descriptor. SQL thread is associated with RELAY_LOG_INFO struct.
I/O thread reads maintains a connection to the master, and reads log
events from the master as they arrive, queueing them by writing them
out into the temporary slave binary log (relay log). The SQL thread,
in turn, reads the slave binary log executing each event.
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
takes a day to finish), and to be able to restart the slave server without
having to re-read the master updates.
*/
/*****************************************************************************
MySQL Replication
Replication is implemented via two types of threads:
I/O Thread - One of these threads is started for each master server.
They maintain a connection to their master server, read log
events from the master as they arrive, and queues them into
a single, shared relay log file. A MASTER_INFO struct
represents each of these threads.
SQL Thread - One of these threads is started and reads from the relay log
file, executing each event. A RELAY_LOG_INFO struct
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
MY_BITMAP
slave_error_mask
;
...
...
@@ -48,11 +54,16 @@ struct st_master_info;
--active_mi_in_use; \
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
last update. Additionally, misc information specific to the SQL thread is
included.
/*****************************************************************************
Replication SQL Thread
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.
Otherwise, data members are intialized with defaults. The initialization is
...
...
@@ -66,7 +77,8 @@ struct st_master_info;
master_log_pos
To clean up, call end_relay_log_info()
*/
*****************************************************************************/
typedef
struct
st_relay_log_info
{
...
...
@@ -128,13 +140,18 @@ typedef struct st_relay_log_info
uint32
cur_log_old_open_count
;
/*
Current offset in the relay log.
pending - in some cases we do not increment offset immediately after
processing an event, because the following event needs to be processed
atomically together with this one ( so far, there is only one type of
such event - Intvar_event that sets auto_increment value). However, once
both events have been processed, we need to increment by the cumulative
offset. pending stored the extra offset to be added to the position.
relay_log_pos - Current offset in the relay log.
pending - In some cases we do not increment offset immediately
after processing an event, because the following event
needs to be processed atomically together with this one
such as:
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
log_space_limit
,
log_space_total
;
...
...
@@ -230,10 +247,15 @@ typedef struct st_relay_log_info
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
control variables
/*****************************************************************************
Replication IO Thread
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
exists. Otherwise, data members corresponding to master.info fields
...
...
@@ -255,9 +277,9 @@ Log_event* next_event(RELAY_LOG_INFO* rli);
flush_master_info() is required.
To clean up, call end_master_info()
*/
*****************************************************************************/
typedef
struct
st_master_info
{
char
master_log_name
[
FN_REFLEN
];
...
...
sql/sql_class.cc
View file @
76a16607
...
...
@@ -108,6 +108,7 @@ THD::THD():user_time(0), fatal_error(0),
file_id
=
0
;
cond_count
=
0
;
db_charset
=
default_charset_info
;
thd_charset
=
default_charset_info
;
mysys_var
=
0
;
#ifndef DBUG_OFF
dbug_sentry
=
THD_SENTRY_MAGIC
;
...
...
sql/sql_class.h
View file @
76a16607
...
...
@@ -481,6 +481,7 @@ public:
table_map
used_tables
;
USER_CONN
*
user_connect
;
CHARSET_INFO
*
db_charset
;
CHARSET_INFO
*
thd_charset
;
List
<
MYSQL_ERROR
>
warn_list
;
uint
warn_count
[(
uint
)
MYSQL_ERROR
::
WARN_LEVEL_END
];
uint
total_warn_count
,
old_total_warn_count
;
...
...
sql/sql_db.cc
View file @
76a16607
...
...
@@ -592,7 +592,7 @@ bool mysql_change_db(THD *thd, const char *name)
strmov
(
path
+
unpack_dirname
(
path
,
path
),
MY_DB_OPT_FILE
);
load_db_opt
(
path
,
&
create
);
thd
->
db_charset
=
create
.
table_charset
;
thd
->
thd_charset
=
thd
->
db_charset
?
thd
->
db_charset
:
default_charset_info
;
DBUG_RETURN
(
0
);
}
...
...
sql/sql_yacc.yy
View file @
76a16607
...
...
@@ -3309,13 +3309,13 @@ opt_ignore_lines:
/* Common definitions */
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); }
| text_literal TEXT_STRING
{ ((Item_string*) $1)->append($2.str,$2.length); };
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
{
Item *tmp = new Item_varbinary($1.str,$1.length);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment