~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/include/btr0cur.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1994, 2011, 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
242
242
        que_thr_t*      thr,    /*!< in: query thread or NULL */
243
243
        mtr_t*          mtr);   /*!< in: mtr */
244
244
/*************************************************************//**
 
245
See if there is enough place in the page modification log to log
 
246
an update-in-place.
 
247
@return TRUE if enough place */
 
248
UNIV_INTERN
 
249
ibool
 
250
btr_cur_update_alloc_zip(
 
251
/*=====================*/
 
252
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
 
253
        buf_block_t*    block,  /*!< in/out: buffer page */
 
254
        dict_index_t*   index,  /*!< in: the index corresponding to the block */
 
255
        ulint           length, /*!< in: size needed */
 
256
        ibool           create, /*!< in: TRUE=delete-and-insert,
 
257
                                FALSE=update-in-place */
 
258
        mtr_t*          mtr)    /*!< in: mini-transaction */
 
259
        __attribute__((nonnull, warn_unused_result));
 
260
/*************************************************************//**
245
261
Updates a record when the update causes no size changes in its fields.
246
262
@return DB_SUCCESS or error number */
247
263
UNIV_INTERN
316
332
btr_cur_del_mark_set_clust_rec(
317
333
/*===========================*/
318
334
        ulint           flags,  /*!< in: undo logging and locking flags */
319
 
        btr_cur_t*      cursor, /*!< in: cursor */
 
335
        buf_block_t*    block,  /*!< in/out: buffer block of the record */
 
336
        rec_t*          rec,    /*!< in/out: record */
 
337
        dict_index_t*   index,  /*!< in: clustered index of the record */
 
338
        const ulint*    offsets,/*!< in: rec_get_offsets(rec) */
320
339
        ibool           val,    /*!< in: value to set */
321
340
        que_thr_t*      thr,    /*!< in: query thread */
322
 
        mtr_t*          mtr);   /*!< in: mtr */
 
341
        mtr_t*          mtr)    /*!< in: mtr */
 
342
        __attribute__((nonnull));
323
343
/***********************************************************//**
324
344
Sets a secondary index record delete mark to TRUE or FALSE.
325
345
@return DB_SUCCESS, DB_LOCK_WAIT, or error number */
458
478
/*******************************************************************//**
459
479
Estimates the number of different key values in a given index, for
460
480
each n-column prefix of the index where n <= dict_index_get_n_unique(index).
461
 
The estimates are stored in the array index->stat_n_diff_key_vals. */
 
481
The estimates are stored in the array index->stat_n_diff_key_vals.
 
482
If innodb_stats_method is nulls_ignored, we also record the number of
 
483
non-null values for each prefix and stored the estimates in
 
484
array index->stat_n_non_null_key_vals. */
462
485
UNIV_INTERN
463
486
void
464
487
btr_estimate_number_of_different_key_vals(
465
488
/*======================================*/
466
489
        dict_index_t*   index); /*!< in: index */
467
490
/*******************************************************************//**
468
 
Marks not updated extern fields as not-owned by this record. The ownership
469
 
is transferred to the updated record which is inserted elsewhere in the
 
491
Marks non-updated off-page fields as disowned by this record. The ownership
 
492
must be transferred to the updated record which is inserted elsewhere in the
470
493
index tree. In purge only the owner of externally stored field is allowed
471
494
to free the field. */
472
495
UNIV_INTERN
473
496
void
474
 
btr_cur_mark_extern_inherited_fields(
475
 
/*=================================*/
 
497
btr_cur_disown_inherited_fields(
 
498
/*============================*/
476
499
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
477
500
                                part will be updated, or NULL */
478
501
        rec_t*          rec,    /*!< in/out: record in a clustered index */
479
502
        dict_index_t*   index,  /*!< in: index of the page */
480
503
        const ulint*    offsets,/*!< in: array returned by rec_get_offsets() */
481
504
        const upd_t*    update, /*!< in: update vector */
482
 
        mtr_t*          mtr);   /*!< in: mtr, or NULL if not logged */
483
 
/*******************************************************************//**
484
 
The complement of the previous function: in an update entry may inherit
485
 
some externally stored fields from a record. We must mark them as inherited
486
 
in entry, so that they are not freed in a rollback. */
487
 
UNIV_INTERN
488
 
void
489
 
btr_cur_mark_dtuple_inherited_extern(
490
 
/*=================================*/
491
 
        dtuple_t*       entry,          /*!< in/out: updated entry to be
492
 
                                        inserted to clustered index */
493
 
        const upd_t*    update);        /*!< in: update vector */
494
 
/*******************************************************************//**
495
 
Marks all extern fields in a dtuple as owned by the record. */
496
 
UNIV_INTERN
497
 
void
498
 
btr_cur_unmark_dtuple_extern_fields(
499
 
/*================================*/
500
 
        dtuple_t*       entry);         /*!< in/out: clustered index entry */
 
505
        mtr_t*          mtr)    /*!< in/out: mini-transaction */
 
506
        __attribute__((nonnull(2,3,4,5,6)));
501
507
/*******************************************************************//**
502
508
Stores the fields in big_rec_vec to the tablespace and puts pointers to
503
509
them in rec.  The extern flags in rec will have to be set beforehand.
504
510
The fields are stored on pages allocated from leaf node
505
511
file segment of the index tree.
506
 
@return DB_SUCCESS or error */
 
512
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
507
513
UNIV_INTERN
508
514
ulint
509
 
btr_store_big_rec_extern_fields(
510
 
/*============================*/
 
515
btr_store_big_rec_extern_fields_func(
 
516
/*=================================*/
511
517
        dict_index_t*   index,          /*!< in: index of rec; the index tree
512
518
                                        MUST be X-latched */
513
519
        buf_block_t*    rec_block,      /*!< in/out: block containing rec */
516
522
                                        the "external storage" flags in offsets
517
523
                                        will not correspond to rec when
518
524
                                        this function returns */
519
 
        big_rec_t*      big_rec_vec,    /*!< in: vector containing fields
 
525
#ifdef UNIV_DEBUG
 
526
        mtr_t*          local_mtr,      /*!< in: mtr containing the
 
527
                                        latch to rec and to the tree */
 
528
#endif /* UNIV_DEBUG */
 
529
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
 
530
        ibool           update_in_place,/*! in: TRUE if the record is updated
 
531
                                        in place (not delete+insert) */
 
532
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
 
533
        const big_rec_t*big_rec_vec)    /*!< in: vector containing fields
520
534
                                        to be stored externally */
521
 
        mtr_t*          local_mtr);     /*!< in: mtr containing the latch to
522
 
                                        rec and to the tree */
 
535
        __attribute__((nonnull));
 
536
 
 
537
/** Stores the fields in big_rec_vec to the tablespace and puts pointers to
 
538
them in rec.  The extern flags in rec will have to be set beforehand.
 
539
The fields are stored on pages allocated from leaf node
 
540
file segment of the index tree.
 
541
@param index    in: clustered index; MUST be X-latched by mtr
 
542
@param b        in/out: block containing rec; MUST be X-latched by mtr
 
543
@param rec      in/out: clustered index record
 
544
@param offsets  in: rec_get_offsets(rec, index);
 
545
                the "external storage" flags in offsets will not be adjusted
 
546
@param mtr      in: mini-transaction that holds x-latch on index and b
 
547
@param upd      in: TRUE if the record is updated in place (not delete+insert)
 
548
@param big      in: vector containing fields to be stored externally
 
549
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
 
550
#ifdef UNIV_DEBUG
 
551
# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
 
552
        btr_store_big_rec_extern_fields_func(index,b,rec,offsets,mtr,upd,big)
 
553
#elif defined UNIV_BLOB_LIGHT_DEBUG
 
554
# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
 
555
        btr_store_big_rec_extern_fields_func(index,b,rec,offsets,upd,big)
 
556
#else
 
557
# define btr_store_big_rec_extern_fields(index,b,rec,offsets,mtr,upd,big) \
 
558
        btr_store_big_rec_extern_fields_func(index,b,rec,offsets,big)
 
559
#endif
 
560
 
523
561
/*******************************************************************//**
524
562
Frees the space in an externally stored field to the file space
525
563
management if the field in data is owned the externally stored field,
570
608
        ulint           local_len);/*!< in: length of data, in bytes */
571
609
/*******************************************************************//**
572
610
Copies an externally stored field of a record to mem heap.
573
 
@return the field copied to heap */
 
611
@return the field copied to heap, or NULL if the field is incomplete */
574
612
UNIV_INTERN
575
613
byte*
576
614
btr_rec_copy_externally_stored_field(