diff options
author | unknown <sergefp@mysql.com> | 2003-12-20 00:54:38 +0300 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2003-12-20 00:54:38 +0300 |
commit | c0d9d43739df0bf92b83a6b328485c1f357ea253 (patch) | |
tree | 6f1ee123b4c43806a2d62ab70bfdc1402e51dff9 /innobase/row/row0ins.c | |
parent | 28ad1273ddf3d42a4ec9f9fdfdd150f39fa4772e (diff) | |
parent | b41e6294ca97aaeb403972feb19ecc6d177096ca (diff) | |
download | mariadb-git-c0d9d43739df0bf92b83a6b328485c1f357ea253.tar.gz |
Merge mysql.com:/home/psergey/mysql-5.0-latest-pull
into mysql.com:/dbdata/psergey/mysql-5.0-imerge-unique
BitKeeper/etc/logging_ok:
auto-union
include/my_global.h:
Auto merged
sql/filesort.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/records.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_union.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/uniques.cc:
Auto merged
Diffstat (limited to 'innobase/row/row0ins.c')
-rw-r--r-- | innobase/row/row0ins.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 1a7864be5e9..c89f41f69ad 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -225,11 +225,15 @@ ulint row_ins_sec_index_entry_by_modify( /*==============================*/ /* out: DB_SUCCESS or error code */ + ulint mode, /* in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, + depending on whether mtr holds just a leaf + latch or also a tree latch */ btr_cur_t* cursor, /* in: B-tree cursor */ dtuple_t* entry, /* in: index entry to insert */ que_thr_t* thr, /* in: query thread */ mtr_t* mtr) /* in: mtr */ { + big_rec_t* dummy_big_rec; mem_heap_t* heap; upd_t* update; rec_t* rec; @@ -241,16 +245,28 @@ row_ins_sec_index_entry_by_modify( ut_ad(rec_get_deleted_flag(rec)); /* We know that in the alphabetical ordering, entry and rec are - identical. But in their binary form there may be differences if + identified. But in their binary form there may be differences if there are char fields in them. Therefore we have to calculate the - difference and do an update-in-place if necessary. */ + difference. */ heap = mem_heap_create(1024); update = row_upd_build_sec_rec_difference_binary(cursor->index, entry, rec, heap); + if (mode == BTR_MODIFY_LEAF) { + /* Try an optimistic updating of the record, keeping changes + within the page */ - err = btr_cur_update_sec_rec_in_place(cursor, update, thr, mtr); + err = btr_cur_optimistic_update(BTR_KEEP_SYS_FLAG, cursor, + update, 0, thr, mtr); + if (err == DB_OVERFLOW || err == DB_UNDERFLOW) { + err = DB_FAIL; + } + } else { + ut_a(mode == BTR_MODIFY_TREE); + err = btr_cur_pessimistic_update(BTR_KEEP_SYS_FLAG, cursor, + &dummy_big_rec, update, 0, thr, mtr); + } mem_heap_free(heap); @@ -1838,7 +1854,8 @@ row_ins_index_entry_low( ext_vec, n_ext_vec, thr, &mtr); } else { - err = row_ins_sec_index_entry_by_modify(&cursor, entry, + err = row_ins_sec_index_entry_by_modify(mode, &cursor, + entry, thr, &mtr); } |