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
55277e88
Commit
55277e88
authored
Jan 25, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15059 - Misc small InnoDB scalability fixes
Form better trx_sys API.
parent
064bd780
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
47 deletions
+43
-47
storage/innobase/btr/btr0cur.cc
storage/innobase/btr/btr0cur.cc
+4
-3
storage/innobase/include/trx0sys.h
storage/innobase/include/trx0sys.h
+23
-6
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+2
-2
storage/innobase/read/read0read.cc
storage/innobase/read/read0read.cc
+2
-2
storage/innobase/row/row0row.cc
storage/innobase/row/row0row.cc
+3
-2
storage/innobase/row/row0sel.cc
storage/innobase/row/row0sel.cc
+1
-1
storage/innobase/row/row0vers.cc
storage/innobase/row/row0vers.cc
+3
-3
storage/innobase/trx/trx0trx.cc
storage/innobase/trx/trx0trx.cc
+5
-28
No files found.
storage/innobase/btr/btr0cur.cc
View file @
55277e88
...
...
@@ -482,9 +482,10 @@ btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr)
/* In fact, because we only ever append fields to the 'default
value' record, it is also OK to perform READ UNCOMMITTED and
then ignore any extra fields, provided that
trx_sys.
rw_trx_hash.fin
d(DB_TRX_ID). */
trx_sys.
is_registere
d(DB_TRX_ID). */
if
(
rec_offs_n_fields
(
offsets
)
>
index
->
n_fields
&&
!
trx_sys
.
rw_trx_hash
.
find
(
row_get_rec_trx_id
(
rec
,
index
,
&&
!
trx_sys
.
is_registered
(
current_trx
(),
row_get_rec_trx_id
(
rec
,
index
,
offsets
)))
{
goto
inconsistent
;
}
...
...
storage/innobase/include/trx0sys.h
View file @
55277e88
...
...
@@ -682,12 +682,6 @@ class rw_trx_hash_t
}
trx_t
*
find
(
trx_id_t
trx_id
,
bool
do_ref_count
=
false
)
{
return
find
(
current_trx
(),
trx_id
,
do_ref_count
);
}
/**
Inserts trx to lock-free hash.
...
...
@@ -974,6 +968,29 @@ struct trx_sys_t {
ulint
any_active_transactions
();
/** Registers read-write transaction. */
void
register_rw
(
trx_t
*
trx
)
{
mutex_enter
(
&
mutex
);
trx
->
id
=
get_new_trx_id
();
rw_trx_ids
.
push_back
(
trx
->
id
);
mutex_exit
(
&
mutex
);
rw_trx_hash
.
insert
(
trx
);
}
bool
is_registered
(
trx_t
*
caller_trx
,
trx_id_t
id
)
{
return
rw_trx_hash
.
find
(
caller_trx
,
id
);
}
trx_t
*
find
(
trx_t
*
caller_trx
,
trx_id_t
id
)
{
return
rw_trx_hash
.
find
(
caller_trx
,
id
,
true
);
}
private:
static
my_bool
get_min_trx_id_callback
(
rw_trx_hash_element_t
*
element
,
trx_id_t
*
id
)
...
...
storage/innobase/lock/lock0lock.cc
View file @
55277e88
...
...
@@ -5742,7 +5742,7 @@ lock_rec_queue_validate(
/* Unlike the non-debug code, this invariant can only succeed
if the check and assertion are covered by the lock mutex. */
const
trx_t
*
impl_trx
=
trx_sys
.
rw_trx_hash
.
find
(
const
trx_t
*
impl_trx
=
trx_sys
.
rw_trx_hash
.
find
(
current_trx
(),
lock_clust_rec_some_has_impl
(
rec
,
index
,
offsets
));
ut_ad
(
lock_mutex_own
());
...
...
@@ -6387,7 +6387,7 @@ lock_rec_convert_impl_to_expl(
trx_id
=
lock_clust_rec_some_has_impl
(
rec
,
index
,
offsets
);
trx
=
trx_sys
.
rw_trx_hash
.
find
(
caller_trx
,
trx_id
,
true
);
trx
=
trx_sys
.
find
(
caller_trx
,
trx_id
);
}
else
{
ut_ad
(
!
dict_index_is_online_ddl
(
index
));
...
...
storage/innobase/read/read0read.cc
View file @
55277e88
...
...
@@ -222,7 +222,7 @@ void ReadView::clone()
rw_trx_hash are in sync and they hold either ACTIVE or PREPARED
transaction.
Now rw_trx_hash
.
find() does
Now rw_trx_hash
_t::
find() does
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) ||
trx_state_eq(trx, TRX_STATE_PREPARED)).
No need to repeat it here. We even can't repeat it here: it'll be race
...
...
@@ -235,7 +235,7 @@ void ReadView::clone()
protection. Thus we need repeat this lookup. */
for
(
trx_ids_t
::
const_iterator
it
=
trx_sys
.
rw_trx_ids
.
begin
();
it
!=
trx_sys
.
rw_trx_ids
.
end
();
++
it
)
{
while
(
!
trx_sys
.
rw_trx_hash
.
find
(
*
it
));
while
(
!
trx_sys
.
is_registered
(
current_trx
(),
*
it
));
}
#endif
/* UNIV_DEBUG */
m_up_limit_id
=
m_ids
.
empty
()
?
m_low_limit_id
:
m_ids
.
front
();
...
...
storage/innobase/row/row0row.cc
View file @
55277e88
...
...
@@ -415,7 +415,8 @@ row_build_low(
times, and the cursor restore can happen multiple times for single
insert or update statement. */
ut_a
(
!
rec_offs_any_null_extern
(
rec
,
offsets
)
||
trx_sys
.
rw_trx_hash
.
find
(
row_get_rec_trx_id
(
rec
,
index
,
||
trx_sys
.
is_registered
(
current_trx
(),
row_get_rec_trx_id
(
rec
,
index
,
offsets
)));
#endif
/* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
...
...
storage/innobase/row/row0sel.cc
View file @
55277e88
...
...
@@ -4870,7 +4870,7 @@ row_search_mvcc(
/* In delete-marked records, DB_TRX_ID must
always refer to an existing undo log record. */
ut_ad
(
trx_id
);
if
(
!
trx_sys
.
rw_trx_hash
.
fin
d
(
trx
,
trx_id
))
{
if
(
!
trx_sys
.
is_registere
d
(
trx
,
trx_id
))
{
/* The clustered index record
was delete-marked in a committed
transaction. Ignore the record. */
...
...
storage/innobase/row/row0vers.cc
View file @
55277e88
...
...
@@ -121,7 +121,7 @@ row_vers_impl_x_locked_low(
DBUG_RETURN
(
0
);
}
trx_t
*
trx
=
trx_sys
.
rw_trx_hash
.
find
(
caller_trx
,
trx_id
,
true
);
trx_t
*
trx
=
trx_sys
.
find
(
caller_trx
,
trx_id
);
if
(
trx
==
0
)
{
/* The transaction that modified or inserted clust_rec is no
...
...
@@ -186,7 +186,7 @@ row_vers_impl_x_locked_low(
inserting a delete-marked record. */
ut_ad
(
prev_version
||
!
rec_get_deleted_flag
(
version
,
comp
)
||
!
trx_sys
.
rw_trx_hash
.
fin
d
(
caller_trx
,
trx_id
));
||
!
trx_sys
.
is_registere
d
(
caller_trx
,
trx_id
));
/* Free version and clust_offsets. */
mem_heap_free
(
old_heap
);
...
...
@@ -1280,7 +1280,7 @@ row_vers_build_for_semi_consistent_read(
rec_trx_id
=
version_trx_id
;
}
if
(
!
trx_sys
.
rw_trx_hash
.
fin
d
(
caller_trx
,
version_trx_id
))
{
if
(
!
trx_sys
.
is_registere
d
(
caller_trx
,
version_trx_id
))
{
committed_version_trx:
/* We found a version that belongs to a
committed transaction: return it. */
...
...
storage/innobase/trx/trx0trx.cc
View file @
55277e88
...
...
@@ -937,7 +937,7 @@ trx_lists_init_at_db_start()
for
(
undo
=
UT_LIST_GET_FIRST
(
rseg
->
undo_list
);
undo
!=
NULL
;
undo
=
UT_LIST_GET_NEXT
(
undo_list
,
undo
))
{
trx_t
*
trx
=
trx_sys
.
rw_trx_hash
.
find
(
undo
->
trx_id
);
trx_t
*
trx
=
trx_sys
.
rw_trx_hash
.
find
(
0
,
undo
->
trx_id
);
if
(
!
trx
)
{
trx_resurrect
(
undo
,
rseg
,
start_time
,
&
rows_to_undo
,
false
);
...
...
@@ -1094,11 +1094,7 @@ trx_t::assign_temp_rseg()
rsegs
.
m_noredo
.
rseg
=
rseg
;
if
(
id
==
0
)
{
mutex_enter
(
&
trx_sys
.
mutex
);
id
=
trx_sys
.
get_new_trx_id
();
trx_sys
.
rw_trx_ids
.
push_back
(
id
);
mutex_exit
(
&
trx_sys
.
mutex
);
trx_sys
.
rw_trx_hash
.
insert
(
this
);
trx_sys
.
register_rw
(
this
);
}
ut_ad
(
!
rseg
->
is_persistent
());
...
...
@@ -1186,12 +1182,7 @@ trx_start_low(
||
srv_read_only_mode
||
srv_force_recovery
>=
SRV_FORCE_NO_TRX_UNDO
);
mutex_enter
(
&
trx_sys
.
mutex
);
trx
->
id
=
trx_sys
.
get_new_trx_id
();
trx_sys
.
rw_trx_ids
.
push_back
(
trx
->
id
);
mutex_exit
(
&
trx_sys
.
mutex
);
trx_sys
.
rw_trx_hash
.
insert
(
trx
);
trx_sys
.
register_rw
(
trx
);
}
else
{
trx
->
id
=
0
;
...
...
@@ -1202,17 +1193,8 @@ trx_start_low(
to write to the temporary table. */
if
(
read_write
)
{
mutex_enter
(
&
trx_sys
.
mutex
);
ut_ad
(
!
srv_read_only_mode
);
trx
->
id
=
trx_sys
.
get_new_trx_id
();
trx_sys
.
rw_trx_ids
.
push_back
(
trx
->
id
);
mutex_exit
(
&
trx_sys
.
mutex
);
trx_sys
.
rw_trx_hash
.
insert
(
trx
);
trx_sys
.
register_rw
(
trx
);
}
}
else
{
ut_ad
(
!
read_write
);
...
...
@@ -2721,14 +2703,9 @@ trx_set_rw_mode(
based on in-consistent view formed during promotion. */
trx
->
rsegs
.
m_redo
.
rseg
=
trx_assign_rseg_low
();
ut_ad
(
trx
->
rsegs
.
m_redo
.
rseg
!=
0
);
mutex_enter
(
&
trx_sys
.
mutex
);
trx
->
id
=
trx_sys
.
get_new_trx_id
();
trx_sys
.
rw_trx_ids
.
push_back
(
trx
->
id
);
mutex_exit
(
&
trx_sys
.
mutex
);
trx_sys
.
rw_trx_hash
.
insert
(
trx
);
trx_sys
.
register_rw
(
trx
);
/* So that we can see our own changes. */
if
(
trx
->
read_view
.
is_open
())
{
...
...
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