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
c9220483
Commit
c9220483
authored
Jul 04, 2014
by
Jan Lindström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-6191: row_search_for_mysql comment and code consistency about isolation level
and gap locks
parent
838977e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
40 deletions
+30
-40
storage/innobase/row/row0sel.c
storage/innobase/row/row0sel.c
+15
-20
storage/xtradb/row/row0sel.c
storage/xtradb/row/row0sel.c
+15
-20
No files found.
storage/innobase/row/row0sel.c
View file @
c9220483
...
@@ -877,16 +877,15 @@ row_sel_get_clust_rec(
...
@@ -877,16 +877,15 @@ row_sel_get_clust_rec(
if
(
!
node
->
read_view
)
{
if
(
!
node
->
read_view
)
{
/* Try to place a lock on the index record */
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED isolation level
we lock only the record, i.e., next-key locking is
not used. */
ulint
lock_type
;
ulint
lock_type
;
trx_t
*
trx
;
trx_t
*
trx
;
trx
=
thr_get_trx
(
thr
);
trx
=
thr_get_trx
(
thr
);
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED or lower isolation level
we lock only the record, i.e., next-key locking is
not used. */
if
(
srv_locks_unsafe_for_binlog
if
(
srv_locks_unsafe_for_binlog
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
lock_type
=
LOCK_REC_NOT_GAP
;
lock_type
=
LOCK_REC_NOT_GAP
;
...
@@ -1491,12 +1490,6 @@ row_sel(
...
@@ -1491,12 +1490,6 @@ row_sel(
search result set, resulting in the phantom problem. */
search result set, resulting in the phantom problem. */
if
(
!
consistent_read
)
{
if
(
!
consistent_read
)
{
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED isolation
level, we lock only the record, i.e., next-key
locking is not used. */
rec_t
*
next_rec
=
page_rec_get_next
(
rec
);
rec_t
*
next_rec
=
page_rec_get_next
(
rec
);
ulint
lock_type
;
ulint
lock_type
;
trx_t
*
trx
;
trx_t
*
trx
;
...
@@ -1506,6 +1499,10 @@ row_sel(
...
@@ -1506,6 +1499,10 @@ row_sel(
offsets
=
rec_get_offsets
(
next_rec
,
index
,
offsets
,
offsets
=
rec_get_offsets
(
next_rec
,
index
,
offsets
,
ULINT_UNDEFINED
,
&
heap
);
ULINT_UNDEFINED
,
&
heap
);
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED or lower isolation
level, we lock only the record, i.e., next-key
locking is not used. */
if
(
srv_locks_unsafe_for_binlog
if
(
srv_locks_unsafe_for_binlog
||
trx
->
isolation_level
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
<=
TRX_ISO_READ_COMMITTED
)
{
...
@@ -1554,12 +1551,6 @@ row_sel(
...
@@ -1554,12 +1551,6 @@ row_sel(
if
(
!
consistent_read
)
{
if
(
!
consistent_read
)
{
/* Try to place a lock on the index record */
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED isolation level,
we lock only the record, i.e., next-key locking is
not used. */
ulint
lock_type
;
ulint
lock_type
;
trx_t
*
trx
;
trx_t
*
trx
;
...
@@ -1568,6 +1559,10 @@ row_sel(
...
@@ -1568,6 +1559,10 @@ row_sel(
trx
=
thr_get_trx
(
thr
);
trx
=
thr_get_trx
(
thr
);
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED or lower isolation level,
we lock only the record, i.e., next-key locking is
not used. */
if
(
srv_locks_unsafe_for_binlog
if
(
srv_locks_unsafe_for_binlog
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
...
@@ -3992,7 +3987,7 @@ row_search_for_mysql(
...
@@ -3992,7 +3987,7 @@ row_search_for_mysql(
/* Try to place a lock on the index record */
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using a READ COMMITTED isolation
or this session is using a READ COMMITTED
or lower
isolation
level we do not lock gaps. Supremum record is really
level we do not lock gaps. Supremum record is really
a gap and therefore we do not set locks there. */
a gap and therefore we do not set locks there. */
...
@@ -4131,7 +4126,7 @@ row_search_for_mysql(
...
@@ -4131,7 +4126,7 @@ row_search_for_mysql(
/* Try to place a gap lock on the index
/* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
record only if innodb_locks_unsafe_for_binlog
option is not set or this session is not
option is not set or this session is not
using a READ COMMITTED isolation level. */
using a READ COMMITTED
or lower
isolation level. */
err
=
sel_set_rec_lock
(
err
=
sel_set_rec_lock
(
btr_pcur_get_block
(
pcur
),
btr_pcur_get_block
(
pcur
),
...
@@ -4178,7 +4173,7 @@ row_search_for_mysql(
...
@@ -4178,7 +4173,7 @@ row_search_for_mysql(
/* Try to place a gap lock on the index
/* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
record only if innodb_locks_unsafe_for_binlog
option is not set or this session is not
option is not set or this session is not
using a READ COMMITTED isolation level. */
using a READ COMMITTED
or lower
isolation level. */
err
=
sel_set_rec_lock
(
err
=
sel_set_rec_lock
(
btr_pcur_get_block
(
pcur
),
btr_pcur_get_block
(
pcur
),
...
...
storage/xtradb/row/row0sel.c
View file @
c9220483
...
@@ -879,16 +879,15 @@ row_sel_get_clust_rec(
...
@@ -879,16 +879,15 @@ row_sel_get_clust_rec(
if
(
!
node
->
read_view
)
{
if
(
!
node
->
read_view
)
{
/* Try to place a lock on the index record */
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED isolation level
we lock only the record, i.e., next-key locking is
not used. */
ulint
lock_type
;
ulint
lock_type
;
trx_t
*
trx
;
trx_t
*
trx
;
trx
=
thr_get_trx
(
thr
);
trx
=
thr_get_trx
(
thr
);
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED or lower isolation level
we lock only the record, i.e., next-key locking is
not used. */
if
(
srv_locks_unsafe_for_binlog
if
(
srv_locks_unsafe_for_binlog
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
lock_type
=
LOCK_REC_NOT_GAP
;
lock_type
=
LOCK_REC_NOT_GAP
;
...
@@ -1494,12 +1493,6 @@ row_sel(
...
@@ -1494,12 +1493,6 @@ row_sel(
search result set, resulting in the phantom problem. */
search result set, resulting in the phantom problem. */
if
(
!
consistent_read
)
{
if
(
!
consistent_read
)
{
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED isolation
level, we lock only the record, i.e., next-key
locking is not used. */
rec_t
*
next_rec
=
page_rec_get_next
(
rec
);
rec_t
*
next_rec
=
page_rec_get_next
(
rec
);
ulint
lock_type
;
ulint
lock_type
;
trx_t
*
trx
;
trx_t
*
trx
;
...
@@ -1509,6 +1502,10 @@ row_sel(
...
@@ -1509,6 +1502,10 @@ row_sel(
offsets
=
rec_get_offsets
(
next_rec
,
index
,
offsets
,
offsets
=
rec_get_offsets
(
next_rec
,
index
,
offsets
,
ULINT_UNDEFINED
,
&
heap
);
ULINT_UNDEFINED
,
&
heap
);
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED or lower isolation
level, we lock only the record, i.e., next-key
locking is not used. */
if
(
srv_locks_unsafe_for_binlog
if
(
srv_locks_unsafe_for_binlog
||
trx
->
isolation_level
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
<=
TRX_ISO_READ_COMMITTED
)
{
...
@@ -1557,12 +1554,6 @@ row_sel(
...
@@ -1557,12 +1554,6 @@ row_sel(
if
(
!
consistent_read
)
{
if
(
!
consistent_read
)
{
/* Try to place a lock on the index record */
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED isolation level,
we lock only the record, i.e., next-key locking is
not used. */
ulint
lock_type
;
ulint
lock_type
;
trx_t
*
trx
;
trx_t
*
trx
;
...
@@ -1571,6 +1562,10 @@ row_sel(
...
@@ -1571,6 +1562,10 @@ row_sel(
trx
=
thr_get_trx
(
thr
);
trx
=
thr_get_trx
(
thr
);
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using READ COMMITTED or lower isolation level,
we lock only the record, i.e., next-key locking is
not used. */
if
(
srv_locks_unsafe_for_binlog
if
(
srv_locks_unsafe_for_binlog
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
||
trx
->
isolation_level
<=
TRX_ISO_READ_COMMITTED
)
{
...
@@ -4142,7 +4137,7 @@ row_search_for_mysql(
...
@@ -4142,7 +4137,7 @@ row_search_for_mysql(
/* Try to place a lock on the index record */
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used
/* If innodb_locks_unsafe_for_binlog option is used
or this session is using a READ COMMITTED isolation
or this session is using a READ COMMITTED
or lower
isolation
level we do not lock gaps. Supremum record is really
level we do not lock gaps. Supremum record is really
a gap and therefore we do not set locks there. */
a gap and therefore we do not set locks there. */
...
@@ -4289,7 +4284,7 @@ row_search_for_mysql(
...
@@ -4289,7 +4284,7 @@ row_search_for_mysql(
/* Try to place a gap lock on the index
/* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
record only if innodb_locks_unsafe_for_binlog
option is not set or this session is not
option is not set or this session is not
using a READ COMMITTED isolation level. */
using a READ COMMITTED
or lower
isolation level. */
err
=
sel_set_rec_lock
(
err
=
sel_set_rec_lock
(
btr_pcur_get_block
(
pcur
),
btr_pcur_get_block
(
pcur
),
...
@@ -4336,7 +4331,7 @@ row_search_for_mysql(
...
@@ -4336,7 +4331,7 @@ row_search_for_mysql(
/* Try to place a gap lock on the index
/* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
record only if innodb_locks_unsafe_for_binlog
option is not set or this session is not
option is not set or this session is not
using a READ COMMITTED isolation level. */
using a READ COMMITTED
or lower
isolation level. */
err
=
sel_set_rec_lock
(
err
=
sel_set_rec_lock
(
btr_pcur_get_block
(
pcur
),
btr_pcur_get_block
(
pcur
),
...
...
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