~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/row/row0uins.c

Merge initial InnoDB+ import.

This was applied by generating a patch between MySQL 5.1.50 InnoDB plugin and
the just-merged innodb+ from mysql-trunk revision-id: vasil.dimov@oracle.com-20100422110752-1zowoqxel5xx3z2e

Then, some manual merge resolving and it worked. This should make it much
easier to merge the rest of InnoDB 1.1 and 1.2 from the mysql tree using
my bzr-reapply script.

This takes us to InnoDB 1.1.1(ish).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2010, Innobase Oy. 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
46
46
#include "ibuf0ibuf.h"
47
47
#include "log0log.h"
48
48
 
49
 
/*************************************************************************
50
 
IMPORTANT NOTE: Any operation that generates redo MUST check that there
51
 
is enough space in the redo log before for that operation. This is
52
 
done by calling log_free_check(). The reason for checking the
53
 
availability of the redo log space before the start of the operation is
54
 
that we MUST not hold any synchonization objects when performing the
55
 
check.
56
 
If you make a change in this module make sure that no codepath is
57
 
introduced where a call to log_free_check() is bypassed. */
58
 
 
59
49
/***************************************************************//**
60
50
Removes a clustered index record. The pcur in node was positioned on the
61
51
record, now it is detached.
155
145
        dict_index_t*   index,  /*!< in: index */
156
146
        dtuple_t*       entry)  /*!< in: index entry to remove */
157
147
{
158
 
        btr_pcur_t      pcur;
159
 
        btr_cur_t*      btr_cur;
160
 
        ibool           found;
161
 
        ibool           success;
162
 
        ulint           err;
163
 
        mtr_t           mtr;
 
148
        btr_pcur_t              pcur;
 
149
        btr_cur_t*              btr_cur;
 
150
        ulint                   err;
 
151
        mtr_t                   mtr;
 
152
        enum row_search_result  search_result;
164
153
 
 
154
        log_free_check();
165
155
        mtr_start(&mtr);
166
156
 
167
 
        found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
168
 
 
169
157
        btr_cur = btr_pcur_get_btr_cur(&pcur);
170
158
 
171
 
        if (!found) {
172
 
                /* Not found */
173
 
 
174
 
                btr_pcur_close(&pcur);
175
 
                mtr_commit(&mtr);
176
 
 
177
 
                return(DB_SUCCESS);
 
159
        ut_ad(mode == BTR_MODIFY_TREE || mode == BTR_MODIFY_LEAF);
 
160
 
 
161
        search_result = row_search_index_entry(index, entry, mode,
 
162
                                               &pcur, &mtr);
 
163
 
 
164
        switch (search_result) {
 
165
        case ROW_NOT_FOUND:
 
166
                err = DB_SUCCESS;
 
167
                goto func_exit;
 
168
        case ROW_FOUND:
 
169
                break;
 
170
        case ROW_BUFFERED:
 
171
        case ROW_NOT_DELETED_REF:
 
172
                /* These are invalid outcomes, because the mode passed
 
173
                to row_search_index_entry() did not include any of the
 
174
                flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
 
175
                ut_error;
178
176
        }
179
177
 
180
178
        if (mode == BTR_MODIFY_LEAF) {
181
 
                success = btr_cur_optimistic_delete(btr_cur, &mtr);
182
 
 
183
 
                if (success) {
184
 
                        err = DB_SUCCESS;
185
 
                } else {
186
 
                        err = DB_FAIL;
187
 
                }
 
179
                err = btr_cur_optimistic_delete(btr_cur, &mtr)
 
180
                        ? DB_SUCCESS : DB_FAIL;
188
181
        } else {
189
182
                ut_ad(mode == BTR_MODIFY_TREE);
190
183
 
197
190
                btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
198
191
                                           RB_NORMAL, &mtr);
199
192
        }
200
 
 
 
193
func_exit:
201
194
        btr_pcur_close(&pcur);
202
195
        mtr_commit(&mtr);
203
196
 
344
337
                        transactions. */
345
338
                        ut_a(trx_is_recv(node->trx));
346
339
                } else {
347
 
                        log_free_check();
348
340
                        err = row_undo_ins_remove_sec(node->index, entry);
349
341
 
350
342
                        if (err != DB_SUCCESS) {
356
348
                node->index = dict_table_get_next_index(node->index);
357
349
        }
358
350
 
359
 
        log_free_check();
360
351
        return(row_undo_ins_remove_clust_rec(node));
361
352
}