Commit 1683309d authored by Marko Makela's avatar Marko Makela

Reduce the next-key locking of READ UNCOMMITTED to match that of

READ COMMITTED in the built-in InnoDB. (Bug #48607)
parent bd178801
...@@ -4435,7 +4435,7 @@ ha_innobase::unlock_row(void) ...@@ -4435,7 +4435,7 @@ ha_innobase::unlock_row(void)
case ROW_READ_WITH_LOCKS: case ROW_READ_WITH_LOCKS:
if (!srv_locks_unsafe_for_binlog if (!srv_locks_unsafe_for_binlog
&& prebuilt->trx->isolation_level && prebuilt->trx->isolation_level
!= TRX_ISO_READ_COMMITTED) { > TRX_ISO_READ_COMMITTED) {
break; break;
} }
/* fall through */ /* fall through */
...@@ -4472,7 +4472,7 @@ ha_innobase::try_semi_consistent_read(bool yes) ...@@ -4472,7 +4472,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
if (yes if (yes
&& (srv_locks_unsafe_for_binlog && (srv_locks_unsafe_for_binlog
|| prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED)) { || prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT; prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
} else { } else {
prebuilt->row_read_type = ROW_READ_WITH_LOCKS; prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
...@@ -7768,7 +7768,7 @@ ha_innobase::store_lock( ...@@ -7768,7 +7768,7 @@ ha_innobase::store_lock(
isolation_level = trx->isolation_level; isolation_level = trx->isolation_level;
if ((srv_locks_unsafe_for_binlog if ((srv_locks_unsafe_for_binlog
|| isolation_level == TRX_ISO_READ_COMMITTED) || isolation_level <= TRX_ISO_READ_COMMITTED)
&& isolation_level != TRX_ISO_SERIALIZABLE && isolation_level != TRX_ISO_SERIALIZABLE
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT && (sql_command == SQLCOM_INSERT_SELECT
......
...@@ -2362,7 +2362,7 @@ lock_rec_inherit_to_gap( ...@@ -2362,7 +2362,7 @@ lock_rec_inherit_to_gap(
if (!lock_rec_get_insert_intention(lock) if (!lock_rec_get_insert_intention(lock)
&& !((srv_locks_unsafe_for_binlog && !((srv_locks_unsafe_for_binlog
|| lock->trx->isolation_level || lock->trx->isolation_level
== TRX_ISO_READ_COMMITTED) <= TRX_ISO_READ_COMMITTED)
&& lock_get_mode(lock) == LOCK_X)) { && lock_get_mode(lock) == LOCK_X)) {
lock_rec_add_to_queue(LOCK_REC | lock_get_mode(lock) lock_rec_add_to_queue(LOCK_REC | lock_get_mode(lock)
......
...@@ -1485,7 +1485,7 @@ row_unlock_for_mysql( ...@@ -1485,7 +1485,7 @@ row_unlock_for_mysql(
if (UNIV_UNLIKELY if (UNIV_UNLIKELY
(!srv_locks_unsafe_for_binlog (!srv_locks_unsafe_for_binlog
&& trx->isolation_level != TRX_ISO_READ_COMMITTED)) { && trx->isolation_level > TRX_ISO_READ_COMMITTED)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: calling row_unlock_for_mysql though\n" "InnoDB: Error: calling row_unlock_for_mysql though\n"
......
...@@ -744,7 +744,7 @@ row_sel_get_clust_rec( ...@@ -744,7 +744,7 @@ row_sel_get_clust_rec(
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
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;
} else { } else {
lock_type = LOCK_ORDINARY; lock_type = LOCK_ORDINARY;
...@@ -1358,7 +1358,7 @@ row_sel( ...@@ -1358,7 +1358,7 @@ row_sel(
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) {
if (page_rec_is_supremum(next_rec)) { if (page_rec_is_supremum(next_rec)) {
...@@ -1414,7 +1414,7 @@ row_sel( ...@@ -1414,7 +1414,7 @@ row_sel(
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
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) {
if (page_rec_is_supremum(rec)) { if (page_rec_is_supremum(rec)) {
...@@ -3596,7 +3596,7 @@ row_search_for_mysql( ...@@ -3596,7 +3596,7 @@ row_search_for_mysql(
&& !page_rec_is_supremum(rec) && !page_rec_is_supremum(rec)
&& set_also_gap_locks && set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog && !(srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) { && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the next index record /* Try to place a gap lock on the next index record
...@@ -3692,7 +3692,7 @@ row_search_for_mysql( ...@@ -3692,7 +3692,7 @@ row_search_for_mysql(
if (set_also_gap_locks if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog && !(srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) { && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record */ /* Try to place a lock on the index record */
...@@ -3827,7 +3827,7 @@ row_search_for_mysql( ...@@ -3827,7 +3827,7 @@ row_search_for_mysql(
if (set_also_gap_locks if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog && !(srv_locks_unsafe_for_binlog
|| trx->isolation_level || trx->isolation_level
== TRX_ISO_READ_COMMITTED) <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) { && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index /* Try to place a gap lock on the index
...@@ -3862,7 +3862,7 @@ row_search_for_mysql( ...@@ -3862,7 +3862,7 @@ row_search_for_mysql(
if (set_also_gap_locks if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog && !(srv_locks_unsafe_for_binlog
|| trx->isolation_level || trx->isolation_level
== TRX_ISO_READ_COMMITTED) <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) { && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index /* Try to place a gap lock on the index
...@@ -3909,7 +3909,7 @@ row_search_for_mysql( ...@@ -3909,7 +3909,7 @@ row_search_for_mysql(
if (!set_also_gap_locks if (!set_also_gap_locks
|| srv_locks_unsafe_for_binlog || srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED || trx->isolation_level <= TRX_ISO_READ_COMMITTED
|| (unique_search || (unique_search
&& !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) { && !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) {
...@@ -3947,7 +3947,7 @@ row_search_for_mysql( ...@@ -3947,7 +3947,7 @@ row_search_for_mysql(
rec_t* old_vers; rec_t* old_vers;
case DB_SUCCESS: case DB_SUCCESS:
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) {
/* Note that a record of /* Note that a record of
prebuilt->index was locked. */ prebuilt->index was locked. */
prebuilt->new_rec_locks = 1; prebuilt->new_rec_locks = 1;
...@@ -4081,7 +4081,7 @@ row_search_for_mysql( ...@@ -4081,7 +4081,7 @@ row_search_for_mysql(
/* The record is delete-marked: we can skip it */ /* The record is delete-marked: we can skip it */
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)
&& prebuilt->select_lock_type != LOCK_NONE && prebuilt->select_lock_type != LOCK_NONE
&& !did_semi_consistent_read) { && !did_semi_consistent_read) {
...@@ -4148,7 +4148,7 @@ row_search_for_mysql( ...@@ -4148,7 +4148,7 @@ row_search_for_mysql(
} }
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)
&& prebuilt->select_lock_type != LOCK_NONE) { && prebuilt->select_lock_type != LOCK_NONE) {
/* Note that both the secondary index record /* Note that both the secondary index record
and the clustered index record were locked. */ and the clustered index record were locked. */
...@@ -4161,7 +4161,7 @@ row_search_for_mysql( ...@@ -4161,7 +4161,7 @@ row_search_for_mysql(
/* The record is delete marked: we can skip it */ /* The record is delete marked: we can skip it */
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)
&& prebuilt->select_lock_type != LOCK_NONE) { && prebuilt->select_lock_type != LOCK_NONE) {
/* No need to keep a lock on a delete-marked /* No need to keep a lock on a delete-marked
...@@ -4368,7 +4368,7 @@ row_search_for_mysql( ...@@ -4368,7 +4368,7 @@ row_search_for_mysql(
moves_up, &mtr); moves_up, &mtr);
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)
&& !same_user_rec) { && !same_user_rec) {
/* Since we were not able to restore the cursor /* Since we were not able to restore the cursor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment