~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
the creating trx of the oldest view is set as not visible in the 'copied'
146
146
view. Opens a new view if no views currently exist. The view must be closed
147
147
with ..._close. This is used in purge. */
148
 
UNIV_INTERN
 
148
 
149
149
read_view_t*
150
150
read_view_oldest_copy_or_open_new(
151
151
/*==============================*/
173
173
 
174
174
        n = old_view->n_trx_ids;
175
175
 
176
 
        if (!ut_dulint_is_zero(old_view->creator_trx_id)) {
 
176
        if (ut_dulint_cmp(old_view->creator_trx_id,
 
177
                          ut_dulint_create(0,0)) != 0) {
177
178
                n++;
178
179
        } else {
179
180
                needs_insert = FALSE;
211
212
        view_copy->low_limit_no = old_view->low_limit_no;
212
213
        view_copy->low_limit_id = old_view->low_limit_id;
213
214
 
 
215
        view_copy->can_be_too_old = FALSE;
214
216
 
215
217
        if (n > 0) {
216
218
                /* The last active transaction has the smallest id: */
228
230
/*************************************************************************
229
231
Opens a read view where exactly the transactions serialized before this
230
232
point in time are seen in the view. */
231
 
UNIV_INTERN
 
233
 
232
234
read_view_t*
233
235
read_view_open_now(
234
236
/*===============*/
249
251
 
250
252
        view->creator_trx_id = cr_trx_id;
251
253
        view->type = VIEW_NORMAL;
252
 
        view->undo_no = ut_dulint_zero;
 
254
        view->undo_no = ut_dulint_create(0, 0);
253
255
 
254
256
        /* No future transactions should be visible in the view */
255
257
 
256
258
        view->low_limit_no = trx_sys->max_trx_id;
257
259
        view->low_limit_id = view->low_limit_no;
258
260
 
 
261
        view->can_be_too_old = FALSE;
 
262
 
259
263
        n = 0;
260
264
        trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
261
265
 
302
306
 
303
307
/*************************************************************************
304
308
Closes a read view. */
305
 
UNIV_INTERN
 
309
 
306
310
void
307
311
read_view_close(
308
312
/*============*/
316
320
/*************************************************************************
317
321
Closes a consistent read view for MySQL. This function is called at an SQL
318
322
statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
319
 
UNIV_INTERN
 
323
 
320
324
void
321
325
read_view_close_for_mysql(
322
326
/*======================*/
338
342
 
339
343
/*************************************************************************
340
344
Prints a read view to stderr. */
341
 
UNIV_INTERN
 
345
 
342
346
void
343
347
read_view_print(
344
348
/*============*/
360
364
                (ulong) ut_dulint_get_high(view->low_limit_no),
361
365
                (ulong) ut_dulint_get_low(view->low_limit_no));
362
366
 
363
 
        fprintf(stderr, "Read view up limit trx id " TRX_ID_FMT "\n",
364
 
                TRX_ID_PREP_PRINTF(view->up_limit_id));
 
367
        fprintf(stderr, "Read view up limit trx id %lu %lu\n",
 
368
                (ulong) ut_dulint_get_high(view->up_limit_id),
 
369
                (ulong) ut_dulint_get_low(view->up_limit_id));
365
370
 
366
 
        fprintf(stderr, "Read view low limit trx id " TRX_ID_FMT "\n",
367
 
                TRX_ID_PREP_PRINTF(view->low_limit_id));
 
371
        fprintf(stderr, "Read view low limit trx id %lu %lu\n",
 
372
                (ulong) ut_dulint_get_high(view->low_limit_id),
 
373
                (ulong) ut_dulint_get_low(view->low_limit_id));
368
374
 
369
375
        fprintf(stderr, "Read view individually stored trx ids:\n");
370
376
 
371
377
        n_ids = view->n_trx_ids;
372
378
 
373
379
        for (i = 0; i < n_ids; i++) {
374
 
                fprintf(stderr, "Read view trx id " TRX_ID_FMT "\n",
375
 
                        TRX_ID_PREP_PRINTF(
 
380
                fprintf(stderr, "Read view trx id %lu %lu\n",
 
381
                        (ulong) ut_dulint_get_high(
 
382
                                read_view_get_nth_trx_id(view, i)),
 
383
                        (ulong) ut_dulint_get_low(
376
384
                                read_view_get_nth_trx_id(view, i)));
377
385
        }
378
386
}
382
390
in cursors. In this consistent read view modifications done by the
383
391
creating transaction after the cursor is created or future transactions
384
392
are not visible. */
385
 
UNIV_INTERN
 
393
 
386
394
cursor_view_t*
387
395
read_cursor_view_create_for_mysql(
388
396
/*==============================*/
424
432
        view->low_limit_no = trx_sys->max_trx_id;
425
433
        view->low_limit_id = view->low_limit_no;
426
434
 
 
435
        view->can_be_too_old = FALSE;
 
436
 
427
437
        n = 0;
428
438
        trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
429
439
 
472
482
/*************************************************************************
473
483
Close a given consistent cursor view for mysql and restore global read view
474
484
back to a transaction read view. */
475
 
UNIV_INTERN
 
485
 
476
486
void
477
487
read_cursor_view_close_for_mysql(
478
488
/*=============================*/
501
511
This function sets a given consistent cursor view to a transaction
502
512
read view if given consistent cursor view is not NULL. Otherwise, function
503
513
restores a global read view to a transaction read view. */
504
 
UNIV_INTERN
 
514
 
505
515
void
506
516
read_cursor_set_for_mysql(
507
517
/*======================*/