~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/ibuf0ibuf.h

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

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
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
35
35
#ifndef UNIV_HOTBACKUP
36
36
# include "ibuf0types.h"
37
37
 
 
38
/* Possible operations buffered in the insert/whatever buffer. See
 
39
ibuf_insert(). DO NOT CHANGE THE VALUES OF THESE, THEY ARE STORED ON DISK. */
 
40
typedef enum {
 
41
        IBUF_OP_INSERT = 0,
 
42
        IBUF_OP_DELETE_MARK = 1,
 
43
        IBUF_OP_DELETE = 2,
 
44
 
 
45
        /* Number of different operation types. */
 
46
        IBUF_OP_COUNT = 3
 
47
} ibuf_op_t;
 
48
 
38
49
/** Combinations of operations that can be buffered.  Because the enum
39
50
values are used for indexing innobase_change_buffering_values[], they
40
51
should start at 0 and there should not be any gaps. */
41
52
typedef enum {
42
53
        IBUF_USE_NONE = 0,
43
54
        IBUF_USE_INSERT,        /* insert */
 
55
        IBUF_USE_DELETE_MARK,   /* delete */
 
56
        IBUF_USE_INSERT_DELETE_MARK,    /* insert+delete */
 
57
        IBUF_USE_DELETE,        /* delete+purge */
 
58
        IBUF_USE_ALL,           /* insert+delete+purge */
44
59
 
45
60
        IBUF_USE_COUNT          /* number of entries in ibuf_use_t */
46
61
} ibuf_use_t;
48
63
/** Operations that can currently be buffered. */
49
64
extern ibuf_use_t       ibuf_use;
50
65
 
 
66
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
 
67
/** Flag to control insert buffer debugging. */
 
68
extern uint             ibuf_debug;
 
69
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
 
70
 
51
71
/** The insert buffer control structure */
52
72
extern ibuf_t*          ibuf;
53
73
 
72
92
free bits could momentarily be set too high. */
73
93
 
74
94
/******************************************************************//**
75
 
Creates the insert buffer data structure at a database startup and
76
 
initializes the data structures for the insert buffer of each tablespace. */
 
95
Creates the insert buffer data structure at a database startup. */
77
96
UNIV_INTERN
78
97
void
79
98
ibuf_init_at_db_start(void);
243
262
ibuf_free_excess_pages(void);
244
263
/*========================*/
245
264
/*********************************************************************//**
246
 
Makes an index insert to the insert buffer, instead of directly to the disk
247
 
page, if this is possible. Does not do insert if the index is clustered
248
 
or unique.
 
265
Buffer an operation in the insert/delete buffer, instead of doing it
 
266
directly to the disk page, if this is possible. Does not do it if the index
 
267
is clustered or unique.
249
268
@return TRUE if success */
250
269
UNIV_INTERN
251
270
ibool
252
271
ibuf_insert(
253
272
/*========*/
 
273
        ibuf_op_t       op,     /*!< in: operation type */
254
274
        const dtuple_t* entry,  /*!< in: index entry to insert */
255
275
        dict_index_t*   index,  /*!< in: index where to insert */
256
276
        ulint           space,  /*!< in: space id where to insert */
259
279
        que_thr_t*      thr);   /*!< in: query thread */
260
280
/*********************************************************************//**
261
281
When an index page is read from a disk to the buffer pool, this function
262
 
inserts to the page the possible index entries buffered in the insert buffer.
263
 
The entries are deleted from the insert buffer. If the page is not read, but
264
 
created in the buffer pool, this function deletes its buffered entries from
265
 
the insert buffer; there can exist entries for such a page if the page
266
 
belonged to an index which subsequently was dropped. */
 
282
applies any buffered operations to the page and deletes the entries from the
 
283
insert buffer. If the page is not read, but created in the buffer pool, this
 
284
function deletes its buffered entries from the insert buffer; there can
 
285
exist entries for such a page if the page belonged to an index which
 
286
subsequently was dropped. */
267
287
UNIV_INTERN
268
288
void
269
289
ibuf_merge_or_delete_for_page(
356
376
ibuf_print(
357
377
/*=======*/
358
378
        FILE*   file);  /*!< in: file where to print */
 
379
/********************************************************************
 
380
Read the first two bytes from a record's fourth field (counter field in new
 
381
records; something else in older records).
 
382
@return "counter" field, or ULINT_UNDEFINED if for some reason it can't be read */
 
383
UNIV_INTERN
 
384
ulint
 
385
ibuf_rec_get_counter(
 
386
/*=================*/
 
387
        const rec_t*    rec);   /*!< in: ibuf record */
 
388
/******************************************************************//**
 
389
Closes insert buffer and frees the data structures. */
 
390
UNIV_INTERN
 
391
void
 
392
ibuf_close(void);
 
393
/*============*/
359
394
 
360
395
#define IBUF_HEADER_PAGE_NO     FSP_IBUF_HEADER_PAGE_NO
361
396
#define IBUF_TREE_ROOT_PAGE_NO  FSP_IBUF_TREE_ROOT_PAGE_NO