35
35
/**********************************************************************
36
36
Creates the insert buffer data structure at a database startup and
37
37
initializes the data structures for the insert buffer of each tablespace. */
40
40
ibuf_init_at_db_start(void);
41
41
/*=======================*/
42
42
/*************************************************************************
43
43
Reads the biggest tablespace id from the high end of the insert buffer
44
44
tree and updates the counter in fil_system. */
47
47
ibuf_update_max_tablespace_id(void);
48
48
/*===============================*/
49
49
/*************************************************************************
50
50
Initializes an ibuf bitmap page. */
53
53
ibuf_bitmap_page_init(
54
54
/*==================*/
55
page_t* page, /* in: bitmap page */
56
mtr_t* mtr); /* in: mtr */
55
buf_block_t* block, /* in: bitmap page */
56
mtr_t* mtr); /* in: mtr */
57
57
/****************************************************************************
58
58
Resets the free bits of the page in the ibuf bitmap. This is done in a
59
59
separate mini-transaction, hence this operation does not restrict further
60
60
work to only ibuf bitmap operations, which would result if the latch to the
61
61
bitmap page were kept. */
64
ibuf_reset_free_bits_with_type(
65
/*===========================*/
66
ulint type, /* in: index type */
67
page_t* page); /* in: index page; free bits are set to 0 if the index
68
is non-clustered and non-unique and the page level is
70
/****************************************************************************
71
Resets the free bits of the page in the ibuf bitmap. This is done in a
72
separate mini-transaction, hence this operation does not restrict further
73
work to solely ibuf bitmap operations, which would result if the latch to
74
the bitmap page were kept. */
77
64
ibuf_reset_free_bits(
78
65
/*=================*/
79
dict_index_t* index, /* in: index */
80
page_t* page); /* in: index page; free bits are set to 0 if
81
the index is non-clustered and non-unique and
82
the page level is 0 */
66
buf_block_t* block); /* in: index page; free bits are set to 0
67
if the index is a non-clustered
68
non-unique, and page level is 0 */
83
69
/****************************************************************************
84
Updates the free bits of the page in the ibuf bitmap if there is not enough
85
free on the page any more. This is done in a separate mini-transaction, hence
86
this operation does not restrict further work to only ibuf bitmap operations,
87
which would result if the latch to the bitmap page were kept. */
70
Updates the free bits of an uncompressed page in the ibuf bitmap if
71
there is not enough free on the page any more. This is done in a
72
separate mini-transaction, hence this operation does not restrict
73
further work to only ibuf bitmap operations, which would result if the
74
latch to the bitmap page were kept. */
90
77
ibuf_update_free_bits_if_full(
91
78
/*==========================*/
92
dict_index_t* index, /* in: index */
93
page_t* page, /* in: index page to which we have added new
79
buf_block_t* block, /* in: index page to which we have added new
94
80
records; the free bits are updated if the
95
81
index is non-clustered and non-unique and
96
82
the page level is 0, and the page becomes
102
88
used in the latest operation, if known, or
103
89
ULINT_UNDEFINED */
104
90
/**************************************************************************
105
Updates the free bits for the page to reflect the present state. Does this
106
in the mtr given, which means that the latching order rules virtually
91
Updates the free bits for an uncompressed page to reflect the present state.
92
Does this in the mtr given, which means that the latching order rules virtually
107
93
prevent any further operations for this OS thread until mtr is committed. */
110
96
ibuf_update_free_bits_low(
111
97
/*======================*/
112
dict_index_t* index, /* in: index */
113
page_t* page, /* in: index page */
114
ulint max_ins_size, /* in: value of maximum insert size
115
with reorganize before the latest
116
operation performed to the page */
117
mtr_t* mtr); /* in: mtr */
98
const buf_block_t* block, /* in: index page */
99
ulint max_ins_size, /* in: value of
101
with reorganize before
103
performed to the page */
104
mtr_t* mtr); /* in/out: mtr */
105
/**************************************************************************
106
Updates the free bits for a compressed page to reflect the present state.
107
Does this in the mtr given, which means that the latching order rules virtually
108
prevent any further operations for this OS thread until mtr is committed. */
111
ibuf_update_free_bits_zip(
112
/*======================*/
113
buf_block_t* block, /* in/out: index page */
114
mtr_t* mtr); /* in/out: mtr */
118
115
/**************************************************************************
119
116
Updates the free bits for the two pages to reflect the present state. Does
120
117
this in the mtr given, which means that the latching order rules virtually
121
118
prevent any further operations until mtr is committed. */
124
121
ibuf_update_free_bits_for_two_pages_low(
125
122
/*====================================*/
126
dict_index_t* index, /* in: index */
127
page_t* page1, /* in: index page */
128
page_t* page2, /* in: index page */
123
ulint zip_size,/* in: compressed page size in bytes;
124
0 for uncompressed pages */
125
buf_block_t* block1, /* in: index page */
126
buf_block_t* block2, /* in: index page */
129
127
mtr_t* mtr); /* in: mtr */
130
128
/**************************************************************************
131
129
A basic partial test if an insert to the insert buffer could be possible and
155
153
ibuf_bitmap_page(
156
154
/*=============*/
157
155
/* out: TRUE if a bitmap page */
156
ulint zip_size,/* in: compressed page size in bytes;
157
0 for uncompressed pages */
158
158
ulint page_no);/* in: page number */
159
159
/***************************************************************************
160
160
Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. */
165
165
/* out: TRUE if level 2 or level 3 page */
166
166
ulint space, /* in: space id */
167
ulint zip_size,/* in: compressed page size in bytes, or 0 */
167
168
ulint page_no);/* in: page number */
168
169
/***************************************************************************
169
170
Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. */
174
175
/* out: TRUE if level 2 or level 3 page */
175
176
ulint space, /* in: space id */
177
ulint zip_size,/* in: compressed page size in bytes, or 0 */
176
178
ulint page_no,/* in: page number */
177
179
mtr_t* mtr); /* in: mtr which will contain an x-latch to the
178
180
bitmap page if the page is not one of the fixed
181
183
Frees excess pages from the ibuf free list. This function is called when an OS
182
184
thread calls fsp services to allocate a new file segment, or a new page to a
183
185
file segment, and the thread did not own the fsp latch before this call. */
186
188
ibuf_free_excess_pages(
187
189
/*===================*/
188
ulint space); /* in: space id */
190
ulint space); /* in: space id */
189
191
/*************************************************************************
190
192
Makes an index insert to the insert buffer, instead of directly to the disk
191
193
page, if this is possible. Does not do insert if the index is clustered
197
199
/* out: TRUE if success */
198
dtuple_t* entry, /* in: index entry to insert */
200
const dtuple_t* entry, /* in: index entry to insert */
199
201
dict_index_t* index, /* in: index where to insert */
200
202
ulint space, /* in: space id where to insert */
203
ulint zip_size,/* in: compressed page size in bytes, or 0 */
201
204
ulint page_no,/* in: page number where to insert */
202
205
que_thr_t* thr); /* in: query thread */
203
206
/*************************************************************************
207
210
created in the buffer pool, this function deletes its buffered entries from
208
211
the insert buffer; there can exist entries for such a page if the page
209
212
belonged to an index which subsequently was dropped. */
212
215
ibuf_merge_or_delete_for_page(
213
216
/*==========================*/
214
page_t* page, /* in: if page has been read from disk, pointer to
215
the page x-latched, else NULL */
216
ulint space, /* in: space id of the index page */
217
ulint page_no,/* in: page number of the index page */
218
ibool update_ibuf_bitmap);/* in: normally this is set to TRUE, but if
219
we have deleted or are deleting the tablespace, then we
220
naturally do not want to update a non-existent bitmap
217
buf_block_t* block, /* in: if page has been read from
218
disk, pointer to the page x-latched,
220
ulint space, /* in: space id of the index page */
221
ulint page_no,/* in: page number of the index page */
222
ulint zip_size,/* in: compressed page size in bytes,
224
ibool update_ibuf_bitmap);/* in: normally this is set
225
to TRUE, but if we have deleted or are
226
deleting the tablespace, then we
227
naturally do not want to update a
228
non-existent bitmap page */
222
229
/*************************************************************************
223
230
Deletes all entries in the insert buffer for a given space id. This is used
224
231
in DISCARD TABLESPACE and IMPORT TABLESPACE.
225
232
NOTE: this does not update the page free bitmaps in the space. The space will
226
233
become CORRUPT when you call this function! */
229
236
ibuf_delete_for_discarded_space(
230
237
/*============================*/
231
238
ulint space); /* in: space id */
232
239
/*************************************************************************
233
240
Contracts insert buffer trees by reading pages to the buffer pool. */
259
266
/*************************************************************************
260
267
Parses a redo log record of an ibuf bitmap page init. */
263
270
ibuf_parse_bitmap_init(
264
271
/*===================*/
265
/* out: end of log record or NULL */
266
byte* ptr, /* in: buffer */
267
byte* end_ptr,/* in: buffer end */
268
page_t* page, /* in: page or NULL */
269
mtr_t* mtr); /* in: mtr or NULL */
270
#ifdef UNIV_IBUF_DEBUG
272
/* out: end of log record or NULL */
273
byte* ptr, /* in: buffer */
274
byte* end_ptr,/* in: buffer end */
275
buf_block_t* block, /* in: block or NULL */
276
mtr_t* mtr); /* in: mtr or NULL */
277
#ifdef UNIV_IBUF_COUNT_DEBUG
271
278
/**********************************************************************
272
279
Gets the ibuf count for a given page. */