Commit a808c18b authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Make .clang-format work with clang-8

Remove keywords that are too new.
parent 4e30a57e
...@@ -7,14 +7,10 @@ AlignConsecutiveDeclarations: false ...@@ -7,14 +7,10 @@ AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right AlignEscapedNewlines: Right
AlignOperands: true AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
...@@ -23,7 +19,6 @@ AlwaysBreakTemplateDeclarations: MultiLine ...@@ -23,7 +19,6 @@ AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true BinPackArguments: true
BinPackParameters: true BinPackParameters: true
BraceWrapping: BraceWrapping:
AfterCaseLabel: true
AfterClass: true AfterClass: true
AfterControlStatement: true AfterControlStatement: true
AfterEnum: true AfterEnum: true
...@@ -93,7 +88,6 @@ ReflowComments: true ...@@ -93,7 +88,6 @@ ReflowComments: true
SortIncludes: true SortIncludes: true
SortUsingDeclarations: true SortUsingDeclarations: true
SpaceAfterCStyleCast: true SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: false SpaceBeforeAssignmentOperators: false
SpaceBeforeCpp11BracedList: false SpaceBeforeCpp11BracedList: false
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -59,7 +59,7 @@ take after being waked up. */ ...@@ -59,7 +59,7 @@ take after being waked up. */
static volatile bool buf_dump_should_start; static volatile bool buf_dump_should_start;
static volatile bool buf_load_should_start; static volatile bool buf_load_should_start;
static ibool buf_load_abort_flag = FALSE; static bool buf_load_abort_flag;
/* Used to temporary store dump info in order to avoid IO while holding /* Used to temporary store dump info in order to avoid IO while holding
buffer pool mutex during dump and also to sort the contents of the dump buffer pool mutex during dump and also to sort the contents of the dump
...@@ -72,30 +72,18 @@ typedef ib_uint64_t buf_dump_t; ...@@ -72,30 +72,18 @@ typedef ib_uint64_t buf_dump_t;
#define BUF_DUMP_SPACE(a) ((ulint) ((a) >> 32)) #define BUF_DUMP_SPACE(a) ((ulint) ((a) >> 32))
#define BUF_DUMP_PAGE(a) ((ulint) ((a) & 0xFFFFFFFFUL)) #define BUF_DUMP_PAGE(a) ((ulint) ((a) & 0xFFFFFFFFUL))
/*****************************************************************//** /** Start the buffer pool dump/load task and instructs it to start a dump. */
Wakes up the buffer pool dump/load thread and instructs it to start void buf_dump_start()
a dump. This function is called by MySQL code via buffer_pool_dump_now()
and it should return immediately because the whole MySQL is frozen during
its execution. */
void
buf_dump_start()
/*============*/
{ {
buf_dump_should_start = true; buf_dump_should_start= true;
buf_do_load_dump(); buf_do_load_dump();
} }
/*****************************************************************//** /** Start the buffer pool dump/load task and instructs it to start a load. */
Wakes up the buffer pool dump/load thread and instructs it to start void buf_load_start()
a load. This function is called by MySQL code via buffer_pool_load_now()
and it should return immediately because the whole MySQL is frozen during
its execution. */
void
buf_load_start()
/*============*/
{ {
buf_load_should_start = true; buf_load_should_start= true;
buf_do_load_dump(); buf_do_load_dump();
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -536,7 +524,7 @@ buf_load() ...@@ -536,7 +524,7 @@ buf_load()
int fscanf_ret; int fscanf_ret;
/* Ignore any leftovers from before */ /* Ignore any leftovers from before */
buf_load_abort_flag = FALSE; buf_load_abort_flag = false;
buf_dump_generate_path(full_filename, sizeof(full_filename)); buf_dump_generate_path(full_filename, sizeof(full_filename));
...@@ -727,7 +715,7 @@ buf_load() ...@@ -727,7 +715,7 @@ buf_load()
if (space != NULL) { if (space != NULL) {
space->release(); space->release();
} }
buf_load_abort_flag = FALSE; buf_load_abort_flag = false;
ut_free(dump); ut_free(dump);
buf_load_status( buf_load_status(
STATUS_INFO, STATUS_INFO,
...@@ -750,7 +738,7 @@ buf_load() ...@@ -750,7 +738,7 @@ buf_load()
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if ((i+1) >= srv_buf_pool_load_pages_abort) { if ((i+1) >= srv_buf_pool_load_pages_abort) {
buf_load_abort_flag = 1; buf_load_abort_flag = true;
} }
#endif #endif
} }
...@@ -789,15 +777,10 @@ buf_load() ...@@ -789,15 +777,10 @@ buf_load()
#endif /* HAVE_PSI_STAGE_INTERFACE */ #endif /* HAVE_PSI_STAGE_INTERFACE */
} }
/*****************************************************************//** /** Abort a currently running buffer pool load. */
Aborts a currently running buffer pool load. This function is called by void buf_load_abort()
MySQL code via buffer_pool_load_abort() and it should return immediately
because the whole MySQL is frozen during its execution. */
void
buf_load_abort()
/*============*/
{ {
buf_load_abort_flag = TRUE; buf_load_abort_flag= true;
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -850,30 +833,28 @@ static void buf_dump_load_func(void *) ...@@ -850,30 +833,28 @@ static void buf_dump_load_func(void *)
} }
/* Execute tak with max.concurrency */ /* Execute task with max.concurrency */
tpool::task_group tpool_group(1); static tpool::task_group tpool_group(1);
static tpool::waitable_task buf_dump_load_task(buf_dump_load_func, &tpool_group); static tpool::waitable_task buf_dump_load_task(buf_dump_load_func, &tpool_group);
static bool load_dump_enabled; static bool load_dump_enabled;
/** Start async buffer pool load, if srv_buffer_pool_load_at_startup was set.*/ /** Start async buffer pool load, if srv_buffer_pool_load_at_startup was set.*/
void buf_load_at_startup() void buf_load_at_startup()
{ {
load_dump_enabled = true; load_dump_enabled= true;
if (srv_buffer_pool_load_at_startup) { if (srv_buffer_pool_load_at_startup)
buf_do_load_dump(); buf_do_load_dump();
}
} }
static void buf_do_load_dump() static void buf_do_load_dump()
{ {
if (!load_dump_enabled || buf_dump_load_task.is_running()) if (load_dump_enabled && !buf_dump_load_task.is_running())
return; srv_thread_pool->submit_task(&buf_dump_load_task);
srv_thread_pool->submit_task(&buf_dump_load_task);
} }
/** Wait for currently running load/dumps to finish*/ /** Wait for currently running load/dumps to finish*/
void buf_load_dump_end() void buf_load_dump_end()
{ {
ut_ad(SHUTTING_DOWN()); ut_ad(SHUTTING_DOWN());
buf_dump_load_task.wait(); buf_dump_load_task.wait();
} }
...@@ -3274,8 +3274,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) ...@@ -3274,8 +3274,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
/* At this point all threads including the master and the purge /* At this point all threads including the master and the purge
thread must have been suspended. */ thread must have been suspended. */
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
ut_a(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE); ut_ad(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE);
/* We can now make a final sweep on flushing the buffer pool /* We can now make a final sweep on flushing the buffer pool
and exit after we have cleaned the whole buffer pool. and exit after we have cleaned the whole buffer pool.
...@@ -3306,8 +3306,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) ...@@ -3306,8 +3306,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
} while (!success || n_flushed > 0); } while (!success || n_flushed > 0);
/* Some sanity checks */ /* Some sanity checks */
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
ut_a(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE); ut_ad(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE);
for (ulint i = 0; i < srv_buf_pool_instances; i++) { for (ulint i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool = buf_pool_from_array(i); buf_pool_t* buf_pool = buf_pool_from_array(i);
......
...@@ -1355,7 +1355,7 @@ dict_check_if_system_table_exists( ...@@ -1355,7 +1355,7 @@ dict_check_if_system_table_exists(
dict_table_t* sys_table; dict_table_t* sys_table;
dberr_t error = DB_SUCCESS; dberr_t error = DB_SUCCESS;
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
mutex_enter(&dict_sys.mutex); mutex_enter(&dict_sys.mutex);
...@@ -1395,7 +1395,7 @@ dict_create_or_check_foreign_constraint_tables(void) ...@@ -1395,7 +1395,7 @@ dict_create_or_check_foreign_constraint_tables(void)
dberr_t sys_foreign_err; dberr_t sys_foreign_err;
dberr_t sys_foreign_cols_err; dberr_t sys_foreign_cols_err;
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
/* Note: The master thread has not been started at this point. */ /* Note: The master thread has not been started at this point. */
...@@ -1537,7 +1537,7 @@ dict_create_or_check_sys_virtual() ...@@ -1537,7 +1537,7 @@ dict_create_or_check_sys_virtual()
my_bool srv_file_per_table_backup; my_bool srv_file_per_table_backup;
dberr_t err; dberr_t err;
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
/* Note: The master thread has not been started at this point. */ /* Note: The master thread has not been started at this point. */
err = dict_check_if_system_table_exists( err = dict_check_if_system_table_exists(
...@@ -2064,7 +2064,7 @@ dict_create_or_check_sys_tablespace(void) ...@@ -2064,7 +2064,7 @@ dict_create_or_check_sys_tablespace(void)
dberr_t sys_tablespaces_err; dberr_t sys_tablespaces_err;
dberr_t sys_datafiles_err; dberr_t sys_datafiles_err;
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
/* Note: The master thread has not been started at this point. */ /* Note: The master thread has not been started at this point. */
......
...@@ -284,11 +284,9 @@ dict_stats_wait_bg_to_stop_using_table( ...@@ -284,11 +284,9 @@ dict_stats_wait_bg_to_stop_using_table(
/*****************************************************************//** /*****************************************************************//**
Initialize global variables needed for the operation of dict_stats_thread() Initialize global variables needed for the operation of dict_stats_thread()
Must be called before dict_stats_thread() is started. */ Must be called before dict_stats_thread() is started. */
void void dict_stats_init()
dict_stats_init()
{ {
ut_a(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
/* The recalc_pool_mutex is acquired from: /* The recalc_pool_mutex is acquired from:
1) the background stats gathering thread before any other latch 1) the background stats gathering thread before any other latch
...@@ -313,15 +311,13 @@ dict_stats_init() ...@@ -313,15 +311,13 @@ dict_stats_init()
/*****************************************************************//** /*****************************************************************//**
Free resources allocated by dict_stats_init(), must be called Free resources allocated by dict_stats_init(), must be called
after dict_stats task has exited. */ after dict_stats task has exited. */
void void dict_stats_deinit()
dict_stats_deinit()
/*======================*/
{ {
if (!stats_initialised) { if (!stats_initialised) {
return; return;
} }
ut_a(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
stats_initialised = false; stats_initialised = false;
dict_stats_recalc_pool_deinit(); dict_stats_recalc_pool_deinit();
...@@ -427,7 +423,7 @@ void dict_stats_disabled_debug_update(THD*, st_mysql_sys_var*, void*, ...@@ -427,7 +423,7 @@ void dict_stats_disabled_debug_update(THD*, st_mysql_sys_var*, void*,
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
static tpool::timer* dict_stats_timer; static tpool::timer* dict_stats_timer;
std::mutex dict_stats_mutex; static std::mutex dict_stats_mutex;
static void dict_stats_func(void*) static void dict_stats_func(void*)
{ {
...@@ -438,31 +434,28 @@ static void dict_stats_func(void*) ...@@ -438,31 +434,28 @@ static void dict_stats_func(void*)
void dict_stats_start() void dict_stats_start()
{ {
std::lock_guard<std::mutex> lk(dict_stats_mutex); std::lock_guard<std::mutex> lk(dict_stats_mutex);
if (dict_stats_timer) { if (!dict_stats_timer)
return; dict_stats_timer= srv_thread_pool->create_timer(dict_stats_func);
}
dict_stats_timer = srv_thread_pool->create_timer(dict_stats_func);
} }
static void dict_stats_schedule(int ms) static void dict_stats_schedule(int ms)
{ {
std::lock_guard<std::mutex> lk(dict_stats_mutex); std::lock_guard<std::mutex> lk(dict_stats_mutex);
if(dict_stats_timer) { if (dict_stats_timer)
dict_stats_timer->set_time(ms,0); dict_stats_timer->set_time(ms,0);
}
} }
void dict_stats_schedule_now() void dict_stats_schedule_now()
{ {
dict_stats_schedule(0); dict_stats_schedule(0);
} }
/** Shut down the dict_stats_thread. */ /** Shut down the dict_stats_thread. */
void dict_stats_shutdown() void dict_stats_shutdown()
{ {
std::lock_guard<std::mutex> lk(dict_stats_mutex); std::lock_guard<std::mutex> lk(dict_stats_mutex);
delete dict_stats_timer; delete dict_stats_timer;
dict_stats_timer = 0; dict_stats_timer= 0;
} }
...@@ -4331,13 +4331,11 @@ fil_io( ...@@ -4331,13 +4331,11 @@ fil_io(
#include <tpool.h> #include <tpool.h>
/**********************************************************************/ /**********************************************************************/
/* Callback for AIO completion */ /** Callback for AIO completion */
void void fil_aio_callback(const tpool::aiocb *cb)
fil_aio_callback(const tpool::aiocb *cb)
{ {
os_aio_userdata_t *data=(os_aio_userdata_t *)cb->m_userdata; os_aio_userdata_t *data=(os_aio_userdata_t *)cb->m_userdata;
fil_node_t* node= data->node; fil_node_t* node= data->node;
IORequest type = data->type;
void* message = data->message; void* message = data->message;
ut_ad(fil_validate_skip()); ut_ad(fil_validate_skip());
...@@ -4351,7 +4349,7 @@ fil_aio_callback(const tpool::aiocb *cb) ...@@ -4351,7 +4349,7 @@ fil_aio_callback(const tpool::aiocb *cb)
mutex_enter(&fil_system.mutex); mutex_enter(&fil_system.mutex);
fil_node_complete_io(node, type); fil_node_complete_io(node, data->type);
ut_ad(node->space->purpose != FIL_TYPE_LOG); ut_ad(node->space->purpose != FIL_TYPE_LOG);
const ulint space_id= node->space->id; const ulint space_id= node->space->id;
bool dblwr = node->space->use_doublewrite(); bool dblwr = node->space->use_doublewrite();
...@@ -4384,7 +4382,7 @@ fil_aio_callback(const tpool::aiocb *cb) ...@@ -4384,7 +4382,7 @@ fil_aio_callback(const tpool::aiocb *cb)
return; return;
} }
ut_ad(type.is_read()); ut_ad(data->type.is_read());
if (recv_recovery_is_on() && !srv_force_recovery) { if (recv_recovery_is_on() && !srv_force_recovery) {
recv_sys.found_corrupt_fs = true; recv_sys.found_corrupt_fs = true;
} }
......
...@@ -390,7 +390,7 @@ dberr_t ...@@ -390,7 +390,7 @@ dberr_t
SysTablespace::set_size( SysTablespace::set_size(
Datafile& file) Datafile& file)
{ {
ut_a(!srv_read_only_mode || m_ignore_read_only); ut_ad(!srv_read_only_mode || m_ignore_read_only);
/* We created the data file and now write it full of zeros */ /* We created the data file and now write it full of zeros */
ib::info() << "Setting file '" << file.filepath() << "' size to " ib::info() << "Setting file '" << file.filepath() << "' size to "
...@@ -425,7 +425,7 @@ SysTablespace::create_file( ...@@ -425,7 +425,7 @@ SysTablespace::create_file(
dberr_t err = DB_SUCCESS; dberr_t err = DB_SUCCESS;
ut_a(!file.m_exists); ut_a(!file.m_exists);
ut_a(!srv_read_only_mode || m_ignore_read_only); ut_ad(!srv_read_only_mode || m_ignore_read_only);
switch (file.m_type) { switch (file.m_type) {
case SRV_NEW_RAW: case SRV_NEW_RAW:
......
...@@ -2542,20 +2542,19 @@ fts_optimize_create_msg( ...@@ -2542,20 +2542,19 @@ fts_optimize_create_msg(
} }
/** Add message to wqueue, signal thread pool*/ /** Add message to wqueue, signal thread pool*/
void add_msg(fts_msg_t *msg, bool wq_locked = false) static void add_msg(fts_msg_t *msg, bool wq_locked= false)
{ {
ut_a(fts_optimize_wq); ib_wqueue_add(fts_optimize_wq, msg, msg->heap, wq_locked);
ib_wqueue_add(fts_optimize_wq,msg, msg->heap,wq_locked); srv_thread_pool->submit_task(&task);
srv_thread_pool->submit_task(&task);
} }
/** /**
Called by "idle" timer. Submits optimize task, which Called by "idle" timer. Submits optimize task, which
will only recalculate is_sync_needed, in case the queue is empty. will only recalculate is_sync_needed, in case the queue is empty.
*/ */
static void timer_callback(void *) static void timer_callback(void*)
{ {
srv_thread_pool->submit_task(&task); srv_thread_pool->submit_task(&task);
} }
/** Add the table to add to the OPTIMIZER's list. /** Add the table to add to the OPTIMIZER's list.
...@@ -2581,7 +2580,7 @@ void fts_optimize_add_table(dict_table_t* table) ...@@ -2581,7 +2580,7 @@ void fts_optimize_add_table(dict_table_t* table)
mutex_enter(&fts_optimize_wq->mutex); mutex_enter(&fts_optimize_wq->mutex);
add_msg(msg,true); add_msg(msg, true);
table->fts->in_queue = true; table->fts->in_queue = true;
...@@ -2808,16 +2807,12 @@ static void fts_optimize_sync_table(dict_table_t* table) ...@@ -2808,16 +2807,12 @@ static void fts_optimize_sync_table(dict_table_t* table)
/**********************************************************************//** /**********************************************************************//**
Optimize all FTS tables. Optimize all FTS tables.
@return Dummy return */ @return Dummy return */
static static void fts_optimize_callback(void *)
void fts_optimize_callback(
/*================*/
void* arg) /*!< in: work queue*/
{ {
static ulint current = 0; static ulint current = 0;
static ibool done = FALSE; static ibool done = FALSE;
static ulint n_tables = ib_vector_size(fts_slots); static ulint n_tables = ib_vector_size(fts_slots);
static ulint n_optimize = 0; static ulint n_optimize = 0;
ib_wqueue_t* wq = fts_optimize_wq;
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
...@@ -2832,7 +2827,7 @@ void fts_optimize_callback( ...@@ -2832,7 +2827,7 @@ void fts_optimize_callback(
to optimize then optimize the tables. */ to optimize then optimize the tables. */
if (!done if (!done
&& ib_wqueue_is_empty(wq) && ib_wqueue_is_empty(fts_optimize_wq)
&& n_tables > 0 && n_tables > 0
&& n_optimize > 0) { && n_optimize > 0) {
fts_slot_t* slot = static_cast<fts_slot_t*>( fts_slot_t* slot = static_cast<fts_slot_t*>(
...@@ -2850,9 +2845,10 @@ void fts_optimize_callback( ...@@ -2850,9 +2845,10 @@ void fts_optimize_callback(
current = 0; current = 0;
} }
} else if (n_optimize == 0 || !ib_wqueue_is_empty(wq)) { } else if (n_optimize == 0
fts_msg_t* msg; || !ib_wqueue_is_empty(fts_optimize_wq)) {
msg = static_cast<fts_msg_t*>(ib_wqueue_nowait(wq)); fts_msg_t* msg = static_cast<fts_msg_t*>
(ib_wqueue_nowait(fts_optimize_wq));
/* Timeout ? */ /* Timeout ? */
if (msg == NULL) { if (msg == NULL) {
if (fts_is_sync_needed()) { if (fts_is_sync_needed()) {
...@@ -2998,18 +2994,17 @@ fts_optimize_shutdown() ...@@ -2998,18 +2994,17 @@ fts_optimize_shutdown()
/* We tell the OPTIMIZE thread to switch to state done, we /* We tell the OPTIMIZE thread to switch to state done, we
can't delete the work queue here because the add thread needs can't delete the work queue here because the add thread needs
deregister the FTS tables. */ deregister the FTS tables. */
delete timer; delete timer;
timer = NULL; timer = NULL;
task_group.cancel_pending(&task); task_group.cancel_pending(&task);
msg = fts_optimize_create_msg(FTS_MSG_STOP, NULL); msg = fts_optimize_create_msg(FTS_MSG_STOP, NULL);
add_msg(msg, false); add_msg(msg);
os_event_wait(fts_opt_shutdown_event); os_event_wait(fts_opt_shutdown_event);
os_event_destroy(fts_opt_shutdown_event); os_event_destroy(fts_opt_shutdown_event);
ib_wqueue_free(fts_optimize_wq); ib_wqueue_free(fts_optimize_wq);
fts_optimize_wq = NULL; fts_optimize_wq = NULL;
} }
...@@ -57,7 +57,6 @@ this program; if not, write to the Free Software Foundation, Inc., ...@@ -57,7 +57,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "field.h" #include "field.h"
#include "srv0srv.h" #include "srv0srv.h"
// MYSQL_PLUGIN_IMPORT extern my_bool lower_case_file_system; // MYSQL_PLUGIN_IMPORT extern my_bool lower_case_file_system;
// MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[]; // MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[];
...@@ -104,7 +103,6 @@ this program; if not, write to the Free Software Foundation, Inc., ...@@ -104,7 +103,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "row0upd.h" #include "row0upd.h"
#include "fil0crypt.h" #include "fil0crypt.h"
#include "srv0mon.h" #include "srv0mon.h"
#include "srv0srv.h"
#include "srv0start.h" #include "srv0start.h"
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
#include "trx0purge.h" #include "trx0purge.h"
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -26,33 +27,13 @@ Created April 08, 2011 Vasil Dimov ...@@ -26,33 +27,13 @@ Created April 08, 2011 Vasil Dimov
#ifndef buf0dump_h #ifndef buf0dump_h
#define buf0dump_h #define buf0dump_h
#include "univ.i" /** Start the buffer pool dump/load task and instructs it to start a dump. */
void buf_dump_start();
/*****************************************************************//** /** Start the buffer pool dump/load task and instructs it to start a load. */
Starts the buffer pool dump/load task dump/load thread and instructs it to start void buf_load_start();
a dump. This function is called by MySQL code via buffer_pool_dump_now()
and it should return immediately because the whole MySQL is frozen during /** Abort a currently running buffer pool load. */
its execution. */ void buf_load_abort();
void
buf_dump_start();
/*============*/
/*****************************************************************//**
Starts the buffer pool dump/load task (if not started) and instructs it to start
a load. This function is called by MySQL code via buffer_pool_load_now()
and it should return immediately because the whole MySQL is frozen during
its execution. */
void
buf_load_start();
/*============*/
/*****************************************************************//**
Aborts a currently running buffer pool load. This function is called by
MySQL code via buffer_pool_load_abort() and it should return immediately
because the whole MySQL is frozen during its execution. */
void
buf_load_abort();
/*============*/
/** Start async buffer pool load, if srv_buffer_pool_load_at_startup was set.*/ /** Start async buffer pool load, if srv_buffer_pool_load_at_startup was set.*/
void buf_load_at_startup(); void buf_load_at_startup();
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -97,16 +97,12 @@ dict_stats_wait_bg_to_stop_using_table( ...@@ -97,16 +97,12 @@ dict_stats_wait_bg_to_stop_using_table(
/*****************************************************************//** /*****************************************************************//**
Initialize global variables needed for the operation of dict_stats_thread(). Initialize global variables needed for the operation of dict_stats_thread().
Must be called before dict_stats task is started. */ Must be called before dict_stats task is started. */
void void dict_stats_init();
dict_stats_init();
/*====================*/
/*****************************************************************//** /*****************************************************************//**
Free resources allocated by dict_stats_thread_init(), must be called Free resources allocated by dict_stats_thread_init(), must be called
after dict_stats task has exited. */ after dict_stats task has exited. */
void void dict_stats_deinit();
dict_stats_deinit();
/*======================*/
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Disables dict stats thread. It's used by: /** Disables dict stats thread. It's used by:
...@@ -116,17 +112,13 @@ void dict_stats_disabled_debug_update(THD*, st_mysql_sys_var*, void*, ...@@ -116,17 +112,13 @@ void dict_stats_disabled_debug_update(THD*, st_mysql_sys_var*, void*,
const void* save); const void* save);
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/** Start the dict stats timer. */
/** Start the dict stats timer */ void dict_stats_start();
void
dict_stats_start();
/** Shut down the dict_stats timer. */ /** Shut down the dict_stats timer. */
void void dict_stats_shutdown();
dict_stats_shutdown();
/** reschedule dict stats timer to run now. */ /** Reschedule dict stats timer to run now. */
void void dict_stats_schedule_now();
dict_stats_schedule_now();
#endif /* dict0stats_bg_h */ #endif /* dict0stats_bg_h */
...@@ -646,8 +646,7 @@ lock_table_has_locks( ...@@ -646,8 +646,7 @@ lock_table_has_locks(
held on records in this table or on the held on records in this table or on the
table itself */ table itself */
/*********************************************************************//** /** A task which wakes up threads whose lock wait may have lasted too long */
A task which wakes up threads whose lock wait may have lasted too long. */
void lock_wait_timeout_task(void*); void lock_wait_timeout_task(void*);
/********************************************************************//** /********************************************************************//**
......
...@@ -439,10 +439,6 @@ extern uint srv_fast_shutdown; /*!< If this is 1, do not do a ...@@ -439,10 +439,6 @@ extern uint srv_fast_shutdown; /*!< If this is 1, do not do a
InnoDB (but lose no committed InnoDB (but lose no committed
transactions). */ transactions). */
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
running in innodb_read_only mode, srv_read_only_mode) */
extern std::atomic<st_my_thread_var *> srv_running;
extern ibool srv_innodb_status; extern ibool srv_innodb_status;
extern unsigned long long srv_stats_transient_sample_pages; extern unsigned long long srv_stats_transient_sample_pages;
...@@ -785,13 +781,10 @@ srv_que_task_enqueue_low( ...@@ -785,13 +781,10 @@ srv_que_task_enqueue_low(
/*=====================*/ /*=====================*/
que_thr_t* thr); /*!< in: query thread */ que_thr_t* thr); /*!< in: query thread */
/**********************************************************************//** #ifdef UNIV_DEBUG
Check whether purge or master is active. /** @return whether purge or master task is active */
@return false if all are are suspended or have exited, true
if any are still active. */
bool srv_any_background_activity(); bool srv_any_background_activity();
#endif
/*============================*/
extern "C" { extern "C" {
...@@ -801,7 +794,7 @@ void srv_monitor_task(void*); ...@@ -801,7 +794,7 @@ void srv_monitor_task(void*);
/** The periodic master task controlling the server. */ /** The periodic master task controlling the server. */
void srv_master_callback(void *); void srv_master_callback(void*);
/** /**
...@@ -819,17 +812,13 @@ void srv_error_monitor_task(void*); ...@@ -819,17 +812,13 @@ void srv_error_monitor_task(void*);
} /* extern "C" */ } /* extern "C" */
/**********************************************************************//** #ifdef UNIV_DEBUG
Get count of tasks in the queue. /** @return number of tasks in queue */
@return number of tasks in queue */ ulint srv_get_task_queue_length();
ulint #endif
srv_get_task_queue_length(void);
/*===========================*/
/** Wakeup the purge threads. */ /** Wakeup the purge threads. */
void void srv_purge_wakeup();
srv_purge_wakeup();
/** Shut down the purge threads. */ /** Shut down the purge threads. */
void srv_purge_shutdown(); void srv_purge_shutdown();
...@@ -837,9 +826,6 @@ void srv_purge_shutdown(); ...@@ -837,9 +826,6 @@ void srv_purge_shutdown();
/** Init purge tasks*/ /** Init purge tasks*/
void srv_init_purge_tasks(uint n_max); void srv_init_purge_tasks(uint n_max);
/** Shut down purge tasks*/
void srv_shutdown_purge_tasks();
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Disables master thread. It's used by: /** Disables master thread. It's used by:
SET GLOBAL innodb_master_thread_disabled_debug = 1 (0). SET GLOBAL innodb_master_thread_disabled_debug = 1 (0).
...@@ -1034,18 +1020,15 @@ extern std::unique_ptr<tpool::timer> srv_master_timer; ...@@ -1034,18 +1020,15 @@ extern std::unique_ptr<tpool::timer> srv_master_timer;
extern std::unique_ptr<tpool::timer> srv_error_monitor_timer; extern std::unique_ptr<tpool::timer> srv_error_monitor_timer;
extern std::unique_ptr<tpool::timer> srv_monitor_timer; extern std::unique_ptr<tpool::timer> srv_monitor_timer;
#define SRV_MONITOR_TIMER_PERIOD 5000
static inline void srv_monitor_timer_schedule_now() static inline void srv_monitor_timer_schedule_now()
{ {
srv_monitor_timer->set_time(0, SRV_MONITOR_TIMER_PERIOD); srv_monitor_timer->set_time(0, 5000);
} }
static inline void srv_start_periodic_timer( static inline void srv_start_periodic_timer(std::unique_ptr<tpool::timer>& t,
std::unique_ptr<tpool::timer>& timer, void (*func)(void*), int period)
void (*func)(void*),
int period)
{ {
timer.reset(srv_thread_pool->create_timer(func)); t.reset(srv_thread_pool->create_timer(func));
timer->set_time(0, period); t->set_time(0, period);
} }
void srv_thread_pool_init(); void srv_thread_pool_init();
......
...@@ -50,7 +50,7 @@ dberr_t srv_start(bool create_new_db); ...@@ -50,7 +50,7 @@ dberr_t srv_start(bool create_new_db);
/** /**
Shutdown purge to make sure that there is no possibility that we call any Shutdown purge to make sure that there is no possibility that we call any
plugin code (e.g audit) inside virtual column computation. plugin code (e.g., audit) inside virtual column computation.
*/ */
void innodb_preshutdown(); void innodb_preshutdown();
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -53,16 +53,12 @@ Remove the undo log segment from the rseg slot if it is too big for reuse. ...@@ -53,16 +53,12 @@ Remove the undo log segment from the rseg slot if it is too big for reuse.
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void void
trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr); trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr);
/*******************************************************************//** /**
This function runs a purge batch. Run a purge batch.
@param n_tasks number of purge tasks to submit to the queue
@param truncate whether to truncate the history at the end of the batch
@return number of undo log pages handled in the batch */ @return number of undo log pages handled in the batch */
ulint ulint trx_purge(ulint n_tasks, bool truncate);
trx_purge(
/*======*/
ulint n_purge_threads, /*!< in: number of purge tasks to
submit to task queue. */
bool truncate /*!< in: truncate history if true */
);
/** Rollback segements from a given transaction with trx-no /** Rollback segements from a given transaction with trx-no
scheduled for purge. */ scheduled for purge. */
...@@ -224,7 +220,7 @@ class purge_sys_t ...@@ -224,7 +220,7 @@ class purge_sys_t
uninitialised. Real initialisation happens in create(). uninitialised. Real initialisation happens in create().
*/ */
purge_sys_t():m_initialized(false),m_enabled(false) {} purge_sys_t(): m_initialized(false), m_enabled(false) {}
/** Create the instance */ /** Create the instance */
......
...@@ -501,33 +501,31 @@ lock_wait_check_and_cancel( ...@@ -501,33 +501,31 @@ lock_wait_check_and_cancel(
} }
} }
/** Task that is periodically runs in the thread pool*/ /** A task which wakes up threads whose lock wait may have lasted too long */
void lock_wait_timeout_task(void*) void lock_wait_timeout_task(void*)
{ {
lock_wait_mutex_enter(); lock_wait_mutex_enter();
/* Check all slots for user threads that are waiting /* Check all slots for user threads that are waiting
on locks, and if they have exceeded the time limit. */ on locks, and if they have exceeded the time limit. */
bool any_slot_in_use = false; bool any_slot_in_use= false;
for (srv_slot_t* slot = lock_sys.waiting_threads; for (srv_slot_t *slot= lock_sys.waiting_threads;
slot < lock_sys.last_slot; slot < lock_sys.last_slot; ++slot)
++slot) { {
/* We are doing a read without the lock mutex and/or the trx
/* We are doing a read without the lock mutex mutex. This is OK because a slot can't be freed or reserved
and/or the trx mutex. This is OK because a slot without the lock wait mutex. */
can't be freed or reserved without the lock wait if (slot->in_use)
mutex. */ {
any_slot_in_use= true;
if (slot->in_use) { lock_wait_check_and_cancel(slot);
any_slot_in_use = true; }
lock_wait_check_and_cancel(slot); }
}
} if (any_slot_in_use)
if (any_slot_in_use) { lock_sys.timeout_timer->set_time(1000, 0);
lock_sys.timeout_timer->set_time(1000, 0); else
} else { lock_sys.timeout_timer_active= false;
lock_sys.timeout_timer_active = false;
} lock_wait_mutex_exit();
lock_wait_mutex_exit();
} }
...@@ -1605,7 +1605,7 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -1605,7 +1605,7 @@ logs_empty_and_mark_files_at_shutdown(void)
/* Check that the background threads are suspended */ /* Check that the background threads are suspended */
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
if (srv_n_fil_crypt_threads_started) { if (srv_n_fil_crypt_threads_started) {
os_event_set(fil_crypt_threads_event); os_event_set(fil_crypt_threads_event);
thread_name = "fil_crypt_thread"; thread_name = "fil_crypt_thread";
...@@ -1728,7 +1728,7 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -1728,7 +1728,7 @@ logs_empty_and_mark_files_at_shutdown(void)
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE; srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */ /* Make some checks that the server really is quiet */
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"Free innodb buffer pool"); "Free innodb buffer pool");
...@@ -1756,7 +1756,7 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -1756,7 +1756,7 @@ logs_empty_and_mark_files_at_shutdown(void)
fil_close_all_files(); fil_close_all_files();
/* Make some checks that the server really is quiet */ /* Make some checks that the server really is quiet */
ut_a(!srv_any_background_activity()); ut_ad(!srv_any_background_activity());
ut_a(lsn == log_sys.lsn ut_a(lsn == log_sys.lsn
|| srv_force_recovery == SRV_FORCE_NO_LOG_REDO); || srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
......
This diff is collapsed.
...@@ -510,11 +510,7 @@ srv_undo_tablespace_create( ...@@ -510,11 +510,7 @@ srv_undo_tablespace_create(
srv_read_only_mode ? OS_FILE_OPEN : OS_FILE_CREATE, srv_read_only_mode ? OS_FILE_OPEN : OS_FILE_CREATE,
OS_FILE_NORMAL, OS_DATA_FILE, srv_read_only_mode, &ret); OS_FILE_NORMAL, OS_DATA_FILE, srv_read_only_mode, &ret);
if (srv_read_only_mode && ret) { if (!ret) {
ib::info() << name << " opened in read-only mode";
} else if (ret == FALSE) {
if (os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS if (os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX #ifdef UNIV_AIX
/* AIX 5.1 after security patch ML7 may have /* AIX 5.1 after security patch ML7 may have
...@@ -527,9 +523,9 @@ srv_undo_tablespace_create( ...@@ -527,9 +523,9 @@ srv_undo_tablespace_create(
<< name; << name;
} }
err = DB_ERROR; err = DB_ERROR;
} else if (srv_read_only_mode) {
ib::info() << name << " opened in read-only mode";
} else { } else {
ut_a(!srv_read_only_mode);
/* We created the data file and now write it full of zeros */ /* We created the data file and now write it full of zeros */
ib::info() << "Data file " << name << " did not exist: new to" ib::info() << "Data file " << name << " did not exist: new to"
...@@ -1691,7 +1687,7 @@ dberr_t srv_start(bool create_new_db) ...@@ -1691,7 +1687,7 @@ dberr_t srv_start(bool create_new_db)
trx_sys.create(); trx_sys.create();
if (create_new_db) { if (create_new_db) {
ut_a(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
mtr_start(&mtr); mtr_start(&mtr);
ut_ad(fil_system.sys_space->id == 0); ut_ad(fil_system.sys_space->id == 0);
...@@ -2282,29 +2278,23 @@ void srv_shutdown_bg_undo_sources() ...@@ -2282,29 +2278,23 @@ void srv_shutdown_bg_undo_sources()
} }
/** /**
Perform pre-shutdown task. Shutdown purge to make sure that there is no possibility that we call any
plugin code (e.g., audit) inside virtual column computation.
Since purge tasks vall into server (some MDL acqusition,
and compute virtual functions), let them shut down right
after use connections go down while the rest of the server
infrasture is still intact.
*/ */
void innodb_preshutdown() void innodb_preshutdown()
{ {
static bool first_time = true; static bool first_time= true;
if (!first_time) if (!first_time)
return; return;
first_time = false; first_time= false;
if (!srv_read_only_mode) { if (srv_read_only_mode)
if (!srv_fast_shutdown && srv_operation == SRV_OPERATION_NORMAL) { return;
while (trx_sys.any_active_transactions()) { if (!srv_fast_shutdown && srv_operation == SRV_OPERATION_NORMAL)
os_thread_sleep(1000); while (trx_sys.any_active_transactions())
} os_thread_sleep(1000);
} srv_shutdown_bg_undo_sources();
srv_shutdown_bg_undo_sources(); srv_purge_shutdown();
srv_purge_shutdown();
}
} }
...@@ -2461,5 +2451,3 @@ srv_get_meta_data_filename( ...@@ -2461,5 +2451,3 @@ srv_get_meta_data_filename(
ut_free(path); ut_free(path);
} }
...@@ -173,17 +173,16 @@ void purge_sys_t::create() ...@@ -173,17 +173,16 @@ void purge_sys_t::create()
mutex_create(LATCH_ID_PURGE_SYS_PQ, &pq_mutex); mutex_create(LATCH_ID_PURGE_SYS_PQ, &pq_mutex);
truncate.current= NULL; truncate.current= NULL;
truncate.last= NULL; truncate.last= NULL;
m_initialized = true; m_initialized= true;
} }
/** Close the purge subsystem on shutdown. */ /** Close the purge subsystem on shutdown. */
void purge_sys_t::close() void purge_sys_t::close()
{ {
ut_ad(this == &purge_sys);
if (!m_initialized) if (!m_initialized)
return; return;
ut_ad(this == &purge_sys);
ut_ad(!enabled()); ut_ad(!enabled());
trx_t* trx = query->trx; trx_t* trx = query->trx;
que_graph_free(query); que_graph_free(query);
...@@ -193,7 +192,7 @@ void purge_sys_t::close() ...@@ -193,7 +192,7 @@ void purge_sys_t::close()
trx_free(trx); trx_free(trx);
rw_lock_free(&latch); rw_lock_free(&latch);
mutex_free(&pq_mutex); mutex_free(&pq_mutex);
m_initialized = false; m_initialized= false;
} }
/*================ UNDO LOG HISTORY LIST =============================*/ /*================ UNDO LOG HISTORY LIST =============================*/
...@@ -1252,31 +1251,25 @@ trx_purge_dml_delay(void) ...@@ -1252,31 +1251,25 @@ trx_purge_dml_delay(void)
extern tpool::waitable_task purge_worker_task; extern tpool::waitable_task purge_worker_task;
/** Wait for pending purge jobs to complete. */ /** Wait for pending purge jobs to complete. */
static static void trx_purge_wait_for_workers_to_complete()
void
trx_purge_wait_for_workers_to_complete()
{ {
purge_worker_task.wait(); purge_worker_task.wait();
/* There should be no outstanding tasks as long /* There should be no outstanding tasks as long
as the worker threads are active. */ as the worker threads are active. */
ut_a(srv_get_task_queue_length() == 0); ut_ad(srv_get_task_queue_length() == 0);
} }
/*******************************************************************//** /**
This function runs a purge batch. Run a purge batch.
@param n_tasks number of purge tasks to submit to the queue
@param truncate whether to truncate the history at the end of the batch
@return number of undo log pages handled in the batch */ @return number of undo log pages handled in the batch */
ulint ulint trx_purge(ulint n_tasks, bool truncate)
trx_purge(
/*======*/
ulint n_purge_threads, /*!< in: number of purge tasks
to submit to the work queue */
bool truncate /*!< in: truncate history if true */
)
{ {
que_thr_t* thr = NULL; que_thr_t* thr = NULL;
ulint n_pages_handled; ulint n_pages_handled;
ut_a(n_purge_threads > 0); ut_ad(n_tasks > 0);
srv_dml_needed_delay = trx_purge_dml_delay(); srv_dml_needed_delay = trx_purge_dml_delay();
...@@ -1291,10 +1284,10 @@ trx_purge( ...@@ -1291,10 +1284,10 @@ trx_purge(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/* Fetch the UNDO recs that need to be purged. */ /* Fetch the UNDO recs that need to be purged. */
n_pages_handled = trx_purge_attach_undo_recs(n_purge_threads); n_pages_handled = trx_purge_attach_undo_recs(n_tasks);
/* Submit tasks to workers queue if using multi-threaded purge. */ /* Submit tasks to workers queue if using multi-threaded purge. */
for (ulint i = 0; i < n_purge_threads-1; i++) { for (ulint i = n_tasks; --i; ) {
thr = que_fork_scheduler_round_robin(purge_sys.query, thr); thr = que_fork_scheduler_round_robin(purge_sys.query, thr);
ut_a(thr); ut_a(thr);
srv_que_task_enqueue_low(thr); srv_que_task_enqueue_low(thr);
......
Markdown is supported
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