Commit 97817fb5 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Merge tag 'upstream/5.5.53' into ubuntu-14.04

Upstream version 5.5.53
parents fa322efd ad9e6670
......@@ -718,6 +718,19 @@ buf_block_get_frame(
{
SRV_CORRUPT_TABLE_CHECK(block, return(0););
return(buf_nonnull_block_get_frame(block));
}
/*********************************************************************//**
Gets a pointer to the memory frame of a block, where block is known not to be
NULL.
@return pointer to the frame */
UNIV_INLINE
buf_frame_t*
buf_nonnull_block_get_frame(
/*========================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_PAGE:
......@@ -739,6 +752,7 @@ buf_block_get_frame(
ok:
return((buf_frame_t*) block->frame);
}
#endif /* UNIV_DEBUG */
/*********************************************************************//**
......
......@@ -78,6 +78,11 @@ extern os_event_t srv_checkpoint_completed_event;
that the (slow) shutdown may proceed */
extern os_event_t srv_redo_log_thread_finished_event;
/** Whether the redo log tracker thread has been started. Does not take into
account whether the tracking is currently enabled (see srv_track_changed_pages
for that) */
extern my_bool srv_redo_log_thread_started;
/* If the last data file is auto-extended, we add this many pages to it
at a time */
#define SRV_AUTO_EXTEND_INCREMENT \
......@@ -145,6 +150,9 @@ extern char* srv_doublewrite_file;
extern ibool srv_recovery_stats;
/** Whether the redo log tracking is currently enabled. Note that it is
possible for the log tracker thread to be running and the tracking to be
disabled */
extern my_bool srv_track_changed_pages;
extern ib_uint64_t srv_max_bitmap_file_size;
......
......@@ -64,10 +64,10 @@ component, i.e. we show M.N.P as M.N */
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
#ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 38.0
#define PERCONA_INNODB_VERSION 38.3
#endif
#define INNODB_VERSION_STR "5.5.49-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
#define INNODB_VERSION_STR "5.5.52-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
#define REFMAN "http://dev.mysql.com/doc/refman/" \
IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
......
......@@ -3420,7 +3420,8 @@ logs_empty_and_mark_files_at_shutdown(void)
algorithm only works if the server is idle at shutdown */
srv_shutdown_state = SRV_SHUTDOWN_CLEANUP;
os_event_set(srv_shutdown_event);
srv_wake_purge_thread();
loop:
os_thread_sleep(100000);
......@@ -3594,7 +3595,7 @@ logs_empty_and_mark_files_at_shutdown(void)
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Wake the log tracking thread which will then immediatelly
quit because of srv_shutdown_state value */
if (srv_track_changed_pages) {
if (srv_redo_log_thread_started) {
os_event_set(srv_checkpoint_completed_event);
os_event_wait(srv_redo_log_thread_finished_event);
}
......@@ -3671,7 +3672,7 @@ logs_empty_and_mark_files_at_shutdown(void)
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Signal the log following thread to quit */
if (srv_track_changed_pages) {
if (srv_redo_log_thread_started) {
os_event_set(srv_checkpoint_completed_event);
}
......@@ -3695,7 +3696,7 @@ logs_empty_and_mark_files_at_shutdown(void)
fil_flush_file_spaces(FIL_TABLESPACE);
if (srv_track_changed_pages) {
if (srv_redo_log_thread_started) {
os_event_wait(srv_redo_log_thread_finished_event);
}
......
......@@ -1813,7 +1813,7 @@ log_online_purge_changed_page_bitmaps(
lsn = IB_ULONGLONG_MAX;
}
if (srv_track_changed_pages) {
if (srv_redo_log_thread_started) {
/* User requests might happen with both enabled and disabled
tracking */
mutex_enter(&log_bmp_sys->mutex);
......@@ -1821,13 +1821,13 @@ log_online_purge_changed_page_bitmaps(
if (!log_online_setup_bitmap_file_range(&bitmap_files, 0,
IB_ULONGLONG_MAX)) {
if (srv_track_changed_pages) {
if (srv_redo_log_thread_started) {
mutex_exit(&log_bmp_sys->mutex);
}
return TRUE;
}
if (srv_track_changed_pages && lsn > log_bmp_sys->end_lsn) {
if (srv_redo_log_thread_started && lsn > log_bmp_sys->end_lsn) {
/* If we have to delete the current output file, close it
first. */
os_file_close(log_bmp_sys->out.file);
......@@ -1858,7 +1858,7 @@ log_online_purge_changed_page_bitmaps(
}
}
if (srv_track_changed_pages) {
if (srv_redo_log_thread_started) {
if (lsn > log_bmp_sys->end_lsn) {
ib_uint64_t new_file_lsn;
if (lsn == IB_ULONGLONG_MAX) {
......@@ -1869,9 +1869,7 @@ log_online_purge_changed_page_bitmaps(
new_file_lsn = log_bmp_sys->end_lsn;
}
if (!log_online_rotate_bitmap_file(new_file_lsn)) {
/* If file create failed, signal the log
tracking thread to quit next time it wakes
up. */
/* If file create failed, stop log tracking */
srv_track_changed_pages = FALSE;
}
}
......
......@@ -3022,7 +3022,7 @@ recv_recovery_from_checkpoint_start_func(
ib_uint64_t checkpoint_lsn;
ib_uint64_t checkpoint_no;
ib_uint64_t old_scanned_lsn;
ib_uint64_t group_scanned_lsn= 0;
ib_uint64_t group_scanned_lsn = 0;
ib_uint64_t contiguous_lsn;
#ifdef UNIV_LOG_ARCHIVE
ib_uint64_t archived_lsn;
......
......@@ -56,7 +56,18 @@ mach_parse_compressed(
*val = flag;
return(ptr + 1);
} else if (flag < 0xC0UL) {
}
/* Workaround GCC bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673:
the compiler moves mach_read_from_4 right to the beginning of the
function, causing and out-of-bounds read if we are reading a short
integer close to the end of buffer. */
#if defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__clang__)
asm volatile("": : :"memory");
#endif
if (flag < 0xC0UL) {
if (end_ptr < ptr + 2) {
return(NULL);
}
......
......@@ -180,6 +180,9 @@ UNIV_INTERN char* srv_doublewrite_file = NULL;
UNIV_INTERN ibool srv_recovery_stats = FALSE;
/** Whether the redo log tracking is currently enabled. Note that it is
possible for the log tracker thread to be running and the tracking to be
disabled */
UNIV_INTERN my_bool srv_track_changed_pages = FALSE;
UNIV_INTERN ib_uint64_t srv_max_bitmap_file_size = 100 * 1024 * 1024;
......@@ -830,6 +833,11 @@ UNIV_INTERN os_event_t srv_checkpoint_completed_event;
UNIV_INTERN os_event_t srv_redo_log_thread_finished_event;
/** Whether the redo log tracker thread has been started. Does not take into
account whether the tracking is currently enabled (see srv_track_changed_pages
for that) */
UNIV_INTERN my_bool srv_redo_log_thread_started = FALSE;
UNIV_INTERN srv_sys_t* srv_sys = NULL;
/* padding to prevent other memory update hotspots from residing on
......@@ -3201,18 +3209,15 @@ srv_redo_log_follow_thread(
#endif
my_thread_init();
srv_redo_log_thread_started = TRUE;
do {
os_event_wait(srv_checkpoint_completed_event);
os_event_reset(srv_checkpoint_completed_event);
#ifdef UNIV_DEBUG
if (!srv_track_changed_pages) {
continue;
}
#endif
if (srv_track_changed_pages
&& srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
if (!log_online_follow_redo_log()) {
/* TODO: sync with I_S log tracking status? */
fprintf(stderr,
......@@ -3228,6 +3233,7 @@ srv_redo_log_follow_thread(
srv_track_changed_pages = FALSE;
log_online_read_shutdown();
os_event_set(srv_redo_log_thread_finished_event);
srv_redo_log_thread_started = FALSE; /* Defensive, not required */
my_thread_end();
os_thread_exit(NULL);
......@@ -3349,7 +3355,7 @@ srv_master_do_purge(void)
ut_ad(!mutex_own(&kernel_mutex));
ut_a(srv_n_purge_threads == 0 || (srv_shutdown_state > 0 && srv_n_threads_active[SRV_WORKER] == 0));
ut_a(srv_n_purge_threads == 0);
do {
/* Check for shutdown and change in purge config. */
......@@ -3875,7 +3881,7 @@ srv_master_thread(
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
if (srv_n_purge_threads == 0 || (srv_shutdown_state > 0 && srv_n_threads_active[SRV_WORKER] == 0)) {
if (srv_n_purge_threads == 0) {
srv_main_thread_op_info = "master purging";
srv_master_do_purge();
......@@ -3953,7 +3959,7 @@ srv_master_thread(
}
}
if (srv_n_purge_threads == 0 || (srv_shutdown_state > 0 && srv_n_threads_active[SRV_WORKER] == 0)) {
if (srv_n_purge_threads == 0) {
srv_main_thread_op_info = "master purging";
srv_master_do_purge();
......@@ -4170,9 +4176,10 @@ srv_purge_thread(
We peek at the history len without holding any mutex
because in the worst case we will end up waiting for
the next purge event. */
if (trx_sys->rseg_history_len < srv_purge_batch_size
if (srv_shutdown_state == SRV_SHUTDOWN_NONE
&& (trx_sys->rseg_history_len < srv_purge_batch_size
|| (n_total_purged == 0
&& retries >= TRX_SYS_N_RSEGS)) {
&& retries >= TRX_SYS_N_RSEGS))) {
mutex_enter(&kernel_mutex);
......@@ -4187,8 +4194,12 @@ srv_purge_thread(
/* Check for shutdown and whether we should do purge at all. */
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND
|| srv_shutdown_state != 0
|| srv_fast_shutdown) {
|| (srv_shutdown_state != SRV_SHUTDOWN_NONE
&& srv_fast_shutdown)
|| (srv_shutdown_state != SRV_SHUTDOWN_NONE
&& srv_fast_shutdown == 0
&& n_total_purged == 0
&& retries >= TRX_SYS_N_RSEGS)) {
break;
}
......@@ -4211,6 +4222,9 @@ srv_purge_thread(
srv_sync_log_buffer_in_background();
if (srv_shutdown_state != SRV_SHUTDOWN_NONE)
continue;
cur_time = ut_time_ms();
sig_count = os_event_reset(srv_shutdown_event);
if (next_itr_time > cur_time) {
......
......@@ -308,7 +308,7 @@ case "$mode" in
then
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args &
wait_for_ready; return_value=$?
# Make lock for RedHat / SuSE
......
......@@ -425,7 +425,7 @@ main(int argc, char *argv[])
event_dispatch();
free(sds);
my_free(sds);
mysql_library_end();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment