~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/btr0pcur.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
/******************************************************************
33
33
Allocates memory for a persistent cursor object and initializes the cursor. */
34
 
 
 
34
UNIV_INTERN
35
35
btr_pcur_t*
36
36
btr_pcur_create_for_mysql(void);
37
37
/*============================*/
38
38
                                /* out, own: persistent cursor */
39
39
/******************************************************************
40
40
Frees the memory for a persistent cursor object. */
41
 
 
 
41
UNIV_INTERN
42
42
void
43
43
btr_pcur_free_for_mysql(
44
44
/*====================*/
45
45
        btr_pcur_t*     cursor);        /* in, own: persistent cursor */
46
46
/******************************************************************
47
47
Copies the stored position of a pcur to another pcur. */
48
 
 
 
48
UNIV_INTERN
49
49
void
50
50
btr_pcur_copy_stored_position(
51
51
/*==========================*/
68
68
btr_pcur_open(
69
69
/*==========*/
70
70
        dict_index_t*   index,  /* in: index */
71
 
        dtuple_t*       tuple,  /* in: tuple on which search done */
 
71
        const dtuple_t* tuple,  /* in: tuple on which search done */
72
72
        ulint           mode,   /* in: PAGE_CUR_L, ...;
73
73
                                NOTE that if the search is made using a unique
74
74
                                prefix of a record, mode should be
86
86
btr_pcur_open_with_no_init(
87
87
/*=======================*/
88
88
        dict_index_t*   index,  /* in: index */
89
 
        dtuple_t*       tuple,  /* in: tuple on which search done */
 
89
        const dtuple_t* tuple,  /* in: tuple on which search done */
90
90
        ulint           mode,   /* in: PAGE_CUR_L, ...;
91
91
                                NOTE that if the search is made using a unique
92
92
                                prefix of a record, mode should be
143
143
in the first case sets the cursor after last in tree, and in the latter case
144
144
before first in tree. The latching mode must be BTR_SEARCH_LEAF or
145
145
BTR_MODIFY_LEAF. */
146
 
 
 
146
UNIV_INTERN
147
147
void
148
148
btr_pcur_open_on_user_rec(
149
149
/*======================*/
150
150
        dict_index_t*   index,          /* in: index */
151
 
        dtuple_t*       tuple,          /* in: tuple on which search done */
 
151
        const dtuple_t* tuple,          /* in: tuple on which search done */
152
152
        ulint           mode,           /* in: PAGE_CUR_L, ... */
153
153
        ulint           latch_mode,     /* in: BTR_SEARCH_LEAF or
154
154
                                        BTR_MODIFY_LEAF */
180
180
first in an EMPTY tree, or after the last in an EMPTY tree. NOTE that the
181
181
page where the cursor is positioned must not be empty if the index tree is
182
182
not totally empty! */
183
 
 
 
183
UNIV_INTERN
184
184
void
185
185
btr_pcur_store_position(
186
186
/*====================*/
198
198
GREATER than the user record which was the predecessor of the supremum.
199
199
(4) cursor was positioned before the first or after the last in an empty tree:
200
200
restores to before first or after the last in the tree. */
201
 
 
 
201
UNIV_INTERN
202
202
ibool
203
203
btr_pcur_restore_position(
204
204
/*======================*/
216
216
NOTE! In the case of BTR_LEAF_MODIFY, there should not exist changes
217
217
made by the current mini-transaction to the data protected by the
218
218
cursor latch, as then the latch must not be released until mtr_commit. */
219
 
 
 
219
UNIV_INTERN
220
220
void
221
221
btr_pcur_release_leaf(
222
222
/*==================*/
228
228
ulint
229
229
btr_pcur_get_rel_pos(
230
230
/*=================*/
231
 
                                /* out: BTR_PCUR_ON, ... */
232
 
        btr_pcur_t*     cursor);/* in: persistent cursor */
 
231
                                        /* out: BTR_PCUR_ON, ... */
 
232
        const btr_pcur_t*       cursor);/* in: persistent cursor */
233
233
/*************************************************************
234
234
Sets the mtr field for a pcur. */
235
235
UNIV_INLINE
288
288
/*************************************************************
289
289
Moves the persistent cursor to the previous record in the tree. If no records
290
290
are left, the cursor stays 'before first in tree'. */
291
 
 
 
291
UNIV_INTERN
292
292
ibool
293
293
btr_pcur_move_to_prev(
294
294
/*==================*/
322
322
Releases the latch on the current page, and bufferunfixes it.
323
323
Note that there must not be modifications on the current page,
324
324
as then the x-latch can be released only in mtr_commit. */
325
 
 
 
325
UNIV_INTERN
326
326
void
327
327
btr_pcur_move_to_next_page(
328
328
/*=======================*/
339
339
on return, but it may happen that the cursor is not positioned on the
340
340
last record of any page, because the structure of the tree may have
341
341
changed while the cursor had no latches. */
342
 
 
 
342
UNIV_INTERN
343
343
void
344
344
btr_pcur_move_backward_from_page(
345
345
/*=============================*/
346
346
        btr_pcur_t*     cursor, /* in: persistent cursor, must be on the
347
347
                                first record of the current page */
348
348
        mtr_t*          mtr);   /* in: mtr */
 
349
#ifdef UNIV_DEBUG
349
350
/*************************************************************
350
351
Returns the btr cursor component of a persistent cursor. */
351
352
UNIV_INLINE
352
353
btr_cur_t*
353
354
btr_pcur_get_btr_cur(
354
355
/*=================*/
355
 
                                /* out: pointer to btr cursor component */
356
 
        btr_pcur_t*     cursor);        /* in: persistent cursor */
 
356
                                                /* out: pointer to
 
357
                                                btr cursor component */
 
358
        const btr_pcur_t*       cursor);        /* in: persistent cursor */
357
359
/*************************************************************
358
360
Returns the page cursor component of a persistent cursor. */
359
361
UNIV_INLINE
360
362
page_cur_t*
361
363
btr_pcur_get_page_cur(
362
364
/*==================*/
363
 
                                /* out: pointer to page cursor component */
364
 
        btr_pcur_t*     cursor);        /* in: persistent cursor */
 
365
                                                /* out: pointer to
 
366
                                                page cursor component */
 
367
        const btr_pcur_t*       cursor);        /* in: persistent cursor */
 
368
#else /* UNIV_DEBUG */
 
369
# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur)
 
370
# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur)
 
371
#endif /* UNIV_DEBUG */
365
372
/*************************************************************
366
373
Returns the page of a persistent cursor. */
367
374
UNIV_INLINE
371
378
                                /* out: pointer to the page */
372
379
        btr_pcur_t*     cursor);/* in: persistent cursor */
373
380
/*************************************************************
 
381
Returns the buffer block of a persistent cursor. */
 
382
UNIV_INLINE
 
383
buf_block_t*
 
384
btr_pcur_get_block(
 
385
/*===============*/
 
386
                                /* out: pointer to the block */
 
387
        btr_pcur_t*     cursor);/* in: persistent cursor */
 
388
/*************************************************************
374
389
Returns the record of a persistent cursor. */
375
390
UNIV_INLINE
376
391
rec_t*
384
399
ibool
385
400
btr_pcur_is_on_user_rec(
386
401
/*====================*/
387
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
388
 
        mtr_t*          mtr);   /* in: mtr */
 
402
        const btr_pcur_t*       cursor);/* in: persistent cursor */
389
403
/*************************************************************
390
404
Checks if the persistent cursor is after the last user record on
391
405
a page. */
393
407
ibool
394
408
btr_pcur_is_after_last_on_page(
395
409
/*===========================*/
396
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
397
 
        mtr_t*          mtr);   /* in: mtr */
 
410
        const btr_pcur_t*       cursor);/* in: persistent cursor */
398
411
/*************************************************************
399
412
Checks if the persistent cursor is before the first user record on
400
413
a page. */
402
415
ibool
403
416
btr_pcur_is_before_first_on_page(
404
417
/*=============================*/
405
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
406
 
        mtr_t*          mtr);   /* in: mtr */
 
418
        const btr_pcur_t*       cursor);/* in: persistent cursor */
407
419
/*************************************************************
408
420
Checks if the persistent cursor is before the first user record in
409
421
the index tree. */
428
440
void
429
441
btr_pcur_move_to_next_on_page(
430
442
/*==========================*/
431
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
432
 
        mtr_t*          mtr);   /* in: mtr */
 
443
        btr_pcur_t*     cursor);/* in/out: persistent cursor */
433
444
/*************************************************************
434
445
Moves the persistent cursor to the previous record on the same page. */
435
446
UNIV_INLINE
436
447
void
437
448
btr_pcur_move_to_prev_on_page(
438
449
/*==========================*/
439
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
440
 
        mtr_t*          mtr);   /* in: mtr */
 
450
        btr_pcur_t*     cursor);/* in/out: persistent cursor */
441
451
 
442
452
 
443
453
/* The persistent B-tree cursor structure. This is used mainly for SQL
468
478
                                        cursor was on, before, or after the
469
479
                                        old_rec record */
470
480
        buf_block_t*    block_when_stored;/* buffer block when the position was
471
 
                                        stored; note that if AWE is on, frames
472
 
                                        may move */
473
 
        dulint          modify_clock;   /* the modify clock value of the
 
481
                                        stored */
 
482
        ib_uint64_t     modify_clock;   /* the modify clock value of the
474
483
                                        buffer block when the cursor position
475
484
                                        was stored */
476
485
        ulint           pos_state;      /* see TODO note below!