Merge 10.2 into bb-10.2-ext

This commit is contained in:
Marko Mäkelä 2018-02-15 10:57:27 +02:00
commit 22770a9f9a
32 changed files with 70 additions and 263 deletions

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. /* 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 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 it under the terms of the GNU General Public License as published by
@ -797,7 +797,9 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
*/ */
void ha_close_connection(THD* thd) 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, static my_bool kill_handlerton(THD *thd, plugin_ref plugin,

View File

@ -104,23 +104,25 @@ the transaction after every 10,000 inserted rows. */
static bool wsrep_load_data_split(THD *thd, const TABLE *table, static bool wsrep_load_data_split(THD *thd, const TABLE *table,
const COPY_INFO &info) const COPY_INFO &info)
{ {
extern struct handlerton* innodb_hton_ptr;
DBUG_ENTER("wsrep_load_data_split"); DBUG_ENTER("wsrep_load_data_split");
if (wsrep_load_data_splitting && wsrep_on(thd) if (!wsrep_load_data_splitting || !wsrep_on(thd)
&& info.records && !(info.records % 10000) || !info.records || (info.records % 10000)
&& thd->transaction.stmt.ha_list || !thd->transaction.stmt.ha_list
&& thd->transaction.stmt.ha_list->ht() == binlog_hton || thd->transaction.stmt.ha_list->ht() != binlog_hton
&& thd->transaction.stmt.ha_list->next() || !thd->transaction.stmt.ha_list->next()
&& thd->transaction.stmt.ha_list->next()->ht() == innodb_hton_ptr || thd->transaction.stmt.ha_list->next()->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"); WSREP_DEBUG("intermediate transaction commit in LOAD DATA");
if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true); if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true);
if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true); if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true);
wsrep_post_commit(thd, 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); table->file->extra(HA_EXTRA_FAKE_START_STMT);
} }

View File

