summaryrefslogtreecommitdiff
path: root/innobase/row/row0sel.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/row/row0sel.c')
-rw-r--r--innobase/row/row0sel.c83
1 files changed, 76 insertions, 7 deletions
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 8a0da2851a7..bf7f6f1fc3a 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -631,10 +631,24 @@ row_sel_get_clust_rec(
if (!node->read_view) {
/* Try to place a lock on the index record */
-
+
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+ if ( srv_locks_unsafe_for_binlog )
+ {
+ err = lock_clust_rec_read_check_and_lock(0, clust_rec,
+ index,node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
+ }
+ else
+ {
err = lock_clust_rec_read_check_and_lock(0, clust_rec, index,
node->row_lock_mode, LOCK_ORDINARY, thr);
- if (err != DB_SUCCESS) {
+
+ }
+
+ if (err != DB_SUCCESS) {
return(err);
}
@@ -1184,9 +1198,23 @@ rec_loop:
search result set, resulting in the phantom problem. */
if (!consistent_read) {
+
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+
+ if ( srv_locks_unsafe_for_binlog )
+ {
+ err = sel_set_rec_lock(page_rec_get_next(rec), index,
+ node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
+ }
+ else
+ {
err = sel_set_rec_lock(page_rec_get_next(rec), index,
node->row_lock_mode, LOCK_ORDINARY, thr);
- if (err != DB_SUCCESS) {
+ }
+ if (err != DB_SUCCESS) {
/* Note that in this case we will store in pcur
the PREDECESSOR of the record we are waiting
the lock for */
@@ -1211,8 +1239,22 @@ rec_loop:
if (!consistent_read) {
/* Try to place a lock on the index record */
- err = sel_set_rec_lock(rec, index, node->row_lock_mode,
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+
+ if ( srv_locks_unsafe_for_binlog )
+ {
+ err = sel_set_rec_lock(rec, index, node->row_lock_mode,
+ LOCK_REC_NOT_GAP, thr);
+ }
+ else
+ {
+ err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_ORDINARY, thr);
+ }
+
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
@@ -3144,10 +3186,24 @@ rec_loop:
/* Try to place a lock on the index record */
- err = sel_set_rec_lock(rec, index,
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+ if ( srv_locks_unsafe_for_binlog )
+ {
+ err = sel_set_rec_lock(rec, index,
+ prebuilt->select_lock_type,
+ LOCK_REC_NOT_GAP, thr);
+ }
+ else
+ {
+ err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
- if (err != DB_SUCCESS) {
+ }
+
+ if (err != DB_SUCCESS) {
goto lock_wait_or_error;
}
@@ -3300,9 +3356,22 @@ rec_loop:
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr);
} else {
- err = sel_set_rec_lock(rec, index,
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+ if ( srv_locks_unsafe_for_binlog )
+ {
+ err = sel_set_rec_lock(rec, index,
+ prebuilt->select_lock_type,
+ LOCK_REC_NOT_GAP, thr);
+ }
+ else
+ {
+ err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
+ }
}
if (err != DB_SUCCESS) {