Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
db5bb785
Commit
db5bb785
authored
Jan 17, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocate trx_sys.mvcc at link time
trx_sys.mvcc was allocated dynamically for no good reason.
parent
f8882cce
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
34 deletions
+31
-34
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+2
-2
storage/innobase/include/read0read.h
storage/innobase/include/read0read.h
+2
-9
storage/innobase/include/trx0sys.h
storage/innobase/include/trx0sys.h
+8
-6
storage/innobase/read/read0read.cc
storage/innobase/read/read0read.cc
+2
-2
storage/innobase/row/row0sel.cc
storage/innobase/row/row0sel.cc
+1
-1
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+1
-1
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+1
-1
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0purge.cc
+1
-1
storage/innobase/trx/trx0sys.cc
storage/innobase/trx/trx0sys.cc
+8
-6
storage/innobase/trx/trx0trx.cc
storage/innobase/trx/trx0trx.cc
+5
-5
No files found.
storage/innobase/handler/ha_innodb.cc
View file @
db5bb785
...
...
@@ -16226,7 +16226,7 @@ ha_innobase::external_lock(
}
else
if
(
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
&&
MVCC
::
is_view_active
(
trx
->
read_view
))
{
mutex_enter
(
&
trx_sys
.
mutex
);
trx_sys
.
mvcc
->
view_close
(
trx
->
read_view
,
true
);
trx_sys
.
mvcc
.
view_close
(
trx
->
read_view
,
true
);
mutex_exit
(
&
trx_sys
.
mutex
);
}
}
...
...
@@ -16894,7 +16894,7 @@ ha_innobase::store_lock(
/* At low transaction isolation levels we let
each consistent read set its own snapshot */
mutex_enter
(
&
trx_sys
.
mutex
);
trx_sys
.
mvcc
->
view_close
(
trx
->
read_view
,
true
);
trx_sys
.
mvcc
.
view_close
(
trx
->
read_view
,
true
);
mutex_enter
(
&
trx_sys
.
mutex
);
}
}
...
...
storage/innobase/include/read0read.h
View file @
db5bb785
...
...
@@ -30,18 +30,16 @@ Created 2/16/1997 Heikki Tuuri
#include "read0types.h"
#include <algorithm>
/** The MVCC read view manager */
class
MVCC
{
public:
/** Constructor
@param size Number of views to pre-allocate */
explicit
MVCC
(
ulint
size
);
void
create
(
ulint
size
);
/** Destructor.
Free all the views in the m_free list */
~
MVCC
();
void
close
();
/**
Allocate and create a view.
...
...
@@ -106,11 +104,6 @@ class MVCC {
@return oldest view if found or NULL */
inline
ReadView
*
get_oldest_view
()
const
;
private:
// Prevent copying
MVCC
(
const
MVCC
&
);
MVCC
&
operator
=
(
const
MVCC
&
);
private:
typedef
UT_LIST_BASE_NODE_T
(
ReadView
)
view_list_t
;
...
...
storage/innobase/include/trx0sys.h
View file @
db5bb785
...
...
@@ -47,10 +47,6 @@ Created 3/26/1996 Heikki Tuuri
typedef
UT_LIST_BASE_NODE_T
(
trx_t
)
trx_ut_list_t
;
// Forward declaration
class
MVCC
;
class
ReadView
;
/** Checks if a page address is the trx sys header page.
@param[in] page_id page id
@return true if trx sys header page */
...
...
@@ -825,6 +821,7 @@ struct trx_sys_t {
MY_ALIGNED
(
CACHE_LINE_SIZE
)
trx_id_t
m_max_trx_id
;
bool
m_initialised
;
public:
MY_ALIGNED
(
CACHE_LINE_SIZE
)
...
...
@@ -832,7 +829,8 @@ struct trx_sys_t {
this structure except when noted
otherwise */
MVCC
*
mvcc
;
/*!< Multi version concurrency control
MY_ALIGNED
(
CACHE_LINE_SIZE
)
MVCC
mvcc
;
/*!< Multi version concurrency control
manager */
trx_ut_list_t
serialisation_list
;
/*!< Ordered on trx_t::no of all the
...
...
@@ -908,7 +906,8 @@ struct trx_sys_t {
initialisation to create().
*/
trx_sys_t
()
:
rw_trx_ids
(
ut_allocator
<
trx_id_t
>
(
mem_key_trx_sys_t_rw_trx_ids
))
trx_sys_t
()
:
m_initialised
(
false
),
rw_trx_ids
(
ut_allocator
<
trx_id_t
>
(
mem_key_trx_sys_t_rw_trx_ids
))
{}
...
...
@@ -977,6 +976,9 @@ struct trx_sys_t {
}
bool
is_initialised
()
{
return
m_initialised
;
}
/** Create the instance */
void
create
();
...
...
storage/innobase/read/read0read.cc
View file @
db5bb785
...
...
@@ -339,7 +339,7 @@ ReadView::~ReadView()
/** Constructor
@param size Number of views to pre-allocate */
MVCC
::
MVCC
(
ulint
size
)
void
MVCC
::
create
(
ulint
size
)
{
UT_LIST_INIT
(
m_free
,
&
ReadView
::
m_view_list
);
UT_LIST_INIT
(
m_views
,
&
ReadView
::
m_view_list
);
...
...
@@ -351,7 +351,7 @@ MVCC::MVCC(ulint size)
}
}
MVCC
::~
MVCC
()
void
MVCC
::
close
()
{
for
(
ReadView
*
view
=
UT_LIST_GET_FIRST
(
m_free
);
view
!=
NULL
;
...
...
storage/innobase/row/row0sel.cc
View file @
db5bb785
...
...
@@ -5888,7 +5888,7 @@ row_search_check_if_query_cache_permitted(
&&
!
srv_read_only_mode
&&
!
MVCC
::
is_view_active
(
trx
->
read_view
))
{
trx_sys
.
mvcc
->
view_open
(
trx
->
read_view
,
trx
);
trx_sys
.
mvcc
.
view_open
(
trx
->
read_view
,
trx
);
}
}
...
...
storage/innobase/srv/srv0srv.cc
View file @
db5bb785
...
...
@@ -1367,7 +1367,7 @@ srv_printf_innodb_monitor(
/* This is a dirty read, without holding trx_sys.mutex. */
fprintf
(
file
,
ULINTPF
" read views open inside InnoDB
\n
"
,
trx_sys
.
mvcc
->
size
());
trx_sys
.
mvcc
.
size
());
n_reserved
=
fil_space_get_n_reserved_extents
(
0
);
if
(
n_reserved
>
0
)
{
...
...
storage/innobase/srv/srv0start.cc
View file @
db5bb785
...
...
@@ -2835,7 +2835,7 @@ innodb_shutdown()
ut_ad
(
dict_stats_event
||
!
srv_was_started
||
srv_read_only_mode
);
ut_ad
(
dict_sys
||
!
srv_was_started
);
ut_ad
(
trx_sys
.
mvcc
||
!
srv_was_started
);
ut_ad
(
trx_sys
.
is_initialised
()
||
!
srv_was_started
);
ut_ad
(
buf_dblwr
||
!
srv_was_started
||
srv_read_only_mode
||
srv_force_recovery
>=
SRV_FORCE_NO_TRX_UNDO
);
ut_ad
(
lock_sys
||
!
srv_was_started
);
...
...
storage/innobase/trx/trx0purge.cc
View file @
db5bb785
...
...
@@ -1600,7 +1600,7 @@ trx_purge(
ut_a
(
purge_sys
->
n_submitted
==
purge_sys
->
n_completed
);
rw_lock_x_lock
(
&
purge_sys
->
latch
);
trx_sys
.
mvcc
->
clone_oldest_view
(
&
purge_sys
->
view
);
trx_sys
.
mvcc
.
clone_oldest_view
(
&
purge_sys
->
view
);
rw_lock_x_unlock
(
&
purge_sys
->
latch
);
#ifdef UNIV_DEBUG
...
...
storage/innobase/trx/trx0sys.cc
View file @
db5bb785
...
...
@@ -445,7 +445,7 @@ trx_sys_init_at_db_start()
trx_dummy_sess
=
sess_open
();
trx_lists_init_at_db_start
();
trx_sys
.
mvcc
->
clone_oldest_view
(
&
purge_sys
->
view
);
trx_sys
.
mvcc
.
clone_oldest_view
(
&
purge_sys
->
view
);
}
/** Create the instance */
...
...
@@ -453,13 +453,14 @@ void
trx_sys_t
::
create
()
{
ut_ad
(
this
==
&
trx_sys
);
ut_ad
(
!
mvcc
);
ut_ad
(
!
is_initialised
());
m_initialised
=
true
;
mutex_create
(
LATCH_ID_TRX_SYS
,
&
mutex
);
UT_LIST_INIT
(
serialisation_list
,
&
trx_t
::
no_list
);
UT_LIST_INIT
(
mysql_trx_list
,
&
trx_t
::
mysql_trx_list
);
mvcc
=
UT_NEW_NOKEY
(
MVCC
(
1024
)
);
mvcc
.
create
(
1024
);
rw_trx_hash
.
init
();
}
...
...
@@ -562,11 +563,11 @@ void
trx_sys_t
::
close
()
{
ut_ad
(
srv_shutdown_state
==
SRV_SHUTDOWN_EXIT_THREADS
);
if
(
!
mvcc
)
{
if
(
!
is_initialised
()
)
{
return
;
}
if
(
ulint
size
=
mvcc
->
size
())
{
if
(
ulint
size
=
mvcc
.
size
())
{
ib
::
error
()
<<
"All read views were not closed before"
" shutdown: "
<<
size
<<
" read views open"
;
}
...
...
@@ -590,13 +591,14 @@ trx_sys_t::close()
}
}
UT_DELETE
(
mvcc
);
mvcc
.
close
(
);
ut_a
(
UT_LIST_GET_LEN
(
mysql_trx_list
)
==
0
);
ut_a
(
UT_LIST_GET_LEN
(
serialisation_list
)
==
0
);
/* We used placement new to create this mutex. Call the destructor. */
mutex_free
(
&
mutex
);
m_initialised
=
false
;
}
...
...
storage/innobase/trx/trx0trx.cc
View file @
db5bb785
...
...
@@ -678,7 +678,7 @@ trx_disconnect_from_mysql(
UT_LIST_REMOVE
(
trx_sys
.
mysql_trx_list
,
trx
);
if
(
trx
->
read_view
!=
NULL
)
{
trx_sys
.
mvcc
->
view_close
(
trx
->
read_view
,
true
);
trx_sys
.
mvcc
.
view_close
(
trx
->
read_view
,
true
);
}
if
(
prepared
)
{
...
...
@@ -1558,7 +1558,7 @@ trx_erase_lists(
mutex_enter
(
&
trx_sys
.
mutex
);
if
(
trx
->
read_view
!=
NULL
)
{
trx_sys
.
mvcc
->
view_close
(
trx
->
read_view
,
true
);
trx_sys
.
mvcc
.
view_close
(
trx
->
read_view
,
true
);
}
}
...
...
@@ -1615,7 +1615,7 @@ trx_commit_in_memory(
ut_ad
(
trx_state_eq
(
trx
,
TRX_STATE_ACTIVE
));
if
(
trx
->
read_view
!=
NULL
)
{
trx_sys
.
mvcc
->
view_close
(
trx
->
read_view
,
false
);
trx_sys
.
mvcc
.
view_close
(
trx
->
read_view
,
false
);
}
MONITOR_INC
(
MONITOR_TRX_NL_RO_COMMIT
);
...
...
@@ -1647,7 +1647,7 @@ trx_commit_in_memory(
if
(
trx
->
read_only
||
trx
->
rsegs
.
m_redo
.
rseg
==
NULL
)
{
MONITOR_INC
(
MONITOR_TRX_RO_COMMIT
);
if
(
trx
->
read_view
!=
NULL
)
{
trx_sys
.
mvcc
->
view_close
(
trx_sys
.
mvcc
.
view_close
(
trx
->
read_view
,
false
);
}
}
else
{
...
...
@@ -1911,7 +1911,7 @@ trx_assign_read_view(
return
(
NULL
);
}
else
if
(
!
MVCC
::
is_view_active
(
trx
->
read_view
))
{
trx_sys
.
mvcc
->
view_open
(
trx
->
read_view
,
trx
);
trx_sys
.
mvcc
.
view_open
(
trx
->
read_view
,
trx
);
}
return
(
trx
->
read_view
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment