diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-06 21:23:01 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-06 21:25:43 +0300 |
commit | 1d30b7b1d2da90678e539efd2b5da4d88443aa1d (patch) | |
tree | a530a9833e0a7cfd175b3c92853bb840e699e049 /extra/mariabackup | |
parent | aa3f7a107ce3a9a7f80daf3cadd442a61c5493ab (diff) | |
download | mariadb-git-1d30b7b1d2da90678e539efd2b5da4d88443aa1d.tar.gz |
MDEV-12699 preparation: Clean up recv_sys
The recv_sys data structures are accessed not only from the thread
that executes InnoDB plugin initialization, but also from the
InnoDB I/O threads, which can invoke recv_recover_page().
Assert that sufficient concurrency control is in place.
Some code was accessing recv_sys data structures without
holding recv_sys->mutex.
recv_recover_page(bpage): Refactor the call from buf_page_io_complete()
into a separate function that performs necessary steps. The
main thread was unnecessarily releasing and reacquiring recv_sys->mutex.
recv_recover_page(block,mtr,recv_addr): Pass more parameters from
the caller. Avoid redundant lookups and computations. Eliminate some
redundant variables.
recv_get_fil_addr_struct(): Assert that recv_sys->mutex is being held.
That was not always the case!
recv_scan_log_recs(): Acquire recv_sys->mutex for the whole duration
of the function. (While we are scanning and buffering redo log records,
no pages can be read in.)
recv_read_in_area(): Properly protect access with recv_sys->mutex.
recv_apply_hashed_log_recs(): Check recv_addr->state only once,
and continuously hold recv_sys->mutex. The mutex will be released
and reacquired inside recv_recover_page() and recv_read_in_area(),
allowing concurrent processing by buf_page_io_complete() in I/O threads.
Diffstat (limited to 'extra/mariabackup')
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 94409c846a5..b8c87f09ec1 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2752,8 +2752,13 @@ static bool xtrabackup_copy_logfile(bool last = false) my_sleep(1000); } - start_lsn = (lsn == start_lsn) - ? 0 : xtrabackup_copy_log(start_lsn, lsn, last); + if (lsn == start_lsn) { + start_lsn = 0; + } else { + mutex_enter(&recv_sys->mutex); + start_lsn = xtrabackup_copy_log(start_lsn, lsn, last); + mutex_exit(&recv_sys->mutex); + } log_mutex_exit(); |