~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: lbieber
  • Date: 2010-10-06 16:34:16 UTC
  • mfrom: (1816.1.3 build)
  • Revision ID: lbieber@orisndriz08-20101006163416-ea0sl59qgpglk21y
Merge Monty - Change the requirement from either libinnodb to libhaildb. Also, tied it to version 2.2
Merge Andrew - fix bug 650935: remove --compress from all clients
Merge Andrew - fix bug 653471: Add -A to drizzle client
Merge Travis - 621861 = To change C structs to C++ classes in Drizzle

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1997, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2009, 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
 
/*************************************************************************
60
 
IMPORTANT NOTE: Any operation that generates redo MUST check that there
61
 
is enough space in the redo log before for that operation. This is
62
 
done by calling log_free_check(). The reason for checking the
63
 
availability of the redo log space before the start of the operation is
64
 
that we MUST not hold any synchonization objects when performing the
65
 
check.
66
 
If you make a change in this module make sure that no codepath is
67
 
introduced where a call to log_free_check() is bypassed. */
68
 
 
69
49
/***************************************************************//**
70
50
Removes a clustered index record. The pcur in node was positioned on the
71
51
record, now it is detached.
88
68
                                            &mtr);
89
69
        ut_a(success);
90
70
 
91
 
        if (node->table->id == DICT_INDEXES_ID) {
 
71
        if (ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
92
72
                ut_ad(node->trx->dict_operation_lock_mode == RW_X_LATCH);
93
73
 
94
74
                /* Drop the index tree associated with the row in
165
145
        dict_index_t*   index,  /*!< in: index */
166
146
        dtuple_t*       entry)  /*!< in: index entry to remove */
167
147
{
168
 
        btr_pcur_t              pcur;
169
 
        btr_cur_t*              btr_cur;
170
 
        ulint                   err;
171
 
        mtr_t                   mtr;
172
 
        enum row_search_result  search_result;
 
148
        btr_pcur_t      pcur;
 
149
        btr_cur_t*      btr_cur;
 
150
        ibool           found;
 
151
        ibool           success;
 
152
        ulint           err;
 
153
        mtr_t           mtr;
173
154
 
 
155
        log_free_check();
174
156
        mtr_start(&mtr);
175
157
 
 
158
        found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
 
159
 
176
160
        btr_cur = btr_pcur_get_btr_cur(&pcur);
177
161
 
178
 
        ut_ad(mode == BTR_MODIFY_TREE || mode == BTR_MODIFY_LEAF);
179
 
 
180
 
        search_result = row_search_index_entry(index, entry, mode,
181
 
                                               &pcur, &mtr);
182
 
 
183
 
        switch (search_result) {
184
 
        case ROW_NOT_FOUND:
185
 
                err = DB_SUCCESS;
186
 
                goto func_exit;
187
 
        case ROW_FOUND:
188
 
                break;
189
 
        case ROW_BUFFERED:
190
 
        case ROW_NOT_DELETED_REF:
191
 
                /* These are invalid outcomes, because the mode passed
192
 
                to row_search_index_entry() did not include any of the
193
 
                flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
194
 
                ut_error;
 
162
        if (!found) {
 
163
                /* Not found */
 
164
 
 
165
                btr_pcur_close(&pcur);
 
166
                mtr_commit(&mtr);
 
167
 
 
168
                return(DB_SUCCESS);
195
169
        }
196
170
 
197
171
        if (mode == BTR_MODIFY_LEAF) {
198
 
                err = btr_cur_optimistic_delete(btr_cur, &mtr)
199
 
                        ? DB_SUCCESS : DB_FAIL;
 
172
                success = btr_cur_optimistic_delete(btr_cur, &mtr);
 
173
 
 
174
                if (success) {
 
175
                        err = DB_SUCCESS;
 
176
                } else {
 
177
                        err = DB_FAIL;
 
178
                }
200
179
        } else {
201
180
                ut_ad(mode == BTR_MODIFY_TREE);
202
181
 
209
188
                btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
210
189
                                           RB_NORMAL, &mtr);
211
190
        }
212
 
func_exit:
 
191
 
213
192
        btr_pcur_close(&pcur);
214
193
        mtr_commit(&mtr);
215
194
 
270
249
        dict_index_t*   clust_index;
271
250
        byte*           ptr;
272
251
        undo_no_t       undo_no;
273
 
        table_id_t      table_id;
 
252
        dulint          table_id;
274
253
        ulint           type;
275
254
        ulint           dummy;
276
255
        ibool           dummy_extern;
356
335
                        transactions. */
357
336
                        ut_a(trx_is_recv(node->trx));
358
337
                } else {
359
 
                        log_free_check();
360
338
                        err = row_undo_ins_remove_sec(node->index, entry);
361
339
 
362
340
                        if (err != DB_SUCCESS) {
368
346
                node->index = dict_table_get_next_index(node->index);
369
347
        }
370
348
 
371
 
        log_free_check();
372
349
        return(row_undo_ins_remove_clust_rec(node));
373
350
}