53
36
#endif /* UNIV_SEARCH_DEBUG */
56
/*********************************************************//**
57
Gets pointer to the page frame where the cursor is positioned.
39
/*************************************************************
40
Gets pointer to the page frame where the cursor is positioned. */
63
page_cur_t* cur); /*!< in: page cursor */
64
/*********************************************************//**
65
Gets pointer to the buffer block where the cursor is positioned.
46
page_cur_t* cur); /* in: page cursor */
47
/*************************************************************
48
Gets pointer to the buffer block where the cursor is positioned. */
69
51
page_cur_get_block(
70
52
/*===============*/
71
page_cur_t* cur); /*!< in: page cursor */
72
/*********************************************************//**
73
Gets pointer to the page frame where the cursor is positioned.
54
page_cur_t* cur); /* in: page cursor */
55
/*************************************************************
56
Gets pointer to the page frame where the cursor is positioned. */
77
59
page_cur_get_page_zip(
78
60
/*==================*/
79
page_cur_t* cur); /*!< in: page cursor */
80
/*********************************************************//**
81
Gets the record where the cursor is positioned.
62
page_cur_t* cur); /* in: page cursor */
63
/*************************************************************
64
Gets the record where the cursor is positioned. */
87
page_cur_t* cur); /*!< in: page cursor */
70
page_cur_t* cur); /* in: page cursor */
88
71
#else /* UNIV_DEBUG */
89
72
# define page_cur_get_page(cur) page_align((cur)->rec)
90
73
# define page_cur_get_block(cur) (cur)->block
91
74
# define page_cur_get_page_zip(cur) buf_block_get_page_zip((cur)->block)
92
75
# define page_cur_get_rec(cur) (cur)->rec
93
76
#endif /* UNIV_DEBUG */
94
/*********************************************************//**
77
/*************************************************************
95
78
Sets the cursor object to point before the first user record
99
82
page_cur_set_before_first(
100
83
/*======================*/
101
const buf_block_t* block, /*!< in: index page */
102
page_cur_t* cur); /*!< in: cursor */
103
/*********************************************************//**
84
const buf_block_t* block, /* in: index page */
85
page_cur_t* cur); /* in: cursor */
86
/*************************************************************
104
87
Sets the cursor object to point after the last user record on
108
91
page_cur_set_after_last(
109
92
/*====================*/
110
const buf_block_t* block, /*!< in: index page */
111
page_cur_t* cur); /*!< in: cursor */
112
/*********************************************************//**
113
Returns TRUE if the cursor is before first user record on page.
114
@return TRUE if at start */
93
const buf_block_t* block, /* in: index page */
94
page_cur_t* cur); /* in: cursor */
95
/*************************************************************
96
Returns TRUE if the cursor is before first user record on page. */
117
99
page_cur_is_before_first(
118
100
/*=====================*/
119
const page_cur_t* cur); /*!< in: cursor */
120
/*********************************************************//**
121
Returns TRUE if the cursor is after last user record.
122
@return TRUE if at end */
101
/* out: TRUE if at start */
102
const page_cur_t* cur); /* in: cursor */
103
/*************************************************************
104
Returns TRUE if the cursor is after last user record. */
125
107
page_cur_is_after_last(
126
108
/*===================*/
127
const page_cur_t* cur); /*!< in: cursor */
128
/**********************************************************//**
109
/* out: TRUE if at end */
110
const page_cur_t* cur); /* in: cursor */
111
/**************************************************************
129
112
Positions the cursor on the given record. */
132
115
page_cur_position(
133
116
/*==============*/
134
const rec_t* rec, /*!< in: record on a page */
135
const buf_block_t* block, /*!< in: buffer block containing
117
const rec_t* rec, /* in: record on a page */
118
const buf_block_t* block, /* in: buffer block containing
137
page_cur_t* cur); /*!< out: page cursor */
138
/**********************************************************//**
120
page_cur_t* cur); /* out: page cursor */
121
/**************************************************************
139
122
Invalidates a page cursor by setting the record pointer NULL. */
142
125
page_cur_invalidate(
143
126
/*================*/
144
page_cur_t* cur); /*!< out: page cursor */
145
/**********************************************************//**
127
page_cur_t* cur); /* out: page cursor */
128
/**************************************************************
146
129
Moves the cursor to the next record on page. */
149
132
page_cur_move_to_next(
150
133
/*==================*/
151
page_cur_t* cur); /*!< in/out: cursor; must not be after last */
152
/**********************************************************//**
134
page_cur_t* cur); /* in/out: cursor; must not be after last */
135
/**************************************************************
153
136
Moves the cursor to the previous record on page. */
156
139
page_cur_move_to_prev(
157
140
/*==================*/
158
page_cur_t* cur); /*!< in/out: cursor; not before first */
159
#ifndef UNIV_HOTBACKUP
160
/***********************************************************//**
141
page_cur_t* cur); /* in/out: cursor; not before first */
142
/***************************************************************
161
143
Inserts a record next to page cursor. Returns pointer to inserted record if
162
144
succeed, i.e., enough space available, NULL otherwise. The cursor stays at
163
145
the same logical position, but the physical position may change if it is
164
pointing to a compressed page that was reorganized.
165
@return pointer to record if succeed, NULL otherwise */
146
pointing to a compressed page that was reorganized. */
168
149
page_cur_tuple_insert(
169
150
/*==================*/
170
page_cur_t* cursor, /*!< in/out: a page cursor */
171
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
172
dict_index_t* index, /*!< in: record descriptor */
173
ulint n_ext, /*!< in: number of externally stored columns */
174
mtr_t* mtr); /*!< in: mini-transaction handle, or NULL */
175
#endif /* !UNIV_HOTBACKUP */
176
/***********************************************************//**
151
/* out: pointer to record if succeed, NULL
153
page_cur_t* cursor, /* in/out: a page cursor */
154
const dtuple_t* tuple, /* in: pointer to a data tuple */
155
dict_index_t* index, /* in: record descriptor */
156
ulint n_ext, /* in: number of externally stored columns */
157
mtr_t* mtr); /* in: mini-transaction handle, or NULL */
158
/***************************************************************
177
159
Inserts a record next to page cursor. Returns pointer to inserted record if
178
160
succeed, i.e., enough space available, NULL otherwise. The cursor stays at
179
161
the same logical position, but the physical position may change if it is
180
pointing to a compressed page that was reorganized.
181
@return pointer to record if succeed, NULL otherwise */
162
pointing to a compressed page that was reorganized. */
184
165
page_cur_rec_insert(
185
166
/*================*/
186
page_cur_t* cursor, /*!< in/out: a page cursor */
187
const rec_t* rec, /*!< in: record to insert */
188
dict_index_t* index, /*!< in: record descriptor */
189
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
190
mtr_t* mtr); /*!< in: mini-transaction handle, or NULL */
191
/***********************************************************//**
167
/* out: pointer to record if succeed, NULL
169
page_cur_t* cursor, /* in/out: a page cursor */
170
const rec_t* rec, /* in: record to insert */
171
dict_index_t* index, /* in: record descriptor */
172
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
173
mtr_t* mtr); /* in: mini-transaction handle, or NULL */
174
/***************************************************************
192
175
Inserts a record next to page cursor on an uncompressed page.
193
176
Returns pointer to inserted record if succeed, i.e., enough
194
space available, NULL otherwise. The cursor stays at the same position.
195
@return pointer to record if succeed, NULL otherwise */
177
space available, NULL otherwise. The cursor stays at the same position. */
198
180
page_cur_insert_rec_low(
199
181
/*====================*/
200
rec_t* current_rec,/*!< in: pointer to current record after
182
/* out: pointer to record if succeed, NULL
184
rec_t* current_rec,/* in: pointer to current record after
201
185
which the new record is inserted */
202
dict_index_t* index, /*!< in: record descriptor */
203
const rec_t* rec, /*!< in: pointer to a physical record */
204
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
205
mtr_t* mtr); /*!< in: mini-transaction handle, or NULL */
206
/***********************************************************//**
186
dict_index_t* index, /* in: record descriptor */
187
const rec_t* rec, /* in: pointer to a physical record */
188
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
189
mtr_t* mtr); /* in: mini-transaction handle, or NULL */
190
/***************************************************************
207
191
Inserts a record next to page cursor on a compressed and uncompressed
208
192
page. Returns pointer to inserted record if succeed, i.e.,
209
193
enough space available, NULL otherwise.
210
The cursor stays at the same position.
211
@return pointer to record if succeed, NULL otherwise */
194
The cursor stays at the same position. */
214
197
page_cur_insert_rec_zip(
215
198
/*====================*/
216
rec_t** current_rec,/*!< in/out: pointer to current record after
199
/* out: pointer to record if succeed, NULL
201
rec_t** current_rec,/* in/out: pointer to current record after
217
202
which the new record is inserted */
218
buf_block_t* block, /*!< in: buffer block of *current_rec */
219
dict_index_t* index, /*!< in: record descriptor */
220
const rec_t* rec, /*!< in: pointer to a physical record */
221
ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
222
mtr_t* mtr); /*!< in: mini-transaction handle, or NULL */
223
/*************************************************************//**
203
buf_block_t* block, /* in: buffer block of *current_rec */
204
dict_index_t* index, /* in: record descriptor */
205
const rec_t* rec, /* in: pointer to a physical record */
206
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
207
mtr_t* mtr); /* in: mini-transaction handle, or NULL */
208
/*****************************************************************
224
209
Copies records from page to a newly created page, from a given record onward,
225
210
including that record. Infimum and supremum records are not copied. */
228
213
page_copy_rec_list_end_to_created_page(
229
214
/*===================================*/
230
page_t* new_page, /*!< in/out: index page to copy to */
231
rec_t* rec, /*!< in: first record to copy */
232
dict_index_t* index, /*!< in: record descriptor */
233
mtr_t* mtr); /*!< in: mtr */
234
/***********************************************************//**
215
page_t* new_page, /* in/out: index page to copy to */
216
rec_t* rec, /* in: first record to copy */
217
dict_index_t* index, /* in: record descriptor */
218
mtr_t* mtr); /* in: mtr */
219
/***************************************************************
235
220
Deletes a record at the page cursor. The cursor is moved to the
236
221
next record after the deleted one. */
239
224
page_cur_delete_rec(
240
225
/*================*/
241
page_cur_t* cursor, /*!< in/out: a page cursor */
242
dict_index_t* index, /*!< in: record descriptor */
243
const ulint* offsets,/*!< in: rec_get_offsets(cursor->rec, index) */
244
mtr_t* mtr); /*!< in: mini-transaction handle */
245
#ifndef UNIV_HOTBACKUP
246
/****************************************************************//**
247
Searches the right position for a page cursor.
248
@return number of matched fields on the left */
226
page_cur_t* cursor, /* in/out: a page cursor */
227
dict_index_t* index, /* in: record descriptor */
228
const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */
229
mtr_t* mtr); /* in: mini-transaction handle */
230
/********************************************************************
231
Searches the right position for a page cursor. */
253
const buf_block_t* block, /*!< in: buffer block */
254
const dict_index_t* index, /*!< in: record descriptor */
255
const dtuple_t* tuple, /*!< in: data tuple */
256
ulint mode, /*!< in: PAGE_CUR_L,
236
/* out: number of matched
237
fields on the left */
238
const buf_block_t* block, /* in: buffer block */
239
const dict_index_t* index, /* in: record descriptor */
240
const dtuple_t* tuple, /* in: data tuple */
241
ulint mode, /* in: PAGE_CUR_L,
257
242
PAGE_CUR_LE, PAGE_CUR_G, or
259
page_cur_t* cursor);/*!< out: page cursor */
260
/****************************************************************//**
244
page_cur_t* cursor);/* out: page cursor */
245
/********************************************************************
261
246
Searches the right position for a page cursor. */
264
249
page_cur_search_with_match(
265
250
/*=======================*/
266
const buf_block_t* block, /*!< in: buffer block */
267
const dict_index_t* index, /*!< in: record descriptor */
268
const dtuple_t* tuple, /*!< in: data tuple */
269
ulint mode, /*!< in: PAGE_CUR_L,
251
const buf_block_t* block, /* in: buffer block */
252
const dict_index_t* index, /* in: record descriptor */
253
const dtuple_t* tuple, /* in: data tuple */
254
ulint mode, /* in: PAGE_CUR_L,
270
255
PAGE_CUR_LE, PAGE_CUR_G, or
272
257
ulint* iup_matched_fields,
273
/*!< in/out: already matched
258
/* in/out: already matched
274
259
fields in upper limit record */
275
260
ulint* iup_matched_bytes,
276
/*!< in/out: already matched
261
/* in/out: already matched
277
262
bytes in a field not yet
278
263
completely matched */
279
264
ulint* ilow_matched_fields,
280
/*!< in/out: already matched
265
/* in/out: already matched
281
266
fields in lower limit record */
282
267
ulint* ilow_matched_bytes,
283
/*!< in/out: already matched
268
/* in/out: already matched
284
269
bytes in a field not yet
285
270
completely matched */
286
page_cur_t* cursor);/*!< out: page cursor */
287
/***********************************************************//**
271
page_cur_t* cursor);/* out: page cursor */
272
/***************************************************************
288
273
Positions a page cursor on a randomly chosen user record on a page. If there
289
274
are no user records, sets the cursor on the infimum record. */
292
277
page_cur_open_on_rnd_user_rec(
293
278
/*==========================*/
294
buf_block_t* block, /*!< in: page */
295
page_cur_t* cursor);/*!< out: page cursor */
296
#endif /* !UNIV_HOTBACKUP */
297
/***********************************************************//**
298
Parses a log record of a record insert on a page.
299
@return end of log record or NULL */
279
buf_block_t* block, /* in: page */
280
page_cur_t* cursor);/* out: page cursor */
281
/***************************************************************
282
Parses a log record of a record insert on a page. */
302
285
page_cur_parse_insert_rec(
303
286
/*======================*/
304
ibool is_short,/*!< in: TRUE if short inserts */
305
byte* ptr, /*!< in: buffer */
306
byte* end_ptr,/*!< in: buffer end */
307
buf_block_t* block, /*!< in: page or NULL */
308
dict_index_t* index, /*!< in: record descriptor */
309
mtr_t* mtr); /*!< in: mtr or NULL */
310
/**********************************************************//**
311
Parses a log record of copying a record list end to a new created page.
312
@return end of log record or NULL */
287
/* out: end of log record or NULL */
288
ibool is_short,/* in: TRUE if short inserts */
289
byte* ptr, /* in: buffer */
290
byte* end_ptr,/* in: buffer end */
291
buf_block_t* block, /* in: page or NULL */
292
dict_index_t* index, /* in: record descriptor */
293
mtr_t* mtr); /* in: mtr or NULL */
294
/**************************************************************
295
Parses a log record of copying a record list end to a new created page. */
315
298
page_parse_copy_rec_list_to_created_page(
316
299
/*=====================================*/
317
byte* ptr, /*!< in: buffer */
318
byte* end_ptr,/*!< in: buffer end */
319
buf_block_t* block, /*!< in: page or NULL */
320
dict_index_t* index, /*!< in: record descriptor */
321
mtr_t* mtr); /*!< in: mtr or NULL */
322
/***********************************************************//**
323
Parses log record of a record delete on a page.
324
@return pointer to record end or NULL */
300
/* out: end of log record or NULL */
301
byte* ptr, /* in: buffer */
302
byte* end_ptr,/* in: buffer end */
303
buf_block_t* block, /* in: page or NULL */
304
dict_index_t* index, /* in: record descriptor */
305
mtr_t* mtr); /* in: mtr or NULL */
306
/***************************************************************
307
Parses log record of a record delete on a page. */
327
310
page_cur_parse_delete_rec(
328
311
/*======================*/
329
byte* ptr, /*!< in: buffer */
330
byte* end_ptr,/*!< in: buffer end */
331
buf_block_t* block, /*!< in: page or NULL */
332
dict_index_t* index, /*!< in: record descriptor */
333
mtr_t* mtr); /*!< in: mtr or NULL */
312
/* out: pointer to record end or NULL */
313
byte* ptr, /* in: buffer */
314
byte* end_ptr,/* in: buffer end */
315
buf_block_t* block, /* in: page or NULL */
316
dict_index_t* index, /* in: record descriptor */
317
mtr_t* mtr); /* in: mtr or NULL */
335
/** Index page cursor */
319
/* Index page cursor */
337
321
struct page_cur_struct{
338
byte* rec; /*!< pointer to a record on page */
339
buf_block_t* block; /*!< pointer to the block containing rec */
322
byte* rec; /* pointer to a record on page */
323
buf_block_t* block; /* pointer to the block containing rec */
342
326
#ifndef UNIV_NONINL