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
e95fdb74
Commit
e95fdb74
authored
May 21, 2013
by
Seppo Jaakola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged in revisions 3853..3857 from lp:codership-mysql/5.5-23
parent
3e841b77
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
140 additions
and
22 deletions
+140
-22
scripts/mysqld_safe.sh
scripts/mysqld_safe.sh
+33
-17
scripts/wsrep_sst_rsync.sh
scripts/wsrep_sst_rsync.sh
+6
-5
sql/wsrep_hton.cc
sql/wsrep_hton.cc
+5
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+1
-0
storage/innobase/include/srv0srv.h
storage/innobase/include/srv0srv.h
+8
-0
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0trx.h
+3
-0
storage/innobase/srv/srv0srv.c
storage/innobase/srv/srv0srv.c
+33
-0
storage/innobase/trx/trx0trx.c
storage/innobase/trx/trx0trx.c
+3
-0
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+1
-0
storage/xtradb/include/srv0srv.h
storage/xtradb/include/srv0srv.h
+8
-0
storage/xtradb/include/trx0trx.h
storage/xtradb/include/trx0trx.h
+3
-0
storage/xtradb/srv/srv0srv.c
storage/xtradb/srv/srv0srv.c
+33
-0
storage/xtradb/trx/trx0trx.c
storage/xtradb/trx/trx0trx.c
+3
-0
No files found.
scripts/mysqld_safe.sh
View file @
e95fdb74
...
...
@@ -214,29 +214,39 @@ wsrep_pick_url() {
# Run mysqld with --wsrep-recover and parse recovered position from log.
# Position will be stored in wsrep_start_position_opt global.
wsrep_recovery
()
{
wsrep_start_position_opt
=
""
wsrep_recover_position
()
{
local
mysqld_cmd
=
"
$@
"
wr_logfile
=
$(
mktemp
)
[
"
$EUID
"
=
"0"
]
&&
chown
$user
$wr_logfile
local
wr_logfile
=
$(
mktemp
)
local
euid
=
$(
id
-u
)
local
ret
=
0
[
"
$euid
"
=
"0"
]
&&
chown
$user
$wr_logfile
chmod
600
$wr_logfile
log_notice
"WSREP: Running position recovery with --log_error=
$wr_logfile
"
$mysqld_cmd
--log_error
=
$wr_logfile
--wsrep-recover
rp
=
$(
grep
"WSREP: Recovered position:"
$wr_logfile
)
local
rp
=
"
$(
grep
'WSREP: Recovered position:'
$wr_logfile
)
"
if
[
-z
"
$rp
"
]
;
then
skipped
=
$(
grep
WSREP
$wr_logfile
|
grep
"skipping position recovery"
)
local
skipped
=
"
$(
grep
WSREP
$wr_logfile
|
grep
'skipping position recovery'
)
"
if
[
-z
"
$skipped
"
]
;
then
log_error
"WSREP: Failed to recover position: "
\
`
cat
$wr_logfile
`
;
log_error
"WSREP: Failed to recover position: "
`
cat
$wr_logfile
`
;
ret
=
1
else
log_notice
"WSREP: Position recovery skipped"
fi
else
start_pos
=
$(
echo
$rp
|
sed
's/.*WSREP\:\ Recovered\ position://'
\
|
sed
's/^[ \t]*//'
)
wsrep_start_position_opt
=
"--wsrep_start_position=
$start_pos
"
local
start_pos
=
"
$(
echo
$rp
|
sed
's/.*WSREP\:\ Recovered\ position://'
\
|
sed
's/^[ \t]*//'
)
"
log_notice
"WSREP: Recovered position
$start_pos
"
wsrep_start_position_opt
=
"--wsrep_start_position=
$start_pos
"
fi
rm
$wr_logfile
return
$ret
}
parse_arguments
()
{
...
...
@@ -864,20 +874,26 @@ have_sleep=1
# maximum number of wsrep restarts
max_wsrep_restarts
=
0
# maximum number of wsrep restarts
max_wsrep_restarts
=
0
while
true
do
rm
-f
$safe_mysql_unix_port
"
$pid_file
"
# Some extra safety
[
-n
"
$wsrep_urls
"
]
&&
url
=
`
wsrep_pick_url
$wsrep_urls
`
# check connect address
start_time
=
`
date
+%M%S
`
# this sets wsrep_start_position_opt
wsrep_recover_position
"
$cmd
"
[
$?
-ne
0
]
&&
exit
1
#
[
-n
"
$wsrep_urls
"
]
&&
url
=
`
wsrep_pick_url
$wsrep_urls
`
# check connect address
if
[
-z
"
$url
"
]
then
wsrep_recovery
"
$cmd
"
eval_log_error
"
$cmd
$wsrep_start_position_opt
$nohup_redir
"
else
wsrep_recovery
"
$cmd
"
eval_log_error
"
$cmd
$wsrep_start_position_opt
--wsrep_cluster_address=
$url
$nohup_redir
"
fi
...
...
scripts/wsrep_sst_rsync.sh
View file @
e95fdb74
...
...
@@ -89,14 +89,14 @@ then
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')
# New filter - exclude everything except dirs (schemas) and innodb files
FILTER
=(
-f
'+ /ibdata*'
-f
'+ /ib_logfile*'
-f
'+ */'
-f
'-! */*'
)
FILTER
=(
-f
'
- lost+found'
-f
'
+ /ibdata*'
-f
'+ /ib_logfile*'
-f
'+ */'
-f
'-! */*'
)
RC
=
0
rsync
--archive
--no-times
--ignore-times
--inplace
--delete
--quiet
\
$WHOLE_FILE_OPT
"
${
FILTER
[@]
}
"
"
$WSREP_SST_OPT_DATA
"
\
rsync://
$WSREP_SST_OPT_ADDR
||
RC
=
$?
[
$RC
-ne
0
]
&&
echo
"rsync returned code
$RC
:"
>>
/dev/stderr
[
$RC
-ne
0
]
&&
wsrep_log_error
"rsync returned code
$RC
:"
case
$RC
in
0
)
RC
=
0
# Success
...
...
@@ -136,7 +136,7 @@ then
if
check_pid
$RSYNC_PID
then
echo
"rsync daemon already running."
wsrep_log_error
"rsync daemon already running."
exit
114
# EALREADY
fi
rm
-rf
"
$RSYNC_PID
"
...
...
@@ -189,7 +189,8 @@ EOF
if
!
ps
-p
$MYSQLD_PID
>
/dev/null
then
echo
"Parent mysqld process (PID:
$MYSQLD_PID
) terminated unexpectedly."
>
&2
wsrep_log_error
\
"Parent mysqld process (PID:
$MYSQLD_PID
) terminated unexpectedly."
exit
32
fi
...
...
@@ -203,7 +204,7 @@ EOF
# cleanup_joiner
else
echo
"Unrecognized role: '
$WSREP_SST_OPT_ROLE
'"
wsrep_log_error
"Unrecognized role: '
$WSREP_SST_OPT_ROLE
'"
exit
22
# EINVAL
fi
...
...
sql/wsrep_hton.cc
View file @
e95fdb74
...
...
@@ -178,6 +178,7 @@ int wsrep_commit(handlerton *hton, THD *thd, bool all)
extern
Rpl_filter
*
binlog_filter
;
extern
my_bool
opt_log_slave_updates
;
extern
void
wsrep_write_rbr_buf
(
THD
*
thd
,
const
void
*
rbr_buf
,
size_t
buf_len
);
enum
wsrep_trx_status
wsrep_run_wsrep_commit
(
THD
*
thd
,
handlerton
*
hton
,
bool
all
)
...
...
@@ -337,6 +338,10 @@ wsrep_run_wsrep_commit(
(
thd
->
wsrep_PA_safe
)
?
WSREP_FLAG_PA_SAFE
:
0ULL
,
&
thd
->
wsrep_trx_seqno
);
if
(
rcode
==
WSREP_TRX_MISSING
)
{
WSREP_WARN
(
"Transaction missing in provider, thd: %ld, SQL: %s"
,
thd
->
thread_id
,
thd
->
query
());
wsrep_write_rbr_buf
(
thd
,
rbr_data
,
data_len
);
rcode
=
WSREP_OK
;
}
else
if
(
rcode
==
WSREP_BF_ABORT
)
{
mysql_mutex_lock
(
&
thd
->
LOCK_wsrep_thd
);
...
...
storage/innobase/handler/ha_innodb.cc
View file @
e95fdb74
...
...
@@ -12626,6 +12626,7 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
int
rcode
=
wsrep_innobase_kill_one_trx
(
bf_thd
,
bf_trx
,
victim_trx
,
signal
);
mutex_exit
(
&
kernel_mutex
);
wsrep_srv_conc_cancel_wait
(
victim_trx
);
DBUG_RETURN
(
rcode
);
}
else
{
WSREP_DEBUG
(
"victim does not have transaction"
);
...
...
storage/innobase/include/srv0srv.h
View file @
e95fdb74
...
...
@@ -566,6 +566,14 @@ srv_conc_enter_innodb(
/*==================*/
trx_t
*
trx
);
/*!< in: transaction object associated with the
thread */
#ifdef WITH_WSREP
UNIV_INTERN
void
wsrep_srv_conc_cancel_wait
(
/*==================*/
trx_t
*
trx
);
/*!< in: transaction object associated with the
thread */
#endif
/* WITH_WSREP */
/*********************************************************************//**
This lets a thread enter InnoDB regardless of the number of threads inside
InnoDB. This must be called when a thread ends a lock wait. */
...
...
storage/innobase/include/trx0trx.h
View file @
e95fdb74
...
...
@@ -729,6 +729,9 @@ struct trx_struct{
/*------------------------------*/
char
detailed_error
[
256
];
/*!< detailed error message for last
error, or empty. */
#ifdef WITH_WSREP
os_event_t
wsrep_event
;
/* event waited for in srv_conc_slot */
#endif
/* WITH_WSREP */
};
#define TRX_MAX_N_THREADS 32
/* maximum number of
...
...
storage/innobase/srv/srv0srv.c
View file @
e95fdb74
...
...
@@ -1148,6 +1148,23 @@ srv_general_init(void)
/* Maximum allowable purge history length. <=0 means 'infinite'. */
UNIV_INTERN
ulong
srv_max_purge_lag
=
0
;
#ifdef WITH_WSREP
UNIV_INTERN
void
wsrep_srv_conc_cancel_wait
(
/*==================*/
trx_t
*
trx
)
/*!< in: transaction object associated with the
thread */
{
os_fast_mutex_lock
(
&
srv_conc_mutex
);
if
(
trx
->
wsrep_event
)
{
if
(
wsrep_debug
)
fprintf
(
stderr
,
"WSREP: conc slot cancel
\n
"
);
os_event_set
(
trx
->
wsrep_event
);
}
os_fast_mutex_unlock
(
&
srv_conc_mutex
);
}
#endif
/* WITH_WSREP */
/*********************************************************************//**
Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
...
...
@@ -1299,6 +1316,19 @@ srv_conc_enter_innodb(
srv_conc_n_waiting_threads
++
;
#ifdef WITH_WSREP
if
(
wsrep_on
(
trx
->
mysql_thd
)
&&
wsrep_trx_is_aborting
(
trx
->
mysql_thd
))
{
srv_conc_n_waiting_threads
--
;
os_fast_mutex_unlock
(
&
srv_conc_mutex
);
if
(
wsrep_debug
)
fprintf
(
stderr
,
"srv_conc_enter due to MUST_ABORT"
);
trx
->
declared_to_be_inside_innodb
=
TRUE
;
trx
->
n_tickets_to_enter_innodb
=
SRV_FREE_TICKETS_TO_ENTER
;
return
;
}
trx
->
wsrep_event
=
slot
->
event
;
#endif
/* WITH_WSREP */
os_fast_mutex_unlock
(
&
srv_conc_mutex
);
/* Go to wait for the event; when a thread leaves InnoDB it will
...
...
@@ -1313,6 +1343,9 @@ srv_conc_enter_innodb(
thd_wait_begin
(
trx
->
mysql_thd
,
THD_WAIT_USER_LOCK
);
os_event_wait
(
slot
->
event
);
thd_wait_end
(
trx
->
mysql_thd
);
#ifdef WITH_WSREP
trx
->
wsrep_event
=
NULL
;
#endif
/* WITH_WSREP */
trx
->
op_info
=
""
;
...
...
storage/innobase/trx/trx0trx.c
View file @
e95fdb74
...
...
@@ -193,6 +193,9 @@ trx_create(
/* Remember to free the vector explicitly. */
trx
->
autoinc_locks
=
ib_vector_create
(
mem_heap_create
(
sizeof
(
ib_vector_t
)
+
sizeof
(
void
*
)
*
4
),
4
);
#ifdef WITH_WSREP
trx
->
wsrep_event
=
NULL
;
#endif
/* WITH_WSREP */
return
(
trx
);
}
...
...
storage/xtradb/handler/ha_innodb.cc
View file @
e95fdb74
...
...
@@ -13752,6 +13752,7 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
int
rcode
=
wsrep_innobase_kill_one_trx
(
bf_trx
,
victim_trx
,
signal
);
mutex_exit
(
&
kernel_mutex
);
wsrep_srv_conc_cancel_wait
(
victim_trx
);
DBUG_RETURN
(
rcode
);
}
else
{
WSREP_DEBUG
(
"victim does not have transaction"
);
...
...
storage/xtradb/include/srv0srv.h
View file @
e95fdb74
...
...
@@ -635,6 +635,14 @@ srv_conc_enter_innodb(
/*==================*/
trx_t
*
trx
);
/*!< in: transaction object associated with the
thread */
#ifdef WITH_WSREP
UNIV_INTERN
void
wsrep_srv_conc_cancel_wait
(
/*==================*/
trx_t
*
trx
);
/*!< in: transaction object associated with the
thread */
#endif
/* WITH_WSREP */
/*********************************************************************//**
This lets a thread enter InnoDB regardless of the number of threads inside
InnoDB. This must be called when a thread ends a lock wait. */
...
...
storage/xtradb/include/trx0trx.h
View file @
e95fdb74
...
...
@@ -747,6 +747,9 @@ struct trx_struct{
/*------------------------------*/
char
detailed_error
[
256
];
/*!< detailed error message for last
error, or empty. */
#ifdef WITH_WSREP
os_event_t
wsrep_event
;
/* event waited for in srv_conc_slot */
#endif
/* WITH_WSREP */
/*------------------------------*/
ulint
io_reads
;
ib_uint64_t
io_read
;
...
...
storage/xtradb/srv/srv0srv.c
View file @
e95fdb74
...
...
@@ -1234,6 +1234,23 @@ srv_general_init(void)
/* Maximum allowable purge history length. <=0 means 'infinite'. */
UNIV_INTERN
ulong
srv_max_purge_lag
=
0
;
#ifdef WITH_WSREP
UNIV_INTERN
void
wsrep_srv_conc_cancel_wait
(
/*==================*/
trx_t
*
trx
)
/*!< in: transaction object associated with the
thread */
{
os_fast_mutex_lock
(
&
srv_conc_mutex
);
if
(
trx
->
wsrep_event
)
{
if
(
wsrep_debug
)
fprintf
(
stderr
,
"WSREP: conc slot cancel
\n
"
);
os_event_set
(
trx
->
wsrep_event
);
}
os_fast_mutex_unlock
(
&
srv_conc_mutex
);
}
#endif
/* WITH_WSREP */
/*********************************************************************//**
Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
...
...
@@ -1466,6 +1483,19 @@ srv_conc_enter_innodb(
srv_conc_n_waiting_threads
++
;
#ifdef WITH_WSREP
if
(
wsrep_on
(
trx
->
mysql_thd
)
&&
wsrep_trx_is_aborting
(
trx
->
mysql_thd
))
{
srv_conc_n_waiting_threads
--
;
os_fast_mutex_unlock
(
&
srv_conc_mutex
);
if
(
wsrep_debug
)
fprintf
(
stderr
,
"srv_conc_enter due to MUST_ABORT"
);
trx
->
declared_to_be_inside_innodb
=
TRUE
;
trx
->
n_tickets_to_enter_innodb
=
SRV_FREE_TICKETS_TO_ENTER
;
return
;
}
trx
->
wsrep_event
=
slot
->
event
;
#endif
/* WITH_WSREP */
os_fast_mutex_unlock
(
&
srv_conc_mutex
);
/* Go to wait for the event; when a thread leaves InnoDB it will
...
...
@@ -1488,6 +1518,9 @@ srv_conc_enter_innodb(
thd_wait_begin
(
trx
->
mysql_thd
,
THD_WAIT_USER_LOCK
);
os_event_wait
(
slot
->
event
);
thd_wait_end
(
trx
->
mysql_thd
);
#ifdef WITH_WSREP
trx
->
wsrep_event
=
NULL
;
#endif
/* WITH_WSREP */
trx
->
op_info
=
""
;
...
...
storage/xtradb/trx/trx0trx.c
View file @
e95fdb74
...
...
@@ -211,6 +211,9 @@ trx_create(
/* Remember to free the vector explicitly. */
trx
->
autoinc_locks
=
ib_vector_create
(
mem_heap_create
(
sizeof
(
ib_vector_t
)
+
sizeof
(
void
*
)
*
4
),
4
);
#ifdef WITH_WSREP
trx
->
wsrep_event
=
NULL
;
#endif
/* WITH_WSREP */
return
(
trx
);
}
...
...
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