summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorAnnamalai Gurusami <annamalai.gurusami@oracle.com>2014-01-30 12:38:13 +0530
committerAnnamalai Gurusami <annamalai.gurusami@oracle.com>2014-01-30 12:38:13 +0530
commit761735d9b913becf96a01fed0c8b911a3a411c1a (patch)
tree0c35d7c116e4fa4f3ae4918d9a1af8cb74fe0471 /storage/innobase
parentde6cdc7952ef57730e62756ab6f4af76850b0396 (diff)
downloadmariadb-git-761735d9b913becf96a01fed0c8b911a3a411c1a.tar.gz
Bug #14668683 ASSERT REC_GET_DELETED_FLAG(REC, PAGE_IS_COMP(PAGE))
Problem: The function row_upd_changes_ord_field_binary() is used to decide whether to use row_upd_clust_rec_by_insert() or row_upd_clust_rec(). The function row_upd_changes_ord_field_binary() does not make use of charset information. Based on binary comparison it decides that r1 and r2 differ in their ordering fields. In the function row_upd_clust_rec_by_insert(), an update is done by delete + insert. These operations internally make use of cmp_dtuple_rec_with_match() to compare records r1 and r2. This comparison takes place with the use of charset information. This means that it is possible for the deleted record to be reused in the subsequent insert. In the given scenario, the characters 'a' and 'A' are considered equal in the my_charset_latin1. When this happens, the ownership information of externally stored blobs are not correctly handled. Solution: When an update is done by delete followed by insert, disown the relevant externally stored fields during the delete marking itself (within the same mtr). If the insert succeeds, then nothing with respect to blob ownership needs to be done. If the insert fails, then the disown done earlier will be removed when the operation is rolled back. rb#4479 approved by Marko.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/row/row0upd.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
index 8a4d52d7e3d..dccfa5ceb5c 100644
--- a/storage/innobase/row/row0upd.c
+++ b/storage/innobase/row/row0upd.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2013, 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
@@ -1873,7 +1873,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);
}
}
@@ -1899,35 +1905,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));
-
- btr_cur_disown_inherited_fields(
- btr_cur_get_page_zip(btr_cur),
- rec, index, offsets, node->update, mtr);
-
- mtr_commit(mtr);
- }
-
mem_heap_free(heap);
return(err);