182
173
page_update_max_trx_id(
183
174
/*===================*/
184
buf_block_t* block, /* in/out: page */
185
page_zip_des_t* page_zip,/* in/out: compressed page whose
186
uncompressed part will be updated, or NULL */
187
dulint trx_id);/* in: transaction id */
175
page_t* page, /* in: page */
176
dulint trx_id); /* in: transaction id */
188
177
/*****************************************************************
189
178
Reads the given header field. */
192
181
page_header_get_field(
193
182
/*==================*/
194
const page_t* page, /* in: page */
195
ulint field); /* in: PAGE_N_DIR_SLOTS, ... */
183
page_t* page, /* in: page */
184
ulint field); /* in: PAGE_N_DIR_SLOTS, ... */
196
185
/*****************************************************************
197
186
Sets the given header field. */
200
189
page_header_set_field(
201
190
/*==================*/
202
page_t* page, /* in/out: page */
203
page_zip_des_t* page_zip,/* in/out: compressed page whose
204
uncompressed part will be updated, or NULL */
205
ulint field, /* in: PAGE_N_DIR_SLOTS, ... */
206
ulint val); /* in: value */
191
page_t* page, /* in: page */
192
ulint field, /* in: PAGE_N_DIR_SLOTS, ... */
193
ulint val); /* in: value */
207
194
/*****************************************************************
208
Returns the offset stored in the given header field. */
195
Returns the pointer stored in the given header field. */
211
page_header_get_offs(
212
/*=================*/
213
/* out: offset from the start of the page,
215
const page_t* page, /* in: page */
216
ulint field) /* in: PAGE_FREE, ... */
217
__attribute__((nonnull, pure));
219
/*****************************************************************
220
Returns the pointer stored in the given header field, or NULL. */
221
#define page_header_get_ptr(page, field) \
222
(page_header_get_offs(page, field) \
223
? page + page_header_get_offs(page, field) : NULL)
200
/* out: pointer or NULL */
201
page_t* page, /* in: page */
202
ulint field); /* in: PAGE_FREE, ... */
224
203
/*****************************************************************
225
204
Sets the pointer stored in the given header field. */
228
207
page_header_set_ptr(
229
208
/*================*/
230
page_t* page, /* in/out: page */
231
page_zip_des_t* page_zip,/* in/out: compressed page whose
232
uncompressed part will be updated, or NULL */
233
ulint field, /* in/out: PAGE_FREE, ... */
234
const byte* ptr); /* in: pointer or NULL*/
209
page_t* page, /* in: page */
210
ulint field, /* in: PAGE_FREE, ... */
211
byte* ptr); /* in: pointer or NULL*/
235
212
/*****************************************************************
236
213
Resets the last insert info field in the page header. Writes to mlog
237
214
about this operation. */
295
270
matched; when function returns contains the
296
271
value for current comparison */
297
272
/*****************************************************************
298
Gets the page number. */
303
/* out: page number */
304
const page_t* page); /* in: page */
305
/*****************************************************************
306
Gets the tablespace identifier. */
312
const page_t* page); /* in: page */
313
/*****************************************************************
314
273
Gets the number of user records on page (the infimum and supremum records
315
274
are not user records). */
320
/* out: number of user records */
321
const page_t* page); /* in: index page */
279
/* out: number of user records */
280
page_t* page); /* in: index page */
322
281
/*******************************************************************
323
282
Returns the number of records before the given record in chain.
324
283
The number includes infimum and supremum records. */
327
286
page_rec_get_n_recs_before(
328
287
/*=======================*/
329
/* out: number of records */
330
const rec_t* rec); /* in: the physical record */
288
/* out: number of records */
289
rec_t* rec); /* in: the physical record */
331
290
/*****************************************************************
332
291
Gets the number of records in the heap. */
335
294
page_dir_get_n_heap(
336
295
/*================*/
337
/* out: number of user records */
338
const page_t* page); /* in: index page */
296
/* out: number of user records */
297
page_t* page); /* in: index page */
339
298
/*****************************************************************
340
299
Sets the number of records in the heap. */
343
302
page_dir_set_n_heap(
344
303
/*================*/
345
page_t* page, /* in/out: index page */
346
page_zip_des_t* page_zip,/* in/out: compressed page whose
347
uncompressed part will be updated, or NULL.
348
Note that the size of the dense page directory
349
in the compressed page trailer is
350
n_heap * PAGE_ZIP_DIR_SLOT_SIZE. */
351
ulint n_heap);/* in: number of records */
304
page_t* page, /* in: index page */
305
ulint n_heap);/* in: number of records */
352
306
/*****************************************************************
353
307
Gets the number of dir slots in directory. */
356
310
page_dir_get_n_slots(
357
311
/*=================*/
358
/* out: number of slots */
359
const page_t* page); /* in: index page */
312
/* out: number of slots */
313
page_t* page); /* in: index page */
360
314
/*****************************************************************
361
315
Sets the number of dir slots in directory. */
364
318
page_dir_set_n_slots(
365
319
/*=================*/
366
page_t* page, /* in/out: page */
367
page_zip_des_t* page_zip,/* in/out: compressed page whose
368
uncompressed part will be updated, or NULL */
369
ulint n_slots);/* in: number of slots */
320
/* out: number of slots */
321
page_t* page, /* in: index page */
322
ulint n_slots);/* in: number of slots */
371
323
/*****************************************************************
372
324
Gets pointer to nth directory slot. */
375
327
page_dir_get_nth_slot(
376
328
/*==================*/
377
/* out: pointer to dir slot */
378
const page_t* page, /* in: index page */
379
ulint n); /* in: position */
380
#else /* UNIV_DEBUG */
381
# define page_dir_get_nth_slot(page, n) \
382
((page) + UNIV_PAGE_SIZE - PAGE_DIR \
383
- (n + 1) * PAGE_DIR_SLOT_SIZE)
384
#endif /* UNIV_DEBUG */
329
/* out: pointer to dir slot */
330
page_t* page, /* in: index page */
331
ulint n); /* in: position */
385
332
/******************************************************************
386
333
Used to check the consistency of a record on a page. */
391
/* out: TRUE if succeed */
392
const rec_t* rec); /* in: record */
338
/* out: TRUE if succeed */
339
rec_t* rec); /* in: record */
393
340
/*******************************************************************
394
341
Gets the record pointed to by a directory slot. */
397
344
page_dir_slot_get_rec(
398
345
/*==================*/
399
346
/* out: pointer to record */
400
const page_dir_slot_t* slot); /* in: directory slot */
347
page_dir_slot_t* slot); /* in: directory slot */
401
348
/*******************************************************************
402
349
This is used to set the record offset in a directory slot. */
653
548
page_get_data_size(
654
549
/*===============*/
655
/* out: data in bytes */
656
const page_t* page); /* in: index page */
657
/****************************************************************
658
Allocates a block of memory from the head of the free list
664
page_t* page, /* in/out: index page */
665
page_zip_des_t* page_zip,/* in/out: compressed page with enough
666
space available for inserting the record,
668
rec_t* next_rec,/* in: pointer to the new head of the
670
ulint need); /* in: number of bytes allocated */
671
/****************************************************************
672
Allocates a block of memory from the heap of an index page. */
550
/* out: data in bytes */
551
page_t* page); /* in: index page */
552
/****************************************************************
553
Allocates a block of memory from an index page. */
677
558
/* out: pointer to start of allocated
678
559
buffer, or NULL if allocation fails */
679
page_t* page, /* in/out: index page */
680
page_zip_des_t* page_zip,/* in/out: compressed page with enough
681
space available for inserting the record,
683
ulint need, /* in: total number of bytes needed */
560
page_t* page, /* in: index page */
561
ulint need, /* in: number of bytes needed */
562
dict_index_t* index, /* in: record descriptor */
684
563
ulint* heap_no);/* out: this contains the heap number
685
564
of the allocated record
686
565
if allocation succeeds */
693
page_t* page, /* in/out: index page */
694
page_zip_des_t* page_zip,/* in/out: compressed page with at least
695
6 bytes available, or NULL */
572
page_t* page, /* in: index page */
696
573
rec_t* rec, /* in: pointer to the (origin of) record */
697
dict_index_t* index, /* in: index of rec */
698
574
const ulint* offsets);/* in: array returned by rec_get_offsets() */
699
575
/**************************************************************
700
Create an uncompressed B-tree index page. */
576
The index page creation function. */
705
581
/* out: pointer to the page */
706
buf_block_t* block, /* in: a buffer block where the
582
buf_frame_t* frame, /* in: a buffer frame where the page is
708
584
mtr_t* mtr, /* in: mini-transaction handle */
709
585
ulint comp); /* in: nonzero=compact page format */
710
/**************************************************************
711
Create a compressed B-tree index page. */
716
/* out: pointer to the page */
717
buf_block_t* block, /* in/out: a buffer frame where the
719
dict_index_t* index, /* in: the index of the page */
720
ulint level, /* in: the B-tree level of the page */
721
mtr_t* mtr); /* in: mini-transaction handle */
723
586
/*****************************************************************
724
587
Differs from page_copy_rec_list_end, because this function does not
725
touch the lock table and max trx id on page or compress the page. */
588
touch the lock table and max trx id on page. */
728
591
page_copy_rec_list_end_no_locks(
729
592
/*============================*/
730
buf_block_t* new_block, /* in: index page to copy to */
731
buf_block_t* block, /* in: index page of rec */
593
page_t* new_page, /* in: index page to copy to */
594
page_t* page, /* in: index page */
732
595
rec_t* rec, /* in: record on page */
733
596
dict_index_t* index, /* in: record descriptor */
734
597
mtr_t* mtr); /* in: mtr */
736
599
Copies records from page to new_page, from the given record onward,
737
600
including that record. Infimum and supremum records are not copied.
738
601
The records are copied to the start of the record list on new_page. */
741
604
page_copy_rec_list_end(
742
605
/*===================*/
743
/* out: pointer to the original
744
successor of the infimum record
745
on new_page, or NULL on zip overflow
746
(new_block will be decompressed) */
747
buf_block_t* new_block, /* in/out: index page to copy to */
748
buf_block_t* block, /* in: index page containing rec */
606
page_t* new_page, /* in: index page to copy to */
607
page_t* page, /* in: index page */
749
608
rec_t* rec, /* in: record on page */
750
609
dict_index_t* index, /* in: record descriptor */
751
mtr_t* mtr) /* in: mtr */
752
__attribute__((nonnull));
610
mtr_t* mtr); /* in: mtr */
753
611
/*****************************************************************
754
612
Copies records from page to new_page, up to the given record, NOT
755
613
including that record. Infimum and supremum records are not copied.
756
614
The records are copied to the end of the record list on new_page. */
759
617
page_copy_rec_list_start(
760
618
/*=====================*/
761
/* out: pointer to the original
762
predecessor of the supremum record
763
on new_page, or NULL on zip overflow
764
(new_block will be decompressed) */
765
buf_block_t* new_block, /* in/out: index page to copy to */
766
buf_block_t* block, /* in: index page containing rec */
619
page_t* new_page, /* in: index page to copy to */
620
page_t* page, /* in: index page */
767
621
rec_t* rec, /* in: record on page */
768
622
dict_index_t* index, /* in: record descriptor */
769
mtr_t* mtr) /* in: mtr */
770
__attribute__((nonnull));
623
mtr_t* mtr); /* in: mtr */
771
624
/*****************************************************************
772
625
Deletes records from a page from a given record onward, including that record.
773
626
The infimum and supremum records are not deleted. */
776
629
page_delete_rec_list_end(
777
630
/*=====================*/
778
rec_t* rec, /* in: pointer to record on page */
779
buf_block_t* block, /* in: buffer block of the page */
631
page_t* page, /* in: index page */
632
rec_t* rec, /* in: record on page */
780
633
dict_index_t* index, /* in: record descriptor */
781
634
ulint n_recs, /* in: number of records to delete,
782
635
or ULINT_UNDEFINED if not known */
783
636
ulint size, /* in: the sum of the sizes of the
784
637
records in the end of the chain to
785
638
delete, or ULINT_UNDEFINED if not known */
786
mtr_t* mtr) /* in: mtr */
787
__attribute__((nonnull));
639
mtr_t* mtr); /* in: mtr */
788
640
/*****************************************************************
789
641
Deletes records from page, up to the given record, NOT including
790
642
that record. Infimum and supremum records are not deleted. */
793
645
page_delete_rec_list_start(
794
646
/*=======================*/
647
page_t* page, /* in: index page */
795
648
rec_t* rec, /* in: record on page */
796
buf_block_t* block, /* in: buffer block of the page */
797
649
dict_index_t* index, /* in: record descriptor */
798
mtr_t* mtr) /* in: mtr */
799
__attribute__((nonnull));
650
mtr_t* mtr); /* in: mtr */
800
651
/*****************************************************************
801
652
Moves record list end to another page. Moved records include
805
656
page_move_rec_list_end(
806
657
/*===================*/
807
/* out: TRUE on success; FALSE on
809
(new_block will be decompressed) */
810
buf_block_t* new_block, /* in/out: index page where to move */
811
buf_block_t* block, /* in: index page from where to move */
658
page_t* new_page, /* in: index page where to move */
659
page_t* page, /* in: index page */
812
660
rec_t* split_rec, /* in: first record to move */
813
661
dict_index_t* index, /* in: record descriptor */
814
mtr_t* mtr) /* in: mtr */
815
__attribute__((nonnull(1, 2, 4, 5)));
662
mtr_t* mtr); /* in: mtr */
816
663
/*****************************************************************
817
664
Moves record list start to another page. Moved records do not include
821
668
page_move_rec_list_start(
822
669
/*=====================*/
823
/* out: TRUE on success; FALSE on
824
compression failure */
825
buf_block_t* new_block, /* in/out: index page where to move */
826
buf_block_t* block, /* in/out: page containing split_rec */
670
page_t* new_page, /* in: index page where to move */
671
page_t* page, /* in: index page */
827
672
rec_t* split_rec, /* in: first record not to move */
828
673
dict_index_t* index, /* in: record descriptor */
829
mtr_t* mtr) /* in: mtr */
830
__attribute__((nonnull(1, 2, 4, 5)));
674
mtr_t* mtr); /* in: mtr */
831
675
/********************************************************************
832
676
Splits a directory slot which owns too many records. */
835
679
page_dir_split_slot(
836
680
/*================*/
837
page_t* page, /* in: index page */
838
page_zip_des_t* page_zip,/* in/out: compressed page whose
839
uncompressed part will be written, or NULL */
840
ulint slot_no)/* in: the directory slot */
841
__attribute__((nonnull(1)));
681
page_t* page, /* in: the index page in question */
682
ulint slot_no); /* in: the directory slot */
842
683
/*****************************************************************
843
684
Tries to balance the given directory slot with too few records
844
685
with the upper neighbor, so that there are at least the minimum number
845
686
of records owned by the slot; this may result in the merging of
849
690
page_dir_balance_slot(
850
691
/*==================*/
851
page_t* page, /* in/out: index page */
852
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
853
ulint slot_no)/* in: the directory slot */
854
__attribute__((nonnull(1)));
692
page_t* page, /* in: index page */
693
ulint slot_no); /* in: the directory slot */
855
694
/**************************************************************
856
695
Parses a log record of a record list end or start deletion. */
859
698
page_parse_delete_rec_list(
860
699
/*=======================*/
865
704
MLOG_COMP_LIST_START_DELETE */
866
705
byte* ptr, /* in: buffer */
867
706
byte* end_ptr,/* in: buffer end */
868
buf_block_t* block, /* in/out: buffer block or NULL */
869
707
dict_index_t* index, /* in: record descriptor */
708
page_t* page, /* in: page or NULL */
870
709
mtr_t* mtr); /* in: mtr or NULL */
871
710
/***************************************************************
872
711
Parses a redo log record of creating a page. */
875
714
page_parse_create(
876
715
/*==============*/
877
/* out: end of log record or NULL */
878
byte* ptr, /* in: buffer */
879
byte* end_ptr,/* in: buffer end */
880
ulint comp, /* in: nonzero=compact page format */
881
buf_block_t* block, /* in: block or NULL */
882
mtr_t* mtr); /* in: mtr or NULL */
716
/* out: end of log record or NULL */
717
byte* ptr, /* in: buffer */
718
byte* end_ptr,/* in: buffer end */
719
ulint comp, /* in: nonzero=compact page format */
720
page_t* page, /* in: page or NULL */
721
mtr_t* mtr); /* in: mtr or NULL */
883
722
/****************************************************************
884
723
Prints record contents including the data relevant only in
885
724
the index page context. */
890
const rec_t* rec, /* in: physical record */
729
rec_t* rec, /* in: physical record */
891
730
const ulint* offsets);/* in: record descriptor */
892
731
/*******************************************************************
893
732
This is used to print the contents of the directory for
894
733
debugging purposes. */
943
782
Checks that the first directory slot points to the infimum record and
944
783
the last to the supremum. This function is intended to track if the
945
784
bug fixed in 4.0.14 has caused corruption to users' databases. */
950
const page_t* page); /* in: index page */
951
/*******************************************************************
952
This function checks the consistency of an index page when we do not
953
know the index. This is also resilient so that this should never crash
954
even if the page is total garbage. */
957
page_simple_validate_old(
958
/*=====================*/
959
/* out: TRUE if ok */
960
page_t* page); /* in: old-style index page */
961
/*******************************************************************
962
This function checks the consistency of an index page when we do not
963
know the index. This is also resilient so that this should never crash
964
even if the page is total garbage. */
967
page_simple_validate_new(
968
/*=====================*/
969
/* out: TRUE if ok */
970
page_t* block); /* in: new-style index page */
789
page_t* page); /* in: index page */
790
/*******************************************************************
791
This function checks the consistency of an index page when we do not
792
know the index. This is also resilient so that this should never crash
793
even if the page is total garbage. */
796
page_simple_validate(
797
/*=================*/
798
/* out: TRUE if ok */
799
page_t* page); /* in: index page */
971
800
/*******************************************************************
972
801
This function checks the consistency of an index page. */