summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0upd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/row/row0upd.cc')
-rw-r--r--storage/innobase/row/row0upd.cc51
1 files changed, 10 insertions, 41 deletions
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index ccb905b36f4..fb626519132 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1943,9 +1943,7 @@ row_upd_clust_rec_by_insert_inherit_func(
data += len - BTR_EXTERN_FIELD_REF_SIZE;
/* The pointer must not be zero. */
ut_a(memcmp(data, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
- /* The BLOB must be owned. */
- ut_a(!(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
-
+ data[BTR_EXTERN_LEN] &= ~BTR_EXTERN_OWNER_FLAG;
data[BTR_EXTERN_LEN] |= BTR_EXTERN_INHERITED_FLAG;
/* The BTR_EXTERN_INHERITED_FLAG only matters in
rollback. Purge will always free the extern fields of
@@ -2047,7 +2045,13 @@ err_exit:
rec, offsets, entry, node->update);
if (change_ownership) {
- btr_pcur_store_position(pcur, mtr);
+ /* The blobs are disowned here, expecting the
+ insert down below to inherit them. But if the
+ insert fails, then this disown will be undone
+ when the operation is rolled back. */
+ btr_cur_disown_inherited_fields(
+ btr_cur_get_page_zip(btr_cur),
+ rec, index, offsets, node->update, mtr);
}
}
@@ -2073,41 +2077,6 @@ err_exit:
? UPD_NODE_INSERT_BLOB
: UPD_NODE_INSERT_CLUSTERED;
- if (err == DB_SUCCESS && change_ownership) {
- /* Mark the non-updated fields disowned by the old record. */
-
- /* NOTE: this transaction has an x-lock on the record
- and therefore other transactions cannot modify the
- record when we have no latch on the page. In addition,
- we assume that other query threads of the same
- transaction do not modify the record in the meantime.
- Therefore we can assert that the restoration of the
- cursor succeeds. */
-
- mtr_start(mtr);
-
- if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr)) {
- ut_error;
- }
-
- rec = btr_cur_get_rec(btr_cur);
- offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
- ut_ad(page_rec_is_user_rec(rec));
- ut_ad(rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
-
- btr_cur_disown_inherited_fields(
- btr_cur_get_page_zip(btr_cur),
- rec, index, offsets, node->update, mtr);
-
- /* It is not necessary to call row_log_table for
- this, because during online table rebuild, purge will
- not free any BLOBs in the table, whether or not they
- are owned by the clustered index record. */
-
- mtr_commit(mtr);
- }
-
mem_heap_free(heap);
return(err);
@@ -2150,7 +2119,7 @@ row_upd_clust_rec(
if (dict_index_is_online_ddl(index)) {
rebuilt_old_pk = row_log_table_get_pk(
- btr_cur_get_rec(btr_cur), index, offsets, &heap);
+ btr_cur_get_rec(btr_cur), index, offsets, NULL, &heap);
}
/* Try optimistic updating of the record, keeping changes within