~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/read/read0read.c

  • Committer: Lee Bieber
  • Date: 2010-11-14 23:15:42 UTC
  • mfrom: (1929.1.42 warning-stack-frame)
  • Revision ID: kalebral@gmail.com-20101114231542-fnnu6ydd2p17n582
Merge Monty - fix bug 672372: some functions use > 32k stack

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, 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
149
149
{
150
150
        read_view_t*    view;
151
151
 
152
 
        view = static_cast<read_view_t *>(mem_heap_alloc(heap, sizeof(read_view_t)));
 
152
        view = mem_heap_alloc(heap, sizeof(read_view_t));
153
153
 
154
154
        view->n_trx_ids = n;
155
 
        view->trx_ids = static_cast<trx_id_t *>(mem_heap_alloc(heap, n * sizeof *view->trx_ids));
 
155
        view->trx_ids = mem_heap_alloc(heap, n * sizeof *view->trx_ids);
156
156
 
157
157
        return(view);
158
158
}
168
168
read_view_oldest_copy_or_open_new(
169
169
/*==============================*/
170
170
        trx_id_t        cr_trx_id,      /*!< in: trx_id of creating
171
 
                                        transaction, or 0 used in purge */
 
171
                                        transaction, or ut_dulint_zero
 
172
                                        used in purge */
172
173
        mem_heap_t*     heap)           /*!< in: memory heap from which
173
174
                                        allocated */
174
175
{
190
191
 
191
192
        n = old_view->n_trx_ids;
192
193
 
193
 
        if (old_view->creator_trx_id) {
 
194
        if (!ut_dulint_is_zero(old_view->creator_trx_id)) {
194
195
                n++;
195
196
        } else {
196
197
                needs_insert = FALSE;
205
206
        while (i < n) {
206
207
                if (needs_insert
207
208
                    && (i >= old_view->n_trx_ids
208
 
                        || old_view->creator_trx_id
209
 
                        > read_view_get_nth_trx_id(old_view, i))) {
 
209
                        || ut_dulint_cmp(old_view->creator_trx_id,
 
210
                                         read_view_get_nth_trx_id(old_view, i))
 
211
                        > 0)) {
210
212
 
211
213
                        read_view_set_nth_trx_id(view_copy, i,
212
214
                                                 old_view->creator_trx_id);
250
252
read_view_open_now(
251
253
/*===============*/
252
254
        trx_id_t        cr_trx_id,      /*!< in: trx_id of creating
253
 
                                        transaction, or 0 used in purge */
 
255
                                        transaction, or ut_dulint_zero
 
256
                                        used in purge */
254
257
        mem_heap_t*     heap)           /*!< in: memory heap from which
255
258
                                        allocated */
256
259
{
264
267
 
265
268
        view->creator_trx_id = cr_trx_id;
266
269
        view->type = VIEW_NORMAL;
267
 
        view->undo_no = 0;
 
270
        view->undo_no = ut_dulint_zero;
268
271
 
269
272
        /* No future transactions should be visible in the view */
270
273
 
277
280
        /* No active transaction should be visible, except cr_trx */
278
281
 
279
282
        while (trx) {
280
 
                if (trx->id != cr_trx_id
 
283
                if (ut_dulint_cmp(trx->id, cr_trx_id) != 0
281
284
                    && (trx->conc_state == TRX_ACTIVE
282
285
                        || trx->conc_state == TRX_PREPARED)) {
283
286
 
289
292
                        trx_sys->max_trx_id can still be active, if it is
290
293
                        in the middle of its commit! Note that when a
291
294
                        transaction starts, we initialize trx->no to
292
 
                        IB_ULONGLONG_MAX. */
 
295
                        ut_dulint_max. */
293
296
 
294
 
                        if (view->low_limit_no > trx->no) {
 
297
                        if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
295
298
 
296
299
                                view->low_limit_no = trx->no;
297
300
                        }
364
367
 
365
368
        if (view->type == VIEW_HIGH_GRANULARITY) {
366
369
                fprintf(stderr,
367
 
                        "High-granularity read view undo_n:o %llu\n",
368
 
                        (ullint) view->undo_no);
 
370
                        "High-granularity read view undo_n:o %lu %lu\n",
 
371
                        (ulong) ut_dulint_get_high(view->undo_no),
 
372
                        (ulong) ut_dulint_get_low(view->undo_no));
369
373
        } else {
370
374
                fprintf(stderr, "Normal read view\n");
371
375
        }
372
376
 
373
 
        fprintf(stderr, "Read view low limit trx n:o " TRX_ID_FMT "\n",
374
 
                view->low_limit_no);
 
377
        fprintf(stderr, "Read view low limit trx n:o %lu %lu\n",
 
378
                (ulong) ut_dulint_get_high(view->low_limit_no),
 
379
                (ulong) ut_dulint_get_low(view->low_limit_no));
375
380
 
376
381
        fprintf(stderr, "Read view up limit trx id " TRX_ID_FMT "\n",
377
 
                view->up_limit_id);
 
382
                TRX_ID_PREP_PRINTF(view->up_limit_id));
378
383
 
379
384
        fprintf(stderr, "Read view low limit trx id " TRX_ID_FMT "\n",
380
 
                view->low_limit_id);
 
385
                TRX_ID_PREP_PRINTF(view->low_limit_id));
381
386
 
382
387
        fprintf(stderr, "Read view individually stored trx ids:\n");
383
388
 
385
390
 
386
391
        for (i = 0; i < n_ids; i++) {
387
392
                fprintf(stderr, "Read view trx id " TRX_ID_FMT "\n",
388
 
                        read_view_get_nth_trx_id(view, i));
 
393
                        TRX_ID_PREP_PRINTF(
 
394
                                read_view_get_nth_trx_id(view, i)));
389
395
        }
390
396
}
391
397
 
449
455
                        trx_sys->max_trx_id can still be active, if it is
450
456
                        in the middle of its commit! Note that when a
451
457
                        transaction starts, we initialize trx->no to
452
 
                        IB_ULONGLONG_MAX. */
 
458
                        ut_dulint_max. */
453
459
 
454
 
                        if (view->low_limit_no > trx->no) {
 
460
                        if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
455
461
 
456
462
                                view->low_limit_no = trx->no;
457
463
                        }