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
86d31ce9
Commit
86d31ce9
authored
Jun 19, 2017
by
Alexey Yurchenko
Committed by
Jan Lindström
Oct 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MW-384 protect access to wsrep_ready variable with mutex
parent
8da6b4ef
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
23 deletions
+33
-23
scripts/mysql_config.pl
scripts/mysql_config.pl
+3
-3
sql/mysqld.cc
sql/mysqld.cc
+1
-1
sql/slave.cc
sql/slave.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+23
-13
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+2
-1
sql/wsrep_priv.h
sql/wsrep_priv.h
+1
-1
sql/wsrep_sst.cc
sql/wsrep_sst.cc
+0
-1
No files found.
scripts/mysql_config.pl
View file @
86d31ce9
#!/usr/bin/perl
# -*- cperl -*-
#
# Copyright (c) 2007, 201
4
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 201
7
, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
@@ -53,7 +53,7 @@ my $cwd = cwd();
my
$basedir
;
my
$socket
=
'
/tmp/mysql.sock
';
my
$version
=
'
5.5.
3
8
';
my
$version
=
'
5.5.
5
8
';
sub
which
{
...
...
@@ -204,7 +204,7 @@ $flags->{embedded_libs} =
[
@ldflags
,
@lib_e_opts
,'','','','',''];
$flags
->
{
include
}
=
["
-I
$pkgincludedir
"];
$flags
->
{
cflags
}
=
[
@
{
$flags
->
{
include
}},
split
("
",'
-Wall -DWITH_WSREP -DWSREP_PROC_INFO -DMYSQL_MAX_VARIABLE_VALUE_LEN=2048 -DWITH_INNODB_DISALLOW_WRITES -O2 -g -DNDEBUG -DDBUG_OFF
')];
$flags
->
{
cflags
}
=
[
@
{
$flags
->
{
include
}},
split
("
",'')];
# ----------------------------------------------------------------------
# Remove some options that a client doesn't have to care about
...
...
sql/mysqld.cc
View file @
86d31ce9
...
...
@@ -7929,7 +7929,7 @@ SHOW_VAR status_vars[]= {
#endif
#ifdef WITH_WSREP
{
"wsrep_connected"
,
(
char
*
)
&
wsrep_connected
,
SHOW_BOOL
},
{
"wsrep_ready"
,
(
char
*
)
&
wsrep_
ready
,
SHOW_BOOL
},
{
"wsrep_ready"
,
(
char
*
)
&
wsrep_
show_ready
,
SHOW_FUNC
},
{
"wsrep_cluster_state_uuid"
,
(
char
*
)
&
wsrep_cluster_state_uuid
,
SHOW_CHAR_PTR
},
{
"wsrep_cluster_conf_id"
,
(
char
*
)
&
wsrep_cluster_conf_id
,
SHOW_LONGLONG
},
{
"wsrep_cluster_status"
,
(
char
*
)
&
wsrep_cluster_status
,
SHOW_CHAR_PTR
},
...
...
sql/slave.cc
View file @
86d31ce9
...
...
@@ -3794,7 +3794,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
*/
if
(
wsrep_node_dropped
&&
wsrep_restart_slave
)
{
if
(
wsrep_ready
)
if
(
wsrep_ready
_get
()
)
{
WSREP_INFO
(
"Slave error due to node temporarily non-primary"
"SQL slave will continue"
);
...
...
sql/sql_parse.cc
View file @
86d31ce9
...
...
@@ -851,7 +851,7 @@ bool do_command(THD *thd)
* bail out if DB snapshot has not been installed. We however,
* allow queries "SET" and "SHOW", they are trapped later in execute_command
*/
if
(
thd
->
variables
.
wsrep_on
&&
!
thd
->
wsrep_applier
&&
!
wsrep_ready
&&
if
(
thd
->
variables
.
wsrep_on
&&
!
thd
->
wsrep_applier
&&
!
wsrep_ready
_get
()
&&
command
!=
COM_QUERY
&&
command
!=
COM_PING
&&
command
!=
COM_QUIT
&&
...
...
@@ -2382,7 +2382,7 @@ mysql_execute_command(THD *thd)
We additionally allow all other commands that do not change data in
case wsrep_dirty_reads is enabled.
*/
if
(
thd
->
variables
.
wsrep_on
&&
!
thd
->
wsrep_applier
&&
!
wsrep_ready
&&
if
(
thd
->
variables
.
wsrep_on
&&
!
thd
->
wsrep_applier
&&
!
wsrep_ready
_get
()
&&
lex
->
sql_command
!=
SQLCOM_SET_OPTION
&&
!
(
thd
->
variables
.
wsrep_dirty_reads
&&
!
is_update_query
(
lex
->
sql_command
))
&&
...
...
sql/wsrep_mysqld.cc
View file @
86d31ce9
...
...
@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <sql_plugin.h> // SHOW_MY_BOOL
#include <mysqld.h>
#include <sql_class.h>
#include <sql_parse.h>
...
...
@@ -295,7 +296,7 @@ wsrep_view_handler_cb (void* app_ctx,
// version change
if
(
view
->
proto_ver
!=
wsrep_protocol_version
)
{
my_bool
wsrep_ready_saved
=
wsrep_ready
;
my_bool
wsrep_ready_saved
=
wsrep_ready
_get
()
;
wsrep_ready_set
(
FALSE
);
WSREP_INFO
(
"closing client connections for "
"protocol change %ld -> %d"
,
...
...
@@ -409,16 +410,34 @@ wsrep_view_handler_cb (void* app_ctx,
return
WSREP_CB_SUCCESS
;
}
void
wsrep_ready_set
(
my_bool
x
)
my_bool
wsrep_ready_set
(
my_bool
x
)
{
WSREP_DEBUG
(
"Setting wsrep_ready to %d"
,
x
);
if
(
mysql_mutex_lock
(
&
LOCK_wsrep_ready
))
abort
();
if
(
wsrep_ready
!=
x
)
my_bool
ret
=
(
wsrep_ready
!=
x
);
if
(
ret
)
{
wsrep_ready
=
x
;
mysql_cond_signal
(
&
COND_wsrep_ready
);
}
mysql_mutex_unlock
(
&
LOCK_wsrep_ready
);
return
ret
;
}
my_bool
wsrep_ready_get
(
void
)
{
if
(
mysql_mutex_lock
(
&
LOCK_wsrep_ready
))
abort
();
my_bool
ret
=
wsrep_ready
;
mysql_mutex_unlock
(
&
LOCK_wsrep_ready
);
return
ret
;
}
int
wsrep_show_ready
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
)
{
var
->
type
=
SHOW_MY_BOOL
;
var
->
value
=
buff
;
*
((
my_bool
*
)
buff
)
=
wsrep_ready_get
();
return
0
;
}
// Wait until wsrep has reached ready state
...
...
@@ -437,17 +456,8 @@ void wsrep_ready_wait ()
static
void
wsrep_synced_cb
(
void
*
app_ctx
)
{
WSREP_INFO
(
"Synchronized with group, ready for connections"
);
bool
signal_main
=
false
;
if
(
mysql_mutex_lock
(
&
LOCK_wsrep_ready
))
abort
();
if
(
!
wsrep_ready
)
{
wsrep_ready
=
TRUE
;
mysql_cond_signal
(
&
COND_wsrep_ready
);
signal_main
=
true
;
}
my_bool
signal_main
=
wsrep_ready_set
(
TRUE
);
local_status
.
set
(
WSREP_MEMBER_SYNCED
);
mysql_mutex_unlock
(
&
LOCK_wsrep_ready
);
if
(
signal_main
)
{
...
...
sql/wsrep_mysqld.h
View file @
86d31ce9
...
...
@@ -115,7 +115,6 @@ enum enum_wsrep_sync_wait {
// MySQL status variables
extern
my_bool
wsrep_connected
;
extern
my_bool
wsrep_ready
;
extern
const
char
*
wsrep_cluster_state_uuid
;
extern
long
long
wsrep_cluster_conf_id
;
extern
const
char
*
wsrep_cluster_status
;
...
...
@@ -130,6 +129,7 @@ extern const char* wsrep_provider_vendor;
extern
my_bool
wsrep_inited
;
// whether wsrep is initialized ?
int
wsrep_show_status
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
);
int
wsrep_show_ready
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
);
void
wsrep_free_status
(
THD
*
thd
);
/* Filters out --wsrep-new-cluster oprtion from argv[]
...
...
@@ -245,6 +245,7 @@ extern wsrep_seqno_t wsrep_locked_seqno;
#define WSREP_PROVIDER_EXISTS \
(wsrep_provider && strncasecmp(wsrep_provider, WSREP_NONE, FN_REFLEN))
extern
my_bool
wsrep_ready_get
();
extern
void
wsrep_ready_wait
();
enum
wsrep_trx_status
{
...
...
sql/wsrep_priv.h
View file @
86d31ce9
...
...
@@ -26,7 +26,7 @@
#include <pthread.h>
#include <cstdio>
void
wsrep_ready_set
(
my_bool
x
);
my_bool
wsrep_ready_set
(
my_bool
x
);
ssize_t
wsrep_sst_prepare
(
void
**
msg
);
wsrep_cb_status
wsrep_sst_donate_cb
(
void
*
app_ctx
,
...
...
sql/wsrep_sst.cc
View file @
86d31ce9
...
...
@@ -1057,7 +1057,6 @@ wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx,
{
/* This will be reset when sync callback is called.
* Should we set wsrep_ready to FALSE here too? */
// wsrep_notify_status(WSREP_MEMBER_DONOR);
local_status
.
set
(
WSREP_MEMBER_DONOR
);
const
char
*
method
=
(
char
*
)
msg
;
...
...
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