@ -42,7 +42,10 @@ int wsrep_init_vars()
return 0; 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) bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{ {

View File

@ -137,7 +137,6 @@ SET(INNOBASE_SOURCES
trx/trx0sys.cc trx/trx0sys.cc
trx/trx0trx.cc trx/trx0trx.cc
trx/trx0undo.cc trx/trx0undo.cc
usr/usr0sess.cc
ut/ut0crc32.cc ut/ut0crc32.cc
ut/ut0dbg.cc ut/ut0dbg.cc
ut/ut0list.cc ut/ut0list.cc
@ -151,6 +150,7 @@ SET(INNOBASE_SOURCES
ut/ut0timer.cc) ut/ut0timer.cc)
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_innodb
DEFAULT RECOMPILE_FOR_EMBEDDED DEFAULT RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES LINK_LIBRARIES
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
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, MariaDB Corporation. Copyright (c) 2017, 2018, 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
@ -38,7 +38,6 @@ Created 1/8/1996 Heikki Tuuri
#include "row0mysql.h" #include "row0mysql.h"
#include "pars0pars.h" #include "pars0pars.h"
#include "trx0roll.h" #include "trx0roll.h"
#include "usr0sess.h"
#include "ut0vec.h" #include "ut0vec.h"
#include "dict0priv.h" #include "dict0priv.h"
#include "fts0priv.h" #include "fts0priv.h"

View File

@ -2699,6 +2699,7 @@ retry:
fts_table.parent = table->name.m_name; fts_table.parent = table->name.m_name;
trx = trx_allocate_for_background(); trx = trx_allocate_for_background();
trx_start_internal(trx);
trx->op_info = "update the next FTS document id"; trx->op_info = "update the next FTS document id";
@ -2819,6 +2820,7 @@ fts_update_sync_doc_id(
if (!trx) { if (!trx) {
trx = trx_allocate_for_background(); trx = trx_allocate_for_background();
trx_start_internal(trx);
trx->op_info = "setting last FTS document id"; trx->op_info = "setting last FTS document id";
local_trx = TRUE; local_trx = TRUE;
@ -3056,6 +3058,8 @@ fts_commit_table(
fts_cache_t* cache = ftt->table->fts->cache; fts_cache_t* cache = ftt->table->fts->cache;
trx_t* trx = trx_allocate_for_background(); trx_t* trx = trx_allocate_for_background();
trx_start_internal(trx);
rows = ftt->rows; rows = ftt->rows;
ftt->fts_trx->trx = trx; ftt->fts_trx->trx = trx;
@ -3792,6 +3796,7 @@ fts_doc_fetch_by_doc_id(
trx_t* trx = trx_allocate_for_background(); trx_t* trx = trx_allocate_for_background();
que_t* graph; que_t* graph;
trx_start_internal(trx);
trx->op_info = "fetching indexed FTS document"; trx->op_info = "fetching indexed FTS document";
/* The FTS index can be supplied by caller directly with /* The FTS index can be supplied by caller directly with
@ -4138,6 +4143,7 @@ fts_sync_begin(
sync->start_time = ut_time(); sync->start_time = ut_time();
sync->trx = trx_allocate_for_background(); sync->trx = trx_allocate_for_background();
trx_start_internal(sync->trx);
if (fts_enable_diag_print) { if (fts_enable_diag_print) {
ib::info() << "FTS SYNC for table " << sync->table->name ib::info() << "FTS SYNC for table " << sync->table->name
@ -5008,7 +5014,6 @@ fts_get_rows_count(
char table_name[MAX_FULL_NAME_LEN]; char table_name[MAX_FULL_NAME_LEN];
trx = trx_allocate_for_background(); trx = trx_allocate_for_background();
trx->op_info = "fetching FT table rows count"; trx->op_info = "fetching FT table rows count";
info = pars_info_create(); info = pars_info_create();
@ -7330,6 +7335,7 @@ fts_load_stopword(
if (!trx) { if (!trx) {
trx = trx_allocate_for_background(); trx = trx_allocate_for_background();
trx_start_internal(trx);
trx->op_info = "upload FTS stopword"; trx->op_info = "upload FTS stopword";
new_trx = TRUE; new_trx = TRUE;
} }

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved. 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 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
@ -989,6 +989,7 @@ fts_table_fetch_doc_ids(
if (!trx) { if (!trx) {
trx = trx_allocate_for_background(); trx = trx_allocate_for_background();
trx_start_internal(trx);
alloc_bk_trx = TRUE; alloc_bk_trx = TRUE;
} }
@ -1619,6 +1620,7 @@ fts_optimize_create(
optim->table = table; optim->table = table;
optim->trx = trx_allocate_for_background(); optim->trx = trx_allocate_for_background();
trx_start_internal(optim->trx);
optim->fts_common_table.parent = table->name.m_name; optim->fts_common_table.parent = table->name.m_name;
optim->fts_common_table.table_id = table->id; optim->fts_common_table.table_id = table->id;
@ -1741,6 +1743,7 @@ fts_optimize_free(
{ {
mem_heap_t* heap = static_cast<mem_heap_t*>(optim->self_heap->arg); 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); trx_free_for_background(optim->trx);
fts_doc_ids_free(optim->to_delete); fts_doc_ids_free(optim->to_delete);

View File

@ -154,12 +154,9 @@ innodb_check_deprecated(void);
#ifdef WITH_WSREP #ifdef WITH_WSREP
#include "dict0priv.h" #include "dict0priv.h"
#include "../storage/innobase/include/ut0byte.h" #include "ut0byte.h"
#include <mysql/service_md5.h> #include <mysql/service_md5.h>
class binlog_trx_data;
extern handlerton *binlog_hton;
extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log; extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
static inline wsrep_ws_handle_t* static inline wsrep_ws_handle_t*
@ -1957,14 +1954,11 @@ thd_innodb_tmpdir(
} }
/** Obtain the InnoDB transaction of a MySQL thread. /** 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 */ @return reference to transaction pointer */
MY_ATTRIBUTE((warn_unused_result)) static trx_t* thd_to_trx(THD* thd)
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 #ifdef WITH_WSREP
@ -2873,20 +2867,19 @@ check_trx_exists(
/*=============*/ /*=============*/
THD* thd) /*!< in: user thread handle */ THD* thd) /*!< in: user thread handle */
{ {
trx_t*& trx = thd_to_trx(thd); if (trx_t* trx = thd_to_trx(thd)) {
ut_a(trx->magic_n == TRX_MAGIC_N);
if (trx == NULL) { innobase_trx_init(thd, trx);
return trx;
} else {
trx = innobase_trx_allocate(thd); trx = innobase_trx_allocate(thd);
/* User trx can be forced to rollback, /* User trx can be forced to rollback,
so we unset the disable flag. */ so we unset the disable flag. */
ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE); ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE);
trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK; trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK;
} else { thd_set_ha_data(thd, innodb_hton_ptr, trx);
ut_a(trx->magic_n == TRX_MAGIC_N); return trx;
innobase_trx_init(thd, trx);
} }
return(trx);
} }
/************************************************************************* /*************************************************************************
@ -2896,8 +2889,7 @@ innobase_get_trx()
{ {
THD *thd=current_thd; THD *thd=current_thd;
if (likely(thd != 0)) { if (likely(thd != 0)) {
trx_t*& trx = thd_to_trx(thd); return thd_to_trx(thd);
return(trx);
} else { } else {
return(NULL); return(NULL);
} }

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. 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 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
@ -911,11 +911,6 @@ innodb_base_col_setup_for_stored(
create_table_info_t::normalize_table_name_low(norm_name, name, FALSE) create_table_info_t::normalize_table_name_low(norm_name, name, FALSE)
#endif /* _WIN32 */ #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. /** Converts an InnoDB error code to a MySQL error code.
Also tells to MySQL about a possible transaction rollback inside InnoDB caused Also tells to MySQL about a possible transaction rollback inside InnoDB caused
by a lock wait timeout or a deadlock. by a lock wait timeout or a deadlock.

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@ -29,7 +29,6 @@ Created 12/21/1997 Heikki Tuuri
#include "univ.i" #include "univ.i"
#include "que0types.h" #include "que0types.h"
#include "usr0types.h"
#include "pars0sym.h" #include "pars0sym.h"
#include "dict0types.h" #include "dict0types.h"
#include "row0sel.h" #include "row0sel.h"

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
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, MariaDB Corporation. Copyright (c) 2017, 2018, 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
@ -29,7 +29,6 @@ Created 11/19/1996 Heikki Tuuri
#include "univ.i" #include "univ.i"
#include "que0types.h" #include "que0types.h"
#include "usr0types.h"
#include "pars0types.h" #include "pars0types.h"
#include "row0types.h" #include "row0types.h"
#include "trx0types.h" #include "trx0types.h"

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@ -29,7 +29,6 @@ Created 12/15/1997 Heikki Tuuri
#include "univ.i" #include "univ.i"
#include "que0types.h" #include "que0types.h"
#include "usr0types.h"
#include "dict0types.h" #include "dict0types.h"
#include "pars0types.h" #include "pars0types.h"
#include "row0types.h" #include "row0types.h"

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
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, MariaDB Corporation. Copyright (c) 2017, 2018, 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
@ -33,7 +33,6 @@ Created 5/27/1996 Heikki Tuuri
#include "trx0trx.h" #include "trx0trx.h"
#include "trx0roll.h" #include "trx0roll.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "usr0types.h"
#include "que0types.h" #include "que0types.h"
#include "row0types.h" #include "row0types.h"
#include "pars0types.h" #include "pars0types.h"

View File

@ -23,8 +23,6 @@ Query graph
Created 5/27/1996 Heikki Tuuri Created 5/27/1996 Heikki Tuuri
*******************************************************/ *******************************************************/
#include "usr0sess.h"
/***********************************************************************//** /***********************************************************************//**
Gets the trx of a query thread. */ Gets the trx of a query thread. */
UNIV_INLINE UNIV_INLINE

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
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, 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 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
@ -33,7 +33,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0sys.h" #include "trx0sys.h"
#include "que0types.h" #include "que0types.h"
#include "page0page.h" #include "page0page.h"
#include "usr0sess.h"
#include "fil0fil.h" #include "fil0fil.h"
#include "read0types.h" #include "read0types.h"
@ -494,8 +493,6 @@ public:
/** Destruct the purge system. */ /** Destruct the purge system. */
~purge_sys_t(); ~purge_sys_t();
sess_t* sess; /*!< System session running the purge
query */
rw_lock_t latch; /*!< The latch protecting the purge rw_lock_t latch; /*!< The latch protecting the purge
view. A purge operation must acquire an view. A purge operation must acquire an
x-latch here for the instant at which x-latch here for the instant at which

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
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) 2015, 2017, MariaDB Corporation. Copyright (c) 2015, 2018, 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
@ -38,7 +38,6 @@ Created 3/26/1996 Heikki Tuuri
#include "lock0types.h" #include "lock0types.h"
#include "log0log.h" #include "log0log.h"
#include "usr0types.h"
#include "que0types.h" #include "que0types.h"
#include "mem0mem.h" #include "mem0mem.h"
#include "trx0xa.h" #include "trx0xa.h"
@ -55,9 +54,6 @@ class ReadView;
// Forward declaration // Forward declaration
class FlushObserver; class FlushObserver;
/** Dummy session used currently in MySQL interface */
extern sess_t* trx_dummy_sess;
/** Set flush observer for the transaction /** Set flush observer for the transaction
@param[in/out] trx transaction struct @param[in/out] trx transaction struct
@param[in] observer flush observer */ @param[in] observer flush observer */
@ -1139,7 +1135,6 @@ struct trx_t {
ulint error_key_num; /*!< if the index creation fails to a ulint error_key_num; /*!< if the index creation fails to a
duplicate key error, a mysql key duplicate key error, a mysql key
number of that index is stored here */ number of that index is stored here */
sess_t* sess; /*!< session of the trx, NULL if none */
que_t* graph; /*!< query currently run in the session, que_t* graph; /*!< query currently run in the session,
or NULL if none; NOTE that the query or NULL if none; NOTE that the query
belongs to the session, and it can belongs to the session, and it can

View File

@ -1,69 +0,0 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
/**************************************************//**
@file include/usr0sess.h
Sessions
Created 6/25/1996 Heikki Tuuri
*******************************************************/
#ifndef usr0sess_h
#define usr0sess_h
#include "univ.i"
#include "ut0byte.h"
#include "trx0types.h"
#include "srv0srv.h"
#include "trx0types.h"
#include "usr0types.h"
#include "que0types.h"
#include "data0data.h"
#include "rem0rec.h"
/*********************************************************************//**
Opens a session.
@return own: session object */
sess_t*
sess_open(void);
/*============*/
/*********************************************************************//**
Closes a session, freeing the memory occupied by it. */
void
sess_close(
/*=======*/
sess_t* sess); /* in, own: session object */
/* The session handle. This data structure is only used by purge and is
not really necessary. We should get rid of it. */
struct sess_t{
ulint state; /*!< state of the session */
trx_t* trx; /*!< transaction object permanently
assigned for the session: the
transaction instance designated by the
trx id changes, but the memory
structure is preserved */
};
/* Session states */
#define SESS_ACTIVE 1
#define SESS_ERROR 2 /* session contains an error message
which has not yet been communicated
to the client */
#endif

View File

@ -1,31 +0,0 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Oracle and/or its affiliates. All Rights Reserved.
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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
/**************************************************//**
@file include/usr0types.h
Users and sessions global types
Created 6/25/1996 Heikki Tuuri
*******************************************************/
#ifndef usr0types_h
#define usr0types_h
struct sess_t;
#endif

View File

@ -35,7 +35,6 @@ Created 5/7/1996 Heikki Tuuri
#include "lock0lock.h" #include "lock0lock.h"
#include "lock0priv.h" #include "lock0priv.h"
#include "dict0mem.h" #include "dict0mem.h"
#include "usr0sess.h"
#include "trx0purge.h" #include "trx0purge.h"
#include "trx0sys.h" #include "trx0sys.h"
#include "srv0mon.h" #include "srv0mon.h"
@ -54,7 +53,7 @@ Created 5/7/1996 Heikki Tuuri
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/** Lock scheduling algorithm */ /** Lock scheduling algorithm */
ulong innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS; ulong innodb_lock_schedule_algorithm;
/** The value of innodb_deadlock_detect */ /** The value of innodb_deadlock_detect */
my_bool innobase_deadlock_detect; my_bool innobase_deadlock_detect;

View File

@ -29,7 +29,6 @@ Created 9/7/2013 Jimmy Yang
#include "lock0priv.h" #include "lock0priv.h"
#include "lock0prdt.h" #include "lock0prdt.h"
#include "ha_prototypes.h" #include "ha_prototypes.h"
#include "usr0sess.h"
#include "trx0purge.h" #include "trx0purge.h"
#include "dict0mem.h" #include "dict0mem.h"
#include "dict0boot.h" #include "dict0boot.h"

View File

@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc. Copyright (c) 2009, Google Inc.
Copyright (c) 2014, 2017, MariaDB Corporation. Copyright (c) 2014, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -1584,8 +1584,6 @@ log_write_checkpoint_info(bool sync, lsn_t end_lsn)
rw_lock_s_lock(&log_sys->checkpoint_lock); rw_lock_s_lock(&log_sys->checkpoint_lock);
rw_lock_s_unlock(&log_sys->checkpoint_lock); rw_lock_s_unlock(&log_sys->checkpoint_lock);
DEBUG_SYNC_C("checkpoint_completed");
DBUG_EXECUTE_IF( DBUG_EXECUTE_IF(
"crash_after_checkpoint", "crash_after_checkpoint",
DBUG_SUICIDE();); DBUG_SUICIDE(););

View File

@ -27,7 +27,6 @@ Created 5/27/1996 Heikki Tuuri
#include "ha_prototypes.h" #include "ha_prototypes.h"
#include "que0que.h" #include "que0que.h"
#include "usr0sess.h"
#include "trx0trx.h" #include "trx0trx.h"
#include "trx0roll.h" #include "trx0roll.h"
#include "row0undo.h" #include "row0undo.h"

View File

@ -45,7 +45,6 @@ Created 4/20/1996 Heikki Tuuri
#include "log0log.h" #include "log0log.h"
#include "eval0eval.h" #include "eval0eval.h"
#include "data0data.h" #include "data0data.h"
#include "usr0sess.h"
#include "buf0lru.h" #include "buf0lru.h"
#include "fts0fts.h" #include "fts0fts.h"
#include "fts0types.h" #include "fts0types.h"

View File

@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2017, MariaDB Corporation. Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -70,7 +70,6 @@ Created 10/8/1995 Heikki Tuuri
#include "sync0sync.h" #include "sync0sync.h"
#include "trx0i_s.h" #include "trx0i_s.h"
#include "trx0purge.h" #include "trx0purge.h"
#include "usr0sess.h"
#include "ut0crc32.h" #include "ut0crc32.h"
#include "btr0defragment.h" #include "btr0defragment.h"
#include "ut0mem.h" #include "ut0mem.h"

View File

@ -88,7 +88,6 @@ Created 2/16/1996 Heikki Tuuri
#include "dict0load.h" #include "dict0load.h"
#include "dict0stats_bg.h" #include "dict0stats_bg.h"
#include "que0que.h" #include "que0que.h"
#include "usr0sess.h"
#include "lock0lock.h" #include "lock0lock.h"
#include "trx0roll.h" #include "trx0roll.h"
#include "trx0purge.h" #include "trx0purge.h"

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, 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 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
@ -165,21 +165,15 @@ TrxUndoRsegsIterator::set_next()
/** Build a purge 'query' graph. The actual purge is performed by executing /** Build a purge 'query' graph. The actual purge is performed by executing
this query graph. this query graph.
@param[in,out] sess the purge session
@return own: the query graph */ @return own: the query graph */
static static
que_t* que_t*
trx_purge_graph_build(sess_t* sess) purge_graph_build()
{ {
ut_a(srv_n_purge_threads > 0); ut_a(srv_n_purge_threads > 0);
/* A purge transaction is not a real transaction, we use a transaction
here only because the query threads code requires it. It is otherwise
quite unnecessary. We should get rid of it eventually. */
trx_t* trx = sess->trx;
ut_ad(trx->sess == sess); trx_t* trx = trx_allocate_for_background();
ut_ad(!trx->id);
trx->id = 0;
trx->start_time = ut_time(); trx->start_time = ut_time();
trx->state = TRX_STATE_ACTIVE; trx->state = TRX_STATE_ACTIVE;
trx->op_info = "purge trx"; trx->op_info = "purge trx";
@ -199,9 +193,9 @@ trx_purge_graph_build(sess_t* sess)
/** Construct the purge system. */ /** Construct the purge system. */
purge_sys_t::purge_sys_t() purge_sys_t::purge_sys_t()
: sess(sess_open()), latch(), event(os_event_create(0)), : latch(), event(os_event_create(0)),
n_stop(0), running(false), state(PURGE_STATE_INIT), n_stop(0), running(false), state(PURGE_STATE_INIT),
query(trx_purge_graph_build(sess)), query(purge_graph_build()),
view(), n_submitted(0), n_completed(0), view(), n_submitted(0), n_completed(0),
iter(), limit(), iter(), limit(),
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
@ -221,10 +215,12 @@ purge_sys_t::~purge_sys_t()
{ {
ut_ad(this == purge_sys); ut_ad(this == purge_sys);
trx_t* trx = query->trx;
que_graph_free(query); que_graph_free(query);
ut_a(sess->trx->id == 0); ut_ad(!trx->id);
sess->trx->state = TRX_STATE_NOT_STARTED; ut_ad(trx->state == TRX_STATE_ACTIVE);
sess_close(sess); trx->state = TRX_STATE_NOT_STARTED;
trx_free_for_background(trx);
view.close(); view.close();
rw_lock_free(&latch); rw_lock_free(&latch);
/* rw_lock_free() already called latch.~rw_lock_t(); tame the /* rw_lock_free() already called latch.~rw_lock_t(); tame the

View File

@ -47,7 +47,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0sys.h" #include "trx0sys.h"
#include "trx0trx.h" #include "trx0trx.h"
#include "trx0undo.h" #include "trx0undo.h"
#include "usr0sess.h"
#include "ha_prototypes.h" #include "ha_prototypes.h"
/** This many pages must be undone before a truncate is tried within /** This many pages must be undone before a truncate is tried within

View File

@ -500,8 +500,6 @@ trx_sys_init_at_db_start()
mtr.commit(); mtr.commit();
ut_d(trx_sys->rw_max_trx_id = trx_sys->max_trx_id); ut_d(trx_sys->rw_max_trx_id = trx_sys->max_trx_id);
trx_dummy_sess = sess_open();
trx_lists_init_at_db_start(); trx_lists_init_at_db_start();
/* This mutex is not strictly required, it is here only to satisfy /* This mutex is not strictly required, it is here only to satisfy
@ -928,11 +926,6 @@ trx_sys_close(void)
" shutdown: " << size << " read views open"; " shutdown: " << size << " read views open";
} }
if (trx_dummy_sess) {
sess_close(trx_dummy_sess);
trx_dummy_sess = NULL;
}
/* Only prepared transactions may be left in the system. Free them. */ /* Only prepared transactions may be left in the system. Free them. */
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx
|| !srv_was_started || !srv_was_started

View File

@ -51,7 +51,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rseg.h" #include "trx0rseg.h"
#include "trx0undo.h" #include "trx0undo.h"
#include "trx0xa.h" #include "trx0xa.h"
#include "usr0sess.h"
#include "ut0new.h" #include "ut0new.h"
#include "ut0pool.h" #include "ut0pool.h"
#include "ut0vec.h" #include "ut0vec.h"
@ -70,9 +69,6 @@ typedef std::set<
std::less<table_id_t>, std::less<table_id_t>,
ut_allocator<table_id_t> > table_id_set; ut_allocator<table_id_t> > table_id_set;
/** Dummy session used currently in MySQL interface */
sess_t* trx_dummy_sess = NULL;
/** Constructor */ /** Constructor */
TrxVersion::TrxVersion(trx_t* trx) TrxVersion::TrxVersion(trx_t* trx)
: :
@ -518,8 +514,6 @@ trx_allocate_for_background(void)
trx = trx_create_low(); trx = trx_create_low();
trx->sess = trx_dummy_sess;
return(trx); return(trx);
} }

View File

@ -1,58 +0,0 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
/**************************************************//**
@file usr/usr0sess.cc
Sessions
Created 6/25/1996 Heikki Tuuri
*******************************************************/
#include "usr0sess.h"
#include "trx0trx.h"
/*********************************************************************//**
Opens a session.
@return own: session object */
sess_t*
sess_open(void)
/*===========*/
{
sess_t* sess;
sess = static_cast<sess_t*>(ut_zalloc_nokey(sizeof(*sess)));
sess->state = SESS_ACTIVE;
sess->trx = trx_allocate_for_background();
sess->trx->sess = sess;
return(sess);
}
/*********************************************************************//**
Closes a session, freeing the memory occupied by it. */
void
sess_close(
/*=======*/
sess_t* sess) /*!< in, own: session object */
{
trx_free_for_background(sess->trx);
ut_free(sess);
}

View File

@ -167,7 +167,6 @@ ut_new_boot()
"trx0sys", "trx0sys",
"trx0trx", "trx0trx",
"trx0undo", "trx0undo",
"usr0sess",
"ut0list", "ut0list",
"ut0mem", "ut0mem",
"ut0mutex", "ut0mutex",

View File

@ -15,6 +15,10 @@
SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c) SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c)
IF(NOT WITH_INNOBASE_STORAGE_ENGINE)
MESSAGE(WARNING "WSRep is enabled, but innodb is not. This configuration is not supported")
ENDIF()
ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES}) ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES})
DTRACE_INSTRUMENT(wsrep) DTRACE_INSTRUMENT(wsrep)