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
5f31581f
Commit
5f31581f
authored
Oct 13, 2010
by
Luis Soares
Browse files
Options
Browse Files
Download
Plain Diff
BUG 55263: automerged bzr bundle from bug report into
latest mysql-5.1-bugteam.
parents
0e5d43cd
f17cc604
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
5 deletions
+69
-5
sql/rpl_rli.h
sql/rpl_rli.h
+10
-0
sql/slave.cc
sql/slave.cc
+59
-5
No files found.
sql/rpl_rli.h
View file @
5f31581f
...
...
@@ -94,6 +94,16 @@ class Relay_log_info : public Slave_reporting_capability
*/
MYSQL_BIN_LOG
relay_log
;
LOG_INFO
linfo
;
/*
cur_log
Pointer that either points at relay_log.get_log_file() or
&rli->cache_buf, depending on whether the log is hot or there was
the need to open a cold relay_log.
cache_buf
IO_CACHE used when opening cold relay logs.
*/
IO_CACHE
cache_buf
,
*
cur_log
;
/* The following variables are safe to read any time */
...
...
sql/slave.cc
View file @
5f31581f
...
...
@@ -4350,12 +4350,66 @@ static Log_event* next_event(Relay_log_info* rli)
DBUG_ASSERT
(
rli
->
cur_log_fd
==
-
1
);
/*
Read pointer has to be at the start since we are the only
reader.
We must keep the LOCK_log to read the 4 first bytes, as this is a hot
log (same as when we call read_log_event() above: for a hot log we
take the mutex).
When the SQL thread is [stopped and] (re)started the
following may happen:
1. Log was hot at stop time and remains hot at restart
SQL thread reads again from hot_log (SQL thread was
reading from the active log when it was stopped and the
very same log is still active on SQL thread restart).
In this case, my_b_seek is performed on cur_log, while
cur_log points to relay_log.get_log_file();
2. Log was hot at stop time but got cold before restart
The log was hot when SQL thread stopped, but it is not
anymore when the SQL thread restarts.
In this case, the SQL thread reopens the log, using
cache_buf, ie, cur_log points to &cache_buf, and thence
its coordinates are reset.
3. Log was already cold at stop time
The log was not hot when the SQL thread stopped, and, of
course, it will not be hot when it restarts.
In this case, the SQL thread opens the cold log again,
using cache_buf, ie, cur_log points to &cache_buf, and
thence its coordinates are reset.
4. Log was hot at stop time, DBA changes to previous cold
log and restarts SQL thread
The log was hot when the SQL thread was stopped, but the
user changed the coordinates of the SQL thread to
restart from a previous cold log.
In this case, at start time, cur_log points to a cold
log, opened using &cache_buf as cache, and coordinates
are reset. However, as it moves on to the next logs, it
will eventually reach the hot log. If the hot log is the
same at the time the SQL thread was stopped, then
coordinates were not reset - the cur_log will point to
relay_log.get_log_file(), and not a freshly opened
IO_CACHE through cache_buf. For this reason we need to
deploy a my_b_seek before calling check_binlog_magic at
this point of the code (see: BUG#55263 for more
details).
NOTES:
- We must keep the LOCK_log to read the 4 first bytes, as
this is a hot log (same as when we call read_log_event()
above: for a hot log we take the mutex).
- Because of scenario #4 above, we need to have a
my_b_seek here. Otherwise, we might hit the assertion
inside check_binlog_magic.
*/
my_b_seek
(
cur_log
,
(
my_off_t
)
0
);
if
(
check_binlog_magic
(
cur_log
,
&
errmsg
))
{
if
(
!
hot_log
)
pthread_mutex_unlock
(
log_lock
);
...
...
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