summaryrefslogtreecommitdiff
path: root/innobase/row
diff options
context:
space:
mode:
authorjan@hundin.mysql.fi <>2004-10-14 15:36:36 +0300
committerjan@hundin.mysql.fi <>2004-10-14 15:36:36 +0300
commitd07ade557955861a94792fced85bf6e10394753f (patch)
tree9a624ca9a10ab262e3fd87d859d44617a85f4e78 /innobase/row
parent9b2cc44e74ba85752f0b746d16e8e9c9bc120a11 (diff)
downloadmariadb-git-d07ade557955861a94792fced85bf6e10394753f.tar.gz
This patch removes unnecessary lock from the supremum record, takes
X-locks on duplicates also on LOAD DATA...REPLACE clause and fixes a bug #6086 adding --disable_warnings and --enable_warnings around the create table clauses in ctype_utf8 tests for InnoDB.
Diffstat (limited to 'innobase/row')
-rw-r--r--innobase/row/row0ins.c31
-rw-r--r--innobase/row/row0sel.c26
2 files changed, 24 insertions, 33 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index 7b0beb9d183..3008d6a3812 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -1482,9 +1482,9 @@ row_ins_scan_sec_index_for_duplicate(
ulint err = DB_SUCCESS;
ibool moved;
mtr_t mtr;
- trx_t *trx;
- ibool success;
-
+ trx_t* trx;
+ const char* ptr;
+
n_unique = dict_index_get_n_unique(index);
/* If the secondary index is unique, but one of the fields in the
@@ -1523,9 +1523,11 @@ row_ins_scan_sec_index_for_duplicate(
trx = thr_get_trx(thr);
ut_ad(trx);
- dict_accept(*trx->mysql_query_str, "REPLACE", &success);
- if (success) {
+ ptr = dict_scan_to(*(trx->mysql_query_str),
+ "REPLACE");
+
+ if ( ptr && *ptr != '\0') {
/* The manual defines the REPLACE semantics that it
is either an INSERT or DELETE(s) for duplicate key
@@ -1605,7 +1607,7 @@ row_ins_duplicate_error_in_clust(
page_t* page;
ulint n_unique;
trx_t* trx = thr_get_trx(thr);
- ibool success;
+ const char* ptr;
UT_NOT_USED(mtr);
@@ -1639,10 +1641,9 @@ 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);
+ ptr = dict_scan_to(*(trx->mysql_query_str), "REPLACE");
- if (success) {
+ if (ptr && *ptr != '\0') {
/* The manual defines the REPLACE semantics
that it is either an INSERT or DELETE(s)
@@ -1683,15 +1684,11 @@ row_ins_duplicate_error_in_clust(
/* 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.
- */
+ duplicates. */
- /* Is the first word in MySQL query REPLACE ? */
-
- dict_accept(*trx->mysql_query_str, "REPLACE",
- &success);
-
- if (success) {
+ ptr = dict_scan_to(*(trx->mysql_query_str), "REPLACE");
+
+ if (ptr && *ptr != '\0') {
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP,
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 3ff94c8f238..740241fa210 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2794,7 +2794,7 @@ row_search_for_mysql(
rec_t* index_rec;
rec_t* clust_rec;
rec_t* old_vers;
- ulint err;
+ ulint err = DB_SUCCESS;
ibool moved;
ibool cons_read_requires_clust_rec;
ibool was_lock_wait;
@@ -3203,26 +3203,20 @@ rec_loop:
if (prebuilt->select_lock_type != LOCK_NONE
&& set_also_gap_locks) {
- /* 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,
- 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
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we do not lock gaps. Supremum record is really
+ a gap and therefore we do not set locks there. */
+
+ if ( srv_locks_unsafe_for_binlog == FALSE )
{
- err = sel_set_rec_lock(rec, index,
+ 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;
}