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
301a30cb
Commit
301a30cb
authored
Oct 01, 2003
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow-up of an IRC discussion today. Declaring ignore_log_space_limit volatile,
and a comment to explain why.
parent
8d083df3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
sql/slave.h
sql/slave.h
+24
-2
No files found.
sql/slave.h
View file @
301a30cb
...
@@ -170,10 +170,32 @@ typedef struct st_relay_log_info
...
@@ -170,10 +170,32 @@ typedef struct st_relay_log_info
/*
/*
Handling of the relay_log_space_limit optional constraint.
Handling of the relay_log_space_limit optional constraint.
ignore_log_space_limit is used to resolve a deadlock between I/O and SQL
ignore_log_space_limit is used to resolve a deadlock between I/O and SQL
threads, it makes the I/O thread temporarily forget about the constraint
threads, the SQL thread sets it to unblock the I/O thread and make it
temporarily forget about the constraint. It is declared volatile because we
have this loop in the I/O thread (slave.cc):
while (rli->log_space_limit < rli->log_space_total &&
!(slave_killed=io_slave_killed(thd,mi)) &&
!rli->ignore_log_space_limit)
pthread_cond_wait(&rli->log_space_cond, &rli->log_space_lock);
According to Monty, on some systems pthread_cond_wait() could be inline,
and so the loop be optimized by the compiler, so rli->ignore_log_space_limit
could be considered constant and the loop never ends, even if the SQL thread
has set rli->ignore_log_space_limit to 1 (and called
pthread_cond_broadcast()) to break the loop in the I/O thread.
By declaring it volatile, we are sure that the variable will not be
considered constant and that the loop can be broken.
This is the same for all bool variables used by a thread to inform another
thread that something has changed: thd->killed, rli->abort_slave,
MYSQL_LOG::log_type; they are all volatile.
Quoting:
<serg> while (a>0) { wait_for_condition }
<serg> here a should be volatile ?
<monty> serg: in most system no, but on some yes
<serg> on what systems ?
<monty> On any system where pthread_mutex is a macro.
*/
*/
ulonglong
log_space_limit
,
log_space_total
;
ulonglong
log_space_limit
,
log_space_total
;
bool
ignore_log_space_limit
;
volatile
bool
ignore_log_space_limit
;
/*
/*
InnoDB internally stores the master log position it has processed
InnoDB internally stores the master log position it has processed
...
...
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