~maria-captains/maria/xtradb-mergetree-5.5

« back to all changes in this revision

Viewing changes to row/row0upd.c

  • Committer: Sergei Golubchik
  • Date: 2014-06-02 21:25:54 UTC
  • Revision ID: sergii@pisem.net-20140602212554-j41oo0cyjr3xiuei
percona-server-5.5.37-35.0.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
 
3
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
1789
1789
                data += len - BTR_EXTERN_FIELD_REF_SIZE;
1790
1790
                /* The pointer must not be zero. */
1791
1791
                ut_a(memcmp(data, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
1792
 
                /* The BLOB must be owned. */
1793
 
                ut_a(!(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
1794
 
 
 
1792
                data[BTR_EXTERN_LEN] &= ~BTR_EXTERN_OWNER_FLAG;
1795
1793
                data[BTR_EXTERN_LEN] |= BTR_EXTERN_INHERITED_FLAG;
1796
1794
                /* The BTR_EXTERN_INHERITED_FLAG only matters in
1797
1795
                rollback. Purge will always free the extern fields of
1896
1894
                                rec, offsets, entry, node->update);
1897
1895
 
1898
1896
                        if (change_ownership) {
1899
 
                                btr_pcur_store_position(pcur, mtr);
 
1897
                                /* The blobs are disowned here, expecting the
 
1898
                                insert down below to inherit them.  But if the
 
1899
                                insert fails, then this disown will be undone
 
1900
                                when the operation is rolled back. */
 
1901
                                btr_cur_disown_inherited_fields(
 
1902
                                        btr_cur_get_page_zip(btr_cur),
 
1903
                                        rec, index, offsets, node->update, mtr);
1900
1904
                        }
1901
1905
                }
1902
1906
 
1922
1926
                ? UPD_NODE_INSERT_BLOB
1923
1927
                : UPD_NODE_INSERT_CLUSTERED;
1924
1928
 
1925
 
        if (err == DB_SUCCESS && change_ownership) {
1926
 
                /* Mark the non-updated fields disowned by the old record. */
1927
 
 
1928
 
                /* NOTE: this transaction has an x-lock on the record
1929
 
                and therefore other transactions cannot modify the
1930
 
                record when we have no latch on the page. In addition,
1931
 
                we assume that other query threads of the same
1932
 
                transaction do not modify the record in the meantime.
1933
 
                Therefore we can assert that the restoration of the
1934
 
                cursor succeeds. */
1935
 
 
1936
 
                mtr_start(mtr);
1937
 
 
1938
 
                if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr)) {
1939
 
                        ut_error;
1940
 
                }
1941
 
 
1942
 
                rec = btr_cur_get_rec(btr_cur);
1943
 
                offsets = rec_get_offsets(rec, index, offsets,
1944
 
                                          ULINT_UNDEFINED, &heap);
1945
 
                ut_ad(page_rec_is_user_rec(rec));
1946
 
 
1947
 
                btr_cur_disown_inherited_fields(
1948
 
                        btr_cur_get_page_zip(btr_cur),
1949
 
                        rec, index, offsets, node->update, mtr);
1950
 
 
1951
 
                mtr_commit(mtr);
1952
 
        }
1953
 
 
1954
1929
        mem_heap_free(heap);
1955
1930
 
1956
1931
        return(err);