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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9438655a
Commit
9438655a
authored
Aug 23, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
parents
2d2f5765
6e10224d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
8 deletions
+43
-8
sql/log_event.cc
sql/log_event.cc
+36
-7
sql/slave.cc
sql/slave.cc
+7
-1
No files found.
sql/log_event.cc
View file @
9438655a
...
@@ -2068,9 +2068,6 @@ Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
...
@@ -2068,9 +2068,6 @@ Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
TODO
TODO
- Remove all active user locks
- Remove all active user locks
- If we have an active transaction at this point, the master died
in the middle while writing the transaction to the binary log.
In this case we should stop the slave.
*/
*/
int
Start_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
int
Start_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
...
@@ -2098,7 +2095,9 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -2098,7 +2095,9 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
break
;
break
;
case
BINLOG_FORMAT_323_GEQ_57
:
case
BINLOG_FORMAT_323_GEQ_57
:
/* Can distinguish, based on the value of 'created' */
/* Can distinguish, based on the value of 'created' */
if
(
created
)
/* this was generated at master startup*/
if
(
!
created
)
break
;
/* otherwise this was generated at master startup*/
close_temporary_tables
(
thd
);
close_temporary_tables
(
thd
);
break
;
break
;
default
:
default
:
...
@@ -2156,10 +2155,28 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -2156,10 +2155,28 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli)
We can't rotate the slave as this will cause infinitive rotations
We can't rotate the slave as this will cause infinitive rotations
in a A -> B -> A setup.
in a A -> B -> A setup.
NOTES
As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died while
writing the transaction to the binary log, i.e. while flushing the binlog
cache to the binlog. As the write was started, the transaction had been
committed on the master, so we lack of information to replay this
transaction on the slave; all we can do is stop with error.
If we didn't detect it, then positions would start to become garbage (as we
are incrementing rli->relay_log_pos whereas we are in a transaction: the new
rli->relay_log_pos will be
relay_log_pos of the BEGIN + size of the Rotate event = garbage.
Since MySQL 4.0.14, the master ALWAYS sends a Rotate event when it starts
sending the next binlog, so we are sure to receive a Rotate event just
after the end of the "dead master"'s binlog; so this exec_event() is the
right place to catch the problem. If we would wait until
Start_log_event::exec_event() it would be too late, rli->relay_log_pos would
already be garbage.
RETURN VALUES
RETURN VALUES
0 ok
0 ok
*/
*/
int
Rotate_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
int
Rotate_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
{
{
...
@@ -2167,6 +2184,18 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -2167,6 +2184,18 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
DBUG_ENTER
(
"Rotate_log_event::exec_event"
);
DBUG_ENTER
(
"Rotate_log_event::exec_event"
);
pthread_mutex_lock
(
&
rli
->
data_lock
);
pthread_mutex_lock
(
&
rli
->
data_lock
);
if
(
rli
->
inside_transaction
)
{
slave_print_error
(
rli
,
0
,
"there is an unfinished transaction in the relay log \
(could find neither COMMIT nor ROLLBACK in the relay log); it could be that \
the master died while writing the transaction to its binary log. Now the slave \
is rolling back the transaction."
);
pthread_mutex_unlock
(
&
rli
->
data_lock
);
DBUG_RETURN
(
1
);
}
memcpy
(
log_name
,
new_log_ident
,
ident_len
+
1
);
memcpy
(
log_name
,
new_log_ident
,
ident_len
+
1
);
rli
->
master_log_pos
=
pos
;
rli
->
master_log_pos
=
pos
;
rli
->
relay_log_pos
+=
get_event_len
();
rli
->
relay_log_pos
+=
get_event_len
();
...
...
sql/slave.cc
View file @
9438655a
...
@@ -2260,7 +2260,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
...
@@ -2260,7 +2260,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
}
}
else
else
{
{
s
ql_print_error
(
"\
s
lave_print_error
(
rli
,
0
,
"\
Could not parse relay log event entry. The possible reasons are: the master's \
Could not parse relay log event entry. The possible reasons are: the master's \
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
binary log), the slave's relay log is corrupted (you can check this by running \
binary log), the slave's relay log is corrupted (you can check this by running \
...
@@ -2695,6 +2695,12 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
...
@@ -2695,6 +2695,12 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
DBUG_ASSERT
(
rli
->
slave_running
==
1
);
// tracking buffer overrun
DBUG_ASSERT
(
rli
->
slave_running
==
1
);
// tracking buffer overrun
/* When master_pos_wait() wakes up it will check this and terminate */
/* When master_pos_wait() wakes up it will check this and terminate */
rli
->
slave_running
=
0
;
rli
->
slave_running
=
0
;
/*
Going out of the transaction. Necessary to mark it, in case the user
restarts replication from a non-transactional statement (with CHANGE
MASTER).
*/
rli
->
inside_transaction
=
0
;
/* Wake up master_pos_wait() */
/* Wake up master_pos_wait() */
pthread_mutex_unlock
(
&
rli
->
data_lock
);
pthread_mutex_unlock
(
&
rli
->
data_lock
);
DBUG_PRINT
(
"info"
,(
"Signaling possibly waiting master_pos_wait() functions"
));
DBUG_PRINT
(
"info"
,(
"Signaling possibly waiting master_pos_wait() functions"
));
...
...
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