diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-02-15 09:50:03 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-02-15 10:01:05 +0200 |
commit | 27ea2963fce74f9f597f63eab0df63e395efcc50 (patch) | |
tree | 6b36564ea578dfd8326d0cb1b3df9b4a8f167af2 | |
parent | 7baea2efa2093cd84b9c972fa1707e6235779e75 (diff) | |
download | mariadb-git-27ea2963fce74f9f597f63eab0df63e395efcc50.tar.gz |
Dead code removal: sess_t
The session object is not really needed for anything.
We can directly create and free the dummy purge_sys->query->trx.
23 files changed, 20 insertions, 219 deletions
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index db320118b96..0033cdbae35 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -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 diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 8a06cd1db2c..c1ee4f3bc4e 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -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 @@ -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" diff --git a/storage/innobase/include/pars0opt.h b/storage/innobase/include/pars0opt.h index 13ea38cc385..d9debcf325e 100644 --- a/storage/innobase/include/pars0opt.h +++ b/storage/innobase/include/pars0opt.h @@ -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 @@ -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" diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index dad7953424c..37498c1c638 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -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 @@ -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" diff --git a/storage/innobase/include/pars0sym.h b/storage/innobase/include/pars0sym.h index 4e511719639..920087b96c2 100644 --- a/storage/innobase/include/pars0sym.h +++ b/storage/innobase/include/pars0sym.h @@ -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 @@ -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" diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 13be7291f00..f01b596a52e 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -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 @@ -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" diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.ic index ec61081cfe2..545d5288298 100644 --- a/storage/innobase/include/que0que.ic +++ b/storage/innobase/include/que0que.ic @@ -23,8 +23,6 @@ Query graph Created 5/27/1996 Heikki Tuuri *******************************************************/ -#include "usr0sess.h" - /***********************************************************************//** Gets the trx of a query thread. */ UNIV_INLINE diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index c9f5edb1432..e605e7a67a6 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -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 @@ -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" @@ -494,8 +493,6 @@ public: /** 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 diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index b2d4952318c..674eee572ed 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** 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 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 "log0log.h" -#include "usr0types.h" #include "que0types.h" #include "mem0mem.h" #include "trx0xa.h" @@ -55,9 +54,6 @@ class ReadView; // Forward declaration class FlushObserver; -/** Dummy session used currently in MySQL interface */ -extern sess_t* trx_dummy_sess; - /** Set flush observer for the transaction @param[in/out] trx transaction struct @param[in] observer flush observer */ @@ -1139,7 +1135,6 @@ struct trx_t { ulint error_key_num; /*!< if the index creation fails to a duplicate key error, a mysql key 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, or NULL if none; NOTE that the query belongs to the session, and it can diff --git a/storage/innobase/include/usr0sess.h b/storage/innobase/include/usr0sess.h deleted file mode 100644 index 8e9497a85c5..00000000000 --- a/storage/innobase/include/usr0sess.h +++ /dev/null @@ -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 diff --git a/storage/innobase/include/usr0types.h b/storage/innobase/include/usr0types.h deleted file mode 100644 index 6ba937cacc8..00000000000 --- a/storage/innobase/include/usr0types.h +++ /dev/null @@ -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 diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 7f73b35e6e0..67a40e7639f 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -35,7 +35,6 @@ Created 5/7/1996 Heikki Tuuri #include "lock0lock.h" #include "lock0priv.h" #include "dict0mem.h" -#include "usr0sess.h" #include "trx0purge.h" #include "trx0sys.h" #include "srv0mon.h" diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc index dc2c6e2d15e..0e79dd5b460 100644 --- a/storage/innobase/lock/lock0prdt.cc +++ b/storage/innobase/lock/lock0prdt.cc @@ -29,7 +29,6 @@ Created 9/7/2013 Jimmy Yang #include "lock0priv.h" #include "lock0prdt.h" #include "ha_prototypes.h" -#include "usr0sess.h" #include "trx0purge.h" #include "dict0mem.h" #include "dict0boot.h" diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 839f7ca0100..87d37e347f1 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -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 @@ -27,7 +27,6 @@ Created 5/27/1996 Heikki Tuuri #include "ha_prototypes.h" #include "que0que.h" -#include "usr0sess.h" #include "trx0trx.h" #include "trx0roll.h" #include "row0undo.h" diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index a81594bb0b7..98e94e06464 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -45,7 +45,6 @@ Created 4/20/1996 Heikki Tuuri #include "log0log.h" #include "eval0eval.h" #include "data0data.h" -#include "usr0sess.h" #include "buf0lru.h" #include "fts0fts.h" #include "fts0types.h" diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 9989a24c708..06c01725247 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google 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 Google, Inc. Those modifications are gratefully acknowledged and are described @@ -70,7 +70,6 @@ Created 10/8/1995 Heikki Tuuri #include "sync0sync.h" #include "trx0i_s.h" #include "trx0purge.h" -#include "usr0sess.h" #include "ut0crc32.h" #include "btr0defragment.h" #include "ut0mem.h" diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index d3b7fb6bf94..8c2d0dc8871 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -88,7 +88,6 @@ Created 2/16/1996 Heikki Tuuri #include "dict0load.h" #include "dict0stats_bg.h" #include "que0que.h" -#include "usr0sess.h" #include "lock0lock.h" #include "trx0roll.h" #include "trx0purge.h" diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index a1f16df2304..16ee1d2e8e8 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** 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 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 this query graph. -@param[in,out] sess the purge session @return own: the query graph */ static que_t* -trx_purge_graph_build(sess_t* sess) +purge_graph_build() { 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->id = 0; + trx_t* trx = trx_allocate_for_background(); + ut_ad(!trx->id); trx->start_time = ut_time(); trx->state = TRX_STATE_ACTIVE; trx->op_info = "purge trx"; @@ -199,9 +193,9 @@ trx_purge_graph_build(sess_t* sess) /** Construct the purge system. */ 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), - query(trx_purge_graph_build(sess)), + query(purge_graph_build()), view(), n_submitted(0), n_completed(0), iter(), limit(), #ifdef UNIV_DEBUG @@ -221,10 +215,12 @@ purge_sys_t::~purge_sys_t() { ut_ad(this == purge_sys); + trx_t* trx = query->trx; que_graph_free(query); - ut_a(sess->trx->id == 0); - sess->trx->state = TRX_STATE_NOT_STARTED; - sess_close(sess); + ut_ad(!trx->id); + ut_ad(trx->state == TRX_STATE_ACTIVE); + trx->state = TRX_STATE_NOT_STARTED; + trx_free_for_background(trx); view.close(); rw_lock_free(&latch); /* rw_lock_free() already called latch.~rw_lock_t(); tame the diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index ab500cfbfad..5c2258f25be 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -47,7 +47,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0sys.h" #include "trx0trx.h" #include "trx0undo.h" -#include "usr0sess.h" #include "ha_prototypes.h" /** This many pages must be undone before a truncate is tried within diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index 393dff8c026..f7404e8a303 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -500,8 +500,6 @@ trx_sys_init_at_db_start() mtr.commit(); ut_d(trx_sys->rw_max_trx_id = trx_sys->max_trx_id); - trx_dummy_sess = sess_open(); - trx_lists_init_at_db_start(); /* 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"; } - if (trx_dummy_sess) { - sess_close(trx_dummy_sess); - trx_dummy_sess = NULL; - } - /* 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 || !srv_was_started diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 19614184507..c6e2bd88d62 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -51,7 +51,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0rseg.h" #include "trx0undo.h" #include "trx0xa.h" -#include "usr0sess.h" #include "ut0new.h" #include "ut0pool.h" #include "ut0vec.h" @@ -70,9 +69,6 @@ typedef std::set< std::less<table_id_t>, ut_allocator<table_id_t> > table_id_set; -/** Dummy session used currently in MySQL interface */ -sess_t* trx_dummy_sess = NULL; - /** Constructor */ TrxVersion::TrxVersion(trx_t* trx) : @@ -518,8 +514,6 @@ trx_allocate_for_background(void) trx = trx_create_low(); - trx->sess = trx_dummy_sess; - return(trx); } diff --git a/storage/innobase/usr/usr0sess.cc b/storage/innobase/usr/usr0sess.cc deleted file mode 100644 index 55ce9500e5c..00000000000 --- a/storage/innobase/usr/usr0sess.cc +++ /dev/null @@ -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); -} diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc index bf5515f4de0..052db2fe7bd 100644 --- a/storage/innobase/ut/ut0new.cc +++ b/storage/innobase/ut/ut0new.cc @@ -167,7 +167,6 @@ ut_new_boot() "trx0sys", "trx0trx", "trx0undo", - "usr0sess", "ut0list", "ut0mem", "ut0mutex", |