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
656a3762
Commit
656a3762
authored
Aug 17, 2004
by
jan@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Relaxed lock wait rules so that record lock does not need to wait for a
gap type lock.
parent
2b5a657a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
29 deletions
+37
-29
innobase/lock/lock0lock.c
innobase/lock/lock0lock.c
+11
-8
innobase/row/row0ins.c
innobase/row/row0ins.c
+26
-21
No files found.
innobase/lock/lock0lock.c
View file @
656a3762
...
...
@@ -773,19 +773,22 @@ lock_rec_has_to_wait(
/* We have somewhat complex rules when gap type record locks
cause waits */
if
((
lock_is_on_supremum
||
(
type_mode
&
LOCK_GAP
))
if
((
lock_is_on_supremum
||
(
type_mode
&
LOCK_GAP
))
&&
!
(
type_mode
&
LOCK_INSERT_INTENTION
))
{
/* Gap type locks without LOCK_INSERT_INTENTION flag
do not need to wait for anything. This is because different
users can have conflicting lock types on gaps. */
do not need to wait for anything. This is because
different users can have conflicting lock types
on gaps. */
return
(
FALSE
);
}
if
(
(
type_mode
&
LOCK_REC_NOT_GAP
)
if
(
!
(
type_mode
&
LOCK_INSERT_INTENTION
)
&&
lock_rec_get_gap
(
lock2
))
{
/* Lock on just the record does not need to wait for
a gap type lock */
/* Record lock (LOCK_ORDINARY or LOCK_REC_NOT_GAP
does not need to wait for a gap type lock */
return
(
FALSE
);
}
...
...
@@ -846,8 +849,8 @@ lock_has_to_wait(
then the second bit on the lock bitmap is set */
return
(
lock_rec_has_to_wait
(
lock1
->
trx
,
lock1
->
type_mode
,
lock2
,
lock_rec_get_nth_bit
(
lock1
,
1
)));
lock1
->
type_mode
,
lock2
,
lock_rec_get_nth_bit
(
lock1
,
1
)));
}
return
(
TRUE
);
...
...
innobase/row/row0ins.c
View file @
656a3762
...
...
@@ -1635,21 +1635,24 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
errors as in original execution */
dict_accept
(
*
trx
->
mysql_query_str
,
"REPLACE"
,
&
success
);
dict_accept
(
*
trx
->
mysql_query_str
,
"REPLACE"
,
&
success
);
if
(
success
)
{
/* The manual defines the REPLACE semantics
that it
is either an INSERT or DELETE(s) for duplicate key
+ INSERT. Therefore, we should take X-lock for
duplicates */
/* The manual defines the REPLACE semantics
that it is either an INSERT or DELETE(s)
for duplicate key + INSERT. Therefore, we
should take X-lock for
duplicates */
err
=
row_ins_set_exclusive_rec_lock
(
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
}
else
{
err
=
row_ins_set_shared_rec_lock
(
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
}
if
(
err
!=
DB_SUCCESS
)
{
...
...
@@ -1673,26 +1676,28 @@ row_ins_duplicate_error_in_clust(
if
(
rec
!=
page_get_supremum_rec
(
page
))
{
/* The manual defines the REPLACE semantics that it
is either an INSERT or DELETE(s) for duplicate key
+ INSERT. Therefore, we should take X-lock for
duplicates.
/* The manual defines the REPLACE semantics that it
is either an INSERT or DELETE(s) for duplicate key
+ INSERT. Therefore, we should take X-lock for
duplicates.
*/
/* Is the first word in MySQL query REPLACE ? */
/* Is the first word in MySQL query REPLACE ? */
dict_accept
(
*
trx
->
mysql_query_str
,
"REPLACE"
,
&
success
);
dict_accept
(
*
trx
->
mysql_query_str
,
"REPLACE"
,
&
success
);
if
(
success
)
{
if
(
success
)
{
err
=
row_ins_set_exclusive_rec_lock
(
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
}
else
{
err
=
row_ins_set_exclusive_rec_lock
(
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
}
else
{
err
=
row_ins_set_shared_rec_lock
(
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
}
err
=
row_ins_set_shared_rec_lock
(
LOCK_REC_NOT_GAP
,
rec
,
cursor
->
index
,
thr
);
}
if
(
err
!=
DB_SUCCESS
)
{
...
...
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