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
c6e62acb
Commit
c6e62acb
authored
Feb 20, 2015
by
Nirbhay Choubey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for build failures on Power8
parent
1e6f46d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
29 deletions
+25
-29
sql/wsrep_sst.cc
sql/wsrep_sst.cc
+16
-17
wsrep/wsrep_loader.c
wsrep/wsrep_loader.c
+9
-12
No files found.
sql/wsrep_sst.cc
View file @
c6e62acb
...
@@ -411,11 +411,10 @@ static ssize_t sst_prepare_other (const char* method,
...
@@ -411,11 +411,10 @@ static ssize_t sst_prepare_other (const char* method,
const
char
*
addr_in
,
const
char
*
addr_in
,
const
char
**
addr_out
)
const
char
**
addr_out
)
{
{
ssize_t
cmd_len
=
1024
;
char
cmd_str
[
1024
];
char
cmd_str
[
cmd_len
];
const
char
*
sst_dir
=
mysql_real_data_home
;
const
char
*
sst_dir
=
mysql_real_data_home
;
int
ret
=
snprintf
(
cmd_str
,
cmd_len
,
int
ret
=
snprintf
(
cmd_str
,
sizeof
(
cmd_str
)
,
"wsrep_sst_%s "
"wsrep_sst_%s "
WSREP_SST_OPT_ROLE
" 'joiner' "
WSREP_SST_OPT_ROLE
" 'joiner' "
WSREP_SST_OPT_ADDR
" '%s' "
WSREP_SST_OPT_ADDR
" '%s' "
...
@@ -426,7 +425,7 @@ static ssize_t sst_prepare_other (const char* method,
...
@@ -426,7 +425,7 @@ static ssize_t sst_prepare_other (const char* method,
method
,
addr_in
,
(
sst_auth_real
)
?
sst_auth_real
:
""
,
method
,
addr_in
,
(
sst_auth_real
)
?
sst_auth_real
:
""
,
sst_dir
,
wsrep_defaults_file
,
(
int
)
getpid
());
sst_dir
,
wsrep_defaults_file
,
(
int
)
getpid
());
if
(
ret
<
0
||
ret
>=
cmd_len
)
if
(
ret
<
0
||
ret
>=
(
int
)
sizeof
(
cmd_str
)
)
{
{
WSREP_ERROR
(
"sst_prepare_other(): snprintf() failed: %d"
,
ret
);
WSREP_ERROR
(
"sst_prepare_other(): snprintf() failed: %d"
,
ret
);
return
(
ret
<
0
?
ret
:
-
EMSGSIZE
);
return
(
ret
<
0
?
ret
:
-
EMSGSIZE
);
...
@@ -678,7 +677,7 @@ static int sst_donate_mysqldump (const char* addr,
...
@@ -678,7 +677,7 @@ static int sst_donate_mysqldump (const char* addr,
host_len
=
strlen
(
addr
)
+
1
;
host_len
=
strlen
(
addr
)
+
1
;
}
}
char
host
[
host_len
]
;
char
*
host
=
(
char
*
)
alloca
(
host_len
)
;
strncpy
(
host
,
addr
,
host_len
-
1
);
strncpy
(
host
,
addr
,
host_len
-
1
);
host
[
host_len
-
1
]
=
'\0'
;
host
[
host_len
-
1
]
=
'\0'
;
...
@@ -698,7 +697,7 @@ static int sst_donate_mysqldump (const char* addr,
...
@@ -698,7 +697,7 @@ static int sst_donate_mysqldump (const char* addr,
user_len
=
(
auth
)
?
strlen
(
auth
)
+
1
:
1
;
user_len
=
(
auth
)
?
strlen
(
auth
)
+
1
:
1
;
}
}
char
user
[
user_len
]
;
char
*
user
=
(
char
*
)
alloca
(
user_len
)
;
strncpy
(
user
,
(
auth
)
?
auth
:
""
,
user_len
-
1
);
strncpy
(
user
,
(
auth
)
?
auth
:
""
,
user_len
-
1
);
user
[
user_len
-
1
]
=
'\0'
;
user
[
user_len
-
1
]
=
'\0'
;
...
@@ -706,12 +705,11 @@ static int sst_donate_mysqldump (const char* addr,
...
@@ -706,12 +705,11 @@ static int sst_donate_mysqldump (const char* addr,
int
ret
=
sst_mysqldump_check_addr
(
user
,
pswd
,
host
,
port
);
int
ret
=
sst_mysqldump_check_addr
(
user
,
pswd
,
host
,
port
);
if
(
!
ret
)
if
(
!
ret
)
{
{
size_t
cmd_len
=
1024
;
char
cmd_str
[
1024
];
char
cmd_str
[
cmd_len
];
if
(
!
bypass
&&
wsrep_sst_donor_rejects_queries
)
sst_reject_queries
(
TRUE
);
if
(
!
bypass
&&
wsrep_sst_donor_rejects_queries
)
sst_reject_queries
(
TRUE
);
snprintf
(
cmd_str
,
cmd_len
,
snprintf
(
cmd_str
,
sizeof
(
cmd_str
)
,
"wsrep_sst_mysqldump "
"wsrep_sst_mysqldump "
WSREP_SST_OPT_USER
" '%s' "
WSREP_SST_OPT_USER
" '%s' "
WSREP_SST_OPT_PSWD
" '%s' "
WSREP_SST_OPT_PSWD
" '%s' "
...
@@ -808,11 +806,13 @@ static int sst_flush_tables(THD* thd)
...
@@ -808,11 +806,13 @@ static int sst_flush_tables(THD* thd)
{
{
WSREP_INFO
(
"Tables flushed."
);
WSREP_INFO
(
"Tables flushed."
);
const
char
base_name
[]
=
"tables_flushed"
;
const
char
base_name
[]
=
"tables_flushed"
;
ssize_t
const
full_len
=
strlen
(
mysql_real_data_home
)
+
strlen
(
base_name
)
+
2
;
ssize_t
const
full_len
=
strlen
(
mysql_real_data_home
)
+
strlen
(
base_name
)
+
2
;
char
real_name
[
full_len
];
char
*
real_name
=
(
char
*
)
alloca
(
full_len
);
sprintf
(
real_name
,
"%s/%s"
,
mysql_real_data_home
,
base_name
);
snprintf
(
real_name
,
(
size_t
)
full_len
,
"%s/%s"
,
mysql_real_data_home
,
char
tmp_name
[
full_len
+
4
];
base_name
);
sprintf
(
tmp_name
,
"%s.tmp"
,
real_name
);
char
*
tmp_name
=
(
char
*
)
alloca
(
full_len
+
4
);
snprintf
(
tmp_name
,
(
size_t
)
full_len
+
4
,
"%s.tmp"
,
real_name
);
FILE
*
file
=
fopen
(
tmp_name
,
"w+"
);
FILE
*
file
=
fopen
(
tmp_name
,
"w+"
);
if
(
0
==
file
)
if
(
0
==
file
)
...
@@ -970,10 +970,9 @@ static int sst_donate_other (const char* method,
...
@@ -970,10 +970,9 @@ static int sst_donate_other (const char* method,
wsrep_seqno_t
seqno
,
wsrep_seqno_t
seqno
,
bool
bypass
)
bool
bypass
)
{
{
ssize_t
cmd_len
=
4096
;
char
cmd_str
[
4096
];
char
cmd_str
[
cmd_len
];
int
ret
=
snprintf
(
cmd_str
,
cmd_len
,
int
ret
=
snprintf
(
cmd_str
,
sizeof
(
cmd_str
)
,
"wsrep_sst_%s "
"wsrep_sst_%s "
WSREP_SST_OPT_ROLE
" 'donor' "
WSREP_SST_OPT_ROLE
" 'donor' "
WSREP_SST_OPT_ADDR
" '%s' "
WSREP_SST_OPT_ADDR
" '%s' "
...
@@ -988,7 +987,7 @@ static int sst_donate_other (const char* method,
...
@@ -988,7 +987,7 @@ static int sst_donate_other (const char* method,
uuid
,
(
long
long
)
seqno
,
uuid
,
(
long
long
)
seqno
,
bypass
?
" "
WSREP_SST_OPT_BYPASS
:
""
);
bypass
?
" "
WSREP_SST_OPT_BYPASS
:
""
);
if
(
ret
<
0
||
ret
>=
cmd_len
)
if
(
ret
<
0
||
ret
>=
(
int
)
sizeof
(
cmd_str
)
)
{
{
WSREP_ERROR
(
"sst_donate_other(): snprintf() failed: %d"
,
ret
);
WSREP_ERROR
(
"sst_donate_other(): snprintf() failed: %d"
,
ret
);
return
(
ret
<
0
?
ret
:
-
EMSGSIZE
);
return
(
ret
<
0
?
ret
:
-
EMSGSIZE
);
...
...
wsrep/wsrep_loader.c
View file @
c6e62acb
...
@@ -39,11 +39,10 @@ static wsrep_log_cb_t logger = default_logger;
...
@@ -39,11 +39,10 @@ static wsrep_log_cb_t logger = default_logger;
static
int
verify
(
const
wsrep_t
*
wh
,
const
char
*
iface_ver
)
static
int
verify
(
const
wsrep_t
*
wh
,
const
char
*
iface_ver
)
{
{
const
size_t
msg_len
=
128
;
char
msg
[
128
];
char
msg
[
msg_len
];
#define VERIFY(_p) if (!(_p)) { \
#define VERIFY(_p) if (!(_p)) { \
snprintf(msg,
msg_len
, "wsrep_load(): verify(): %s\n", # _p); \
snprintf(msg,
sizeof(msg)
, "wsrep_load(): verify(): %s\n", # _p); \
logger (WSREP_LOG_ERROR, msg); \
logger (WSREP_LOG_ERROR, msg); \
return EINVAL; \
return EINVAL; \
}
}
...
@@ -52,7 +51,7 @@ static int verify(const wsrep_t *wh, const char *iface_ver)
...
@@ -52,7 +51,7 @@ static int verify(const wsrep_t *wh, const char *iface_ver)
VERIFY
(
wh
->
version
);
VERIFY
(
wh
->
version
);
if
(
strcmp
(
wh
->
version
,
iface_ver
))
{
if
(
strcmp
(
wh
->
version
,
iface_ver
))
{
snprintf
(
msg
,
msg_len
,
snprintf
(
msg
,
sizeof
(
msg
)
,
"provider interface version mismatch: need '%s', found '%s'"
,
"provider interface version mismatch: need '%s', found '%s'"
,
iface_ver
,
wh
->
version
);
iface_ver
,
wh
->
version
);
logger
(
WSREP_LOG_ERROR
,
msg
);
logger
(
WSREP_LOG_ERROR
,
msg
);
...
@@ -115,9 +114,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
...
@@ -115,9 +114,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
int
ret
=
0
;
int
ret
=
0
;
void
*
dlh
=
NULL
;
void
*
dlh
=
NULL
;
wsrep_loader_fun
dlfun
;
wsrep_loader_fun
dlfun
;
const
size_t
msg_len
=
1024
;
char
msg
[
1024
];
char
msg
[
msg_len
+
1
];
msg
[
msg_len
]
=
0
;
if
(
NULL
!=
log_cb
)
if
(
NULL
!=
log_cb
)
logger
=
log_cb
;
logger
=
log_cb
;
...
@@ -125,7 +122,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
...
@@ -125,7 +122,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
if
(
!
(
spec
&&
hptr
))
if
(
!
(
spec
&&
hptr
))
return
EINVAL
;
return
EINVAL
;
snprintf
(
msg
,
msg_len
,
snprintf
(
msg
,
sizeof
(
msg
)
,
"wsrep_load(): loading provider library '%s'"
,
spec
);
"wsrep_load(): loading provider library '%s'"
,
spec
);
logger
(
WSREP_LOG_INFO
,
msg
);
logger
(
WSREP_LOG_INFO
,
msg
);
...
@@ -143,7 +140,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
...
@@ -143,7 +140,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
}
}
if
(
!
(
dlh
=
dlopen
(
spec
,
RTLD_NOW
|
RTLD_LOCAL
)))
{
if
(
!
(
dlh
=
dlopen
(
spec
,
RTLD_NOW
|
RTLD_LOCAL
)))
{
snprintf
(
msg
,
msg_len
,
"wsrep_load(): dlopen(): %s"
,
dlerror
());
snprintf
(
msg
,
sizeof
(
msg
)
,
"wsrep_load(): dlopen(): %s"
,
dlerror
());
logger
(
WSREP_LOG_ERROR
,
msg
);
logger
(
WSREP_LOG_ERROR
,
msg
);
ret
=
EINVAL
;
ret
=
EINVAL
;
goto
out
;
goto
out
;
...
@@ -155,14 +152,14 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
...
@@ -155,14 +152,14 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
}
}
if
((
ret
=
(
*
dlfun
)(
*
hptr
))
!=
0
)
{
if
((
ret
=
(
*
dlfun
)(
*
hptr
))
!=
0
)
{
snprintf
(
msg
,
msg_len
,
"wsrep_load(): loader failed: %s"
,
snprintf
(
msg
,
sizeof
(
msg
)
,
"wsrep_load(): loader failed: %s"
,
strerror
(
ret
));
strerror
(
ret
));
logger
(
WSREP_LOG_ERROR
,
msg
);
logger
(
WSREP_LOG_ERROR
,
msg
);
goto
out
;
goto
out
;
}
}
if
((
ret
=
verify
(
*
hptr
,
WSREP_INTERFACE_VERSION
))
!=
0
)
{
if
((
ret
=
verify
(
*
hptr
,
WSREP_INTERFACE_VERSION
))
!=
0
)
{
snprintf
(
msg
,
msg_len
,
snprintf
(
msg
,
sizeof
(
msg
)
,
"wsrep_load(): interface version mismatch: my version %s, "
"wsrep_load(): interface version mismatch: my version %s, "
"provider version %s"
,
WSREP_INTERFACE_VERSION
,
"provider version %s"
,
WSREP_INTERFACE_VERSION
,
(
*
hptr
)
->
version
);
(
*
hptr
)
->
version
);
...
@@ -178,7 +175,7 @@ out:
...
@@ -178,7 +175,7 @@ out:
free
(
*
hptr
);
free
(
*
hptr
);
*
hptr
=
NULL
;
*
hptr
=
NULL
;
}
else
{
}
else
{
snprintf
(
msg
,
msg_len
,
snprintf
(
msg
,
sizeof
(
msg
)
,
"wsrep_load(): %s %s by %s loaded successfully."
,
"wsrep_load(): %s %s by %s loaded successfully."
,
(
*
hptr
)
->
provider_name
,
(
*
hptr
)
->
provider_version
,
(
*
hptr
)
->
provider_name
,
(
*
hptr
)
->
provider_version
,
(
*
hptr
)
->
provider_vendor
);
(
*
hptr
)
->
provider_vendor
);
...
...
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