Skip to content

Commit

Permalink
Merge 10.2 into bb-10.2-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Feb 15, 2018
2 parents 7bd81c7 + 27ea296 commit 22770a9
Show file tree
Hide file tree
Showing 32 changed files with 70 additions and 263 deletions.
6 changes: 4 additions & 2 deletions sql/handler.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
Copyright (c) 2009, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -797,7 +797,9 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
*/
void ha_close_connection(THD* thd)
{
plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0);
plugin_foreach_with_mask(thd, closecon_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN,
PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
}

static my_bool kill_handlerton(THD *thd, plugin_ref plugin,
Expand Down
22 changes: 12 additions & 10 deletions sql/sql_load.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,25 @@ the transaction after every 10,000 inserted rows. */
static bool wsrep_load_data_split(THD *thd, const TABLE *table,
const COPY_INFO &info)
{
extern struct handlerton* innodb_hton_ptr;

DBUG_ENTER("wsrep_load_data_split");

if (wsrep_load_data_splitting && wsrep_on(thd)
&& info.records && !(info.records % 10000)
&& thd->transaction.stmt.ha_list
&& thd->transaction.stmt.ha_list->ht() == binlog_hton
&& thd->transaction.stmt.ha_list->next()
&& thd->transaction.stmt.ha_list->next()->ht() == innodb_hton_ptr
&& !thd->transaction.stmt.ha_list->next()->next())
if (!wsrep_load_data_splitting || !wsrep_on(thd)
|| !info.records || (info.records % 10000)
|| !thd->transaction.stmt.ha_list
|| thd->transaction.stmt.ha_list->ht() != binlog_hton
|| !thd->transaction.stmt.ha_list->next()
|| thd->transaction.stmt.ha_list->next()->next())
DBUG_RETURN(false);

if (handlerton* hton= thd->transaction.stmt.ha_list->next()->ht())
{
if (hton->db_type != DB_TYPE_INNODB)
DBUG_RETURN(false);
WSREP_DEBUG("intermediate transaction commit in LOAD DATA");
if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true);
if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true);
wsrep_post_commit(thd, true);
innodb_hton_ptr->commit(innodb_hton_ptr, thd, true);
hton->commit(hton, thd, true);
table->file->extra(HA_EXTRA_FAKE_START_STMT);
}

Expand Down
5 changes: 4 additions & 1 deletion sql/wsrep_var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ int wsrep_init_vars()
return 0;
}

extern ulong innodb_lock_schedule_algorithm;
/* This is intentionally declared as a weak global symbol, so that
linking will succeed even if the server is built with a dynamically
linked InnoDB. */
ulong innodb_lock_schedule_algorithm __attribute__((weak));

bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ SET(INNOBASE_SOURCES
trx/trx0sys.cc
trx/trx0trx.cc
trx/trx0undo.cc
usr/usr0sess.cc
ut/ut0crc32.cc
ut/ut0dbg.cc
ut/ut0list.cc
Expand All @@ -151,6 +150,7 @@ SET(INNOBASE_SOURCES
ut/ut0timer.cc)

MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_innodb
DEFAULT RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES
${ZLIB_LIBRARY}
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/dict/dict0crea.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -38,7 +38,6 @@ Created 1/8/1996 Heikki Tuuri
#include "row0mysql.h"
#include "pars0pars.h"
#include "trx0roll.h"
#include "usr0sess.h"
#include "ut0vec.h"
#include "dict0priv.h"
#include "fts0priv.h"
Expand Down
8 changes: 7 additions & 1 deletion storage/innobase/fts/fts0fts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,7 @@ fts_cmp_set_sync_doc_id(
fts_table.parent = table->name.m_name;

trx = trx_allocate_for_background();
trx_start_internal(trx);

trx->op_info = "update the next FTS document id";

Expand Down Expand Up @@ -2819,6 +2820,7 @@ fts_update_sync_doc_id(

if (!trx) {
trx = trx_allocate_for_background();
trx_start_internal(trx);

trx->op_info = "setting last FTS document id";
local_trx = TRUE;
Expand Down Expand Up @@ -3056,6 +3058,8 @@ fts_commit_table(
fts_cache_t* cache = ftt->table->fts->cache;
trx_t* trx = trx_allocate_for_background();

trx_start_internal(trx);

rows = ftt->rows;

ftt->fts_trx->trx = trx;
Expand Down Expand Up @@ -3792,6 +3796,7 @@ fts_doc_fetch_by_doc_id(
trx_t* trx = trx_allocate_for_background();
que_t* graph;

trx_start_internal(trx);
trx->op_info = "fetching indexed FTS document";

/* The FTS index can be supplied by caller directly with
Expand Down Expand Up @@ -4138,6 +4143,7 @@ fts_sync_begin(
sync->start_time = ut_time();

sync->trx = trx_allocate_for_background();
trx_start_internal(sync->trx);

if (fts_enable_diag_print) {
ib::info() << "FTS SYNC for table " << sync->table->name
Expand Down Expand Up @@ -5008,7 +5014,6 @@ fts_get_rows_count(
char table_name[MAX_FULL_NAME_LEN];

trx = trx_allocate_for_background();

trx->op_info = "fetching FT table rows count";

info = pars_info_create();
Expand Down Expand Up @@ -7330,6 +7335,7 @@ fts_load_stopword(

if (!trx) {
trx = trx_allocate_for_background();
trx_start_internal(trx);
trx->op_info = "upload FTS stopword";
new_trx = TRUE;
}
Expand Down
5 changes: 4 additions & 1 deletion storage/innobase/fts/fts0opt.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
Copyright (c) 2016, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -989,6 +989,7 @@ fts_table_fetch_doc_ids(

if (!trx) {
trx = trx_allocate_for_background();
trx_start_internal(trx);
alloc_bk_trx = TRUE;
}

Expand Down Expand Up @@ -1619,6 +1620,7 @@ fts_optimize_create(
optim->table = table;

optim->trx = trx_allocate_for_background();
trx_start_internal(optim->trx);

optim->fts_common_table.parent = table->name.m_name;
optim->fts_common_table.table_id = table->id;
Expand Down Expand Up @@ -1741,6 +1743,7 @@ fts_optimize_free(
{
mem_heap_t* heap = static_cast<mem_heap_t*>(optim->self_heap->arg);

trx_commit_for_mysql(optim->trx);
trx_free_for_background(optim->trx);

fts_doc_ids_free(optim->to_delete);
Expand Down
32 changes: 12 additions & 20 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,9 @@ innodb_check_deprecated(void);

#ifdef WITH_WSREP
#include "dict0priv.h"
#include "../storage/innobase/include/ut0byte.h"
#include "ut0byte.h"
#include <mysql/service_md5.h>

class binlog_trx_data;
extern handlerton *binlog_hton;

extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;

static inline wsrep_ws_handle_t*
Expand Down Expand Up @@ -1957,14 +1954,11 @@ thd_innodb_tmpdir(
}

/** Obtain the InnoDB transaction of a MySQL thread.
@param[in,out] thd MySQL thread handler.
@param[in,out] thd thread handle
@return reference to transaction pointer */
MY_ATTRIBUTE((warn_unused_result))
trx_t*&
thd_to_trx(
THD* thd)
static trx_t* thd_to_trx(THD* thd)
{
return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr));
return *reinterpret_cast<trx_t**>(thd_ha_data(thd, innodb_hton_ptr));
}

#ifdef WITH_WSREP
Expand Down Expand Up @@ -2873,20 +2867,19 @@ check_trx_exists(
/*=============*/
THD* thd) /*!< in: user thread handle */
{
trx_t*& trx = thd_to_trx(thd);

if (trx == NULL) {
if (trx_t* trx = thd_to_trx(thd)) {
ut_a(trx->magic_n == TRX_MAGIC_N);
innobase_trx_init(thd, trx);
return trx;
} else {
trx = innobase_trx_allocate(thd);
/* User trx can be forced to rollback,
so we unset the disable flag. */
ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE);
trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK;
} else {
ut_a(trx->magic_n == TRX_MAGIC_N);
innobase_trx_init(thd, trx);
thd_set_ha_data(thd, innodb_hton_ptr, trx);
return trx;
}

return(trx);
}

/*************************************************************************
Expand All @@ -2896,8 +2889,7 @@ innobase_get_trx()
{
THD *thd=current_thd;
if (likely(thd != 0)) {
trx_t*& trx = thd_to_trx(thd);
return(trx);
return thd_to_trx(thd);
} else {
return(NULL);
}
Expand Down
7 changes: 1 addition & 6 deletions storage/innobase/handler/ha_innodb.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -911,11 +911,6 @@ innodb_base_col_setup_for_stored(
create_table_info_t::normalize_table_name_low(norm_name, name, FALSE)
#endif /* _WIN32 */

/** Obtain the InnoDB transaction of a MySQL thread.
@param[in,out] thd MySQL thread handler.
@return reference to transaction pointer */
trx_t*& thd_to_trx(THD* thd);

/** Converts an InnoDB error code to a MySQL error code.
Also tells to MySQL about a possible transaction rollback inside InnoDB caused
by a lock wait timeout or a deadlock.
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/include/pars0opt.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -29,7 +29,6 @@ Created 12/21/1997 Heikki Tuuri

#include "univ.i"
#include "que0types.h"
#include "usr0types.h"
#include "pars0sym.h"
#include "dict0types.h"
#include "row0sel.h"
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/include/pars0pars.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -29,7 +29,6 @@ Created 11/19/1996 Heikki Tuuri

#include "univ.i"
#include "que0types.h"
#include "usr0types.h"
#include "pars0types.h"
#include "row0types.h"
#include "trx0types.h"
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/include/pars0sym.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -29,7 +29,6 @@ Created 12/15/1997 Heikki Tuuri

#include "univ.i"
#include "que0types.h"
#include "usr0types.h"
#include "dict0types.h"
#include "pars0types.h"
#include "row0types.h"
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/include/que0que.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -33,7 +33,6 @@ Created 5/27/1996 Heikki Tuuri
#include "trx0trx.h"
#include "trx0roll.h"
#include "srv0srv.h"
#include "usr0types.h"
#include "que0types.h"
#include "row0types.h"
#include "pars0types.h"
Expand Down
2 changes: 0 additions & 2 deletions storage/innobase/include/que0que.ic
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Query graph
Created 5/27/1996 Heikki Tuuri
*******************************************************/

#include "usr0sess.h"

/***********************************************************************//**
Gets the trx of a query thread. */
UNIV_INLINE
Expand Down
5 changes: 1 addition & 4 deletions storage/innobase/include/trx0purge.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
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
Expand Down Expand Up @@ -33,7 +33,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0sys.h"
#include "que0types.h"
#include "page0page.h"
#include "usr0sess.h"
#include "fil0fil.h"
#include "read0types.h"

Expand Down Expand Up @@ -494,8 +493,6 @@ class purge_sys_t
/** Destruct the purge system. */
~purge_sys_t();

sess_t* sess; /*!< System session running the purge
query */
rw_lock_t latch; /*!< The latch protecting the purge
view. A purge operation must acquire an
x-latch here for the instant at which
Expand Down
Loading

0 comments on commit 22770a9

Please sign in to comment.