diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index f0818b7586d..6c11c973fc9 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -150,7 +150,7 @@ UNIV_INLINE ulint btr_pcur_get_up_match( /*==================*/ - btr_pcur_t* cursor); /*!< in: memory buffer for persistent cursor */ + const btr_pcur_t* cursor); /*!< in: persistent cursor */ /**************************************************************//** Gets the low_match value for a pcur after a search. @return number of matched fields at the cursor or to the right if @@ -159,7 +159,7 @@ UNIV_INLINE ulint btr_pcur_get_low_match( /*===================*/ - btr_pcur_t* cursor); /*!< in: memory buffer for persistent cursor */ + const btr_pcur_t* cursor); /*!< in: persistent cursor */ /**************************************************************//** If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first user record satisfying the search condition, in the case PAGE_CUR_L or @@ -371,10 +371,6 @@ page_cur_t* btr_pcur_get_page_cur( /*==================*/ const btr_pcur_t* cursor); /*!< in: persistent cursor */ -#else /* UNIV_DEBUG */ -# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur) -# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur) -#endif /* UNIV_DEBUG */ /*********************************************************//** Returns the page of a persistent cursor. @return pointer to the page */ @@ -382,7 +378,7 @@ UNIV_INLINE page_t* btr_pcur_get_page( /*==============*/ - btr_pcur_t* cursor);/*!< in: persistent cursor */ + const btr_pcur_t* cursor);/*!< in: persistent cursor */ /*********************************************************//** Returns the buffer block of a persistent cursor. @return pointer to the block */ @@ -390,7 +386,7 @@ UNIV_INLINE buf_block_t* btr_pcur_get_block( /*===============*/ - btr_pcur_t* cursor);/*!< in: persistent cursor */ + const btr_pcur_t* cursor);/*!< in: persistent cursor */ /*********************************************************//** Returns the record of a persistent cursor. @return pointer to the record */ @@ -398,7 +394,14 @@ UNIV_INLINE rec_t* btr_pcur_get_rec( /*=============*/ - btr_pcur_t* cursor);/*!< in: persistent cursor */ + const btr_pcur_t* cursor);/*!< in: persistent cursor */ +#else /* UNIV_DEBUG */ +# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur) +# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur) +# define btr_pcur_get_page(cursor) ((cursor)->btr_cur.page_cur.block->frame) +# define btr_pcur_get_block(cursor) ((cursor)->btr_cur.page_cur.block) +# define btr_pcur_get_rec(cursor) ((cursor)->btr_cur.page_cur.rec) +#endif /* UNIV_DEBUG */ /*********************************************************//** Checks if the persistent cursor is on a user record. */ UNIV_INLINE diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index 35164576f62..59fdb21824b 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -67,7 +67,7 @@ btr_pcur_get_page_cur( { return(btr_cur_get_page_cur(btr_pcur_get_btr_cur(cursor))); } -#endif /* UNIV_DEBUG */ + /*********************************************************//** Returns the page of a persistent cursor. @return pointer to the page */ @@ -75,7 +75,7 @@ UNIV_INLINE page_t* btr_pcur_get_page( /*==============*/ - btr_pcur_t* cursor) /*!< in: persistent cursor */ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); @@ -89,7 +89,7 @@ UNIV_INLINE buf_block_t* btr_pcur_get_block( /*===============*/ - btr_pcur_t* cursor) /*!< in: persistent cursor */ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); @@ -103,13 +103,14 @@ UNIV_INLINE rec_t* btr_pcur_get_rec( /*=============*/ - btr_pcur_t* cursor) /*!< in: persistent cursor */ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ { ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(cursor->latch_mode != BTR_NO_LATCHES); return(btr_cur_get_rec(btr_pcur_get_btr_cur(cursor))); } +#endif /* UNIV_DEBUG */ /**************************************************************//** Gets the up_match value for a pcur after a search. @@ -119,9 +120,9 @@ UNIV_INLINE ulint btr_pcur_get_up_match( /*==================*/ - btr_pcur_t* cursor) /*!< in: memory buffer for persistent cursor */ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ { - btr_cur_t* btr_cursor; + const btr_cur_t* btr_cursor; ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED) || (cursor->pos_state == BTR_PCUR_IS_POSITIONED)); @@ -141,9 +142,9 @@ UNIV_INLINE ulint btr_pcur_get_low_match( /*===================*/ - btr_pcur_t* cursor) /*!< in: memory buffer for persistent cursor */ + const btr_pcur_t* cursor) /*!< in: persistent cursor */ { - btr_cur_t* btr_cursor; + const btr_cur_t* btr_cursor; ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED) || (cursor->pos_state == BTR_PCUR_IS_POSITIONED)); diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 826fd13125d..0a15dfbf2a1 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -952,7 +952,7 @@ UNIV_INTERN ibool page_rec_validate( /*==============*/ - rec_t* rec, /*!< in: physical record */ + const rec_t* rec, /*!< in: physical record */ const ulint* offsets);/*!< in: array returned by rec_get_offsets() */ /***************************************************************//** Checks that the first directory slot points to the infimum record and @@ -972,7 +972,7 @@ UNIV_INTERN ibool page_simple_validate_old( /*=====================*/ - page_t* page); /*!< in: old-style index page */ + const page_t* page); /*!< in: index page in ROW_FORMAT=REDUNDANT */ /***************************************************************//** This function checks the consistency of an index page when we do not know the index. This is also resilient so that this should never crash @@ -982,7 +982,7 @@ UNIV_INTERN ibool page_simple_validate_new( /*=====================*/ - page_t* block); /*!< in: new-style index page */ + const page_t* page); /*!< in: index page in ROW_FORMAT!=REDUNDANT */ /***************************************************************//** This function checks the consistency of an index page. @return TRUE if ok */ @@ -990,7 +990,7 @@ UNIV_INTERN ibool page_validate( /*==========*/ - page_t* page, /*!< in: index page */ + const page_t* page, /*!< in: index page */ dict_index_t* index); /*!< in: data dictionary index containing the page record type definition */ /***************************************************************//** diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 9ffb5c7d9e5..3d157f1da95 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -600,6 +600,7 @@ ulint rec_offs_size( /*==========*/ const ulint* offsets);/*!< in: array returned by rec_get_offsets() */ +#ifdef UNIV_DEBUG /**********************************************************//** Returns a pointer to the start of the record. @return pointer to start */ @@ -607,7 +608,7 @@ UNIV_INLINE byte* rec_get_start( /*==========*/ - rec_t* rec, /*!< in: pointer to record */ + const rec_t* rec, /*!< in: pointer to record */ const ulint* offsets);/*!< in: array returned by rec_get_offsets() */ /**********************************************************//** Returns a pointer to the end of the record. @@ -616,8 +617,12 @@ UNIV_INLINE byte* rec_get_end( /*========*/ - rec_t* rec, /*!< in: pointer to record */ + const rec_t* rec, /*!< in: pointer to record */ const ulint* offsets);/*!< in: array returned by rec_get_offsets() */ +#else /* UNIV_DEBUG */ +# define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets)) +# define rec_get_end(rec, offsets) ((rec) + rec_offs_data_size(offsets)) +#endif /* UNIV_DEBUG */ /***************************************************************//** Copies a physical record to a buffer. @return pointer to the origin of the copy */ diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic index ba306eaf27f..3d386710d7d 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.ic @@ -1462,6 +1462,7 @@ rec_offs_size( return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets)); } +#ifdef UNIV_DEBUG /**********************************************************//** Returns a pointer to the end of the record. @return pointer to end */ @@ -1469,11 +1470,11 @@ UNIV_INLINE byte* rec_get_end( /*========*/ - rec_t* rec, /*!< in: pointer to record */ + const rec_t* rec, /*!< in: pointer to record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); - return(rec + rec_offs_data_size(offsets)); + return((rec_t*) rec + rec_offs_data_size(offsets)); } /**********************************************************//** @@ -1483,12 +1484,13 @@ UNIV_INLINE byte* rec_get_start( /*==========*/ - rec_t* rec, /*!< in: pointer to record */ + const rec_t* rec, /*!< in: pointer to record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); - return(rec - rec_offs_extra_size(offsets)); + return((rec_t*) rec - rec_offs_extra_size(offsets)); } +#endif /* UNIV_DEBUG */ /***************************************************************//** Copies a physical record to a buffer. diff --git a/storage/innobase/page/page0page.c b/storage/innobase/page/page0page.c index 99182e85849..964d0e2abef 100644 --- a/storage/innobase/page/page0page.c +++ b/storage/innobase/page/page0page.c @@ -166,11 +166,11 @@ static ibool page_dir_slot_check( /*================*/ - page_dir_slot_t* slot) /*!< in: slot */ + const page_dir_slot_t* slot) /*!< in: slot */ { - page_t* page; - ulint n_slots; - ulint n_owned; + const page_t* page; + ulint n_slots; + ulint n_owned; ut_a(slot); @@ -1803,12 +1803,12 @@ UNIV_INTERN ibool page_rec_validate( /*==============*/ - rec_t* rec, /*!< in: physical record */ + const rec_t* rec, /*!< in: physical record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { - ulint n_owned; - ulint heap_no; - page_t* page; + ulint n_owned; + ulint heap_no; + const page_t* page; page = page_align(rec); ut_a(!page_is_comp(page) == !rec_offs_comp(offsets)); @@ -1889,16 +1889,16 @@ UNIV_INTERN ibool page_simple_validate_old( /*=====================*/ - page_t* page) /*!< in: old-style index page */ + const page_t* page) /*!< in: index page in ROW_FORMAT=REDUNDANT */ { - page_dir_slot_t* slot; - ulint slot_no; - ulint n_slots; - rec_t* rec; - byte* rec_heap_top; - ulint count; - ulint own_count; - ibool ret = FALSE; + const page_dir_slot_t* slot; + ulint slot_no; + ulint n_slots; + const rec_t* rec; + const byte* rec_heap_top; + ulint count; + ulint own_count; + ibool ret = FALSE; ut_a(!page_is_comp(page)); @@ -2011,7 +2011,7 @@ page_simple_validate_old( goto func_exit; } - rec = page_rec_get_next(rec); + rec = page_rec_get_next_const(rec); own_count++; } @@ -2072,7 +2072,7 @@ page_simple_validate_old( goto func_exit; } - rec = page_rec_get_next(rec); + rec = page_rec_get_next_const(rec); } if (UNIV_UNLIKELY(page_dir_get_n_heap(page) != count + 1)) { @@ -2099,16 +2099,16 @@ UNIV_INTERN ibool page_simple_validate_new( /*=====================*/ - page_t* page) /*!< in: new-style index page */ + const page_t* page) /*!< in: index page in ROW_FORMAT!=REDUNDANT */ { - page_dir_slot_t* slot; - ulint slot_no; - ulint n_slots; - rec_t* rec; - byte* rec_heap_top; - ulint count; - ulint own_count; - ibool ret = FALSE; + const page_dir_slot_t* slot; + ulint slot_no; + ulint n_slots; + const rec_t* rec; + const byte* rec_heap_top; + ulint count; + ulint own_count; + ibool ret = FALSE; ut_a(page_is_comp(page)); @@ -2221,7 +2221,7 @@ page_simple_validate_new( goto func_exit; } - rec = page_rec_get_next(rec); + rec = page_rec_get_next_const(rec); own_count++; } @@ -2283,7 +2283,7 @@ page_simple_validate_new( goto func_exit; } - rec = page_rec_get_next(rec); + rec = page_rec_get_next_const(rec); } if (UNIV_UNLIKELY(page_dir_get_n_heap(page) != count + 1)) { @@ -2308,26 +2308,26 @@ UNIV_INTERN ibool page_validate( /*==========*/ - page_t* page, /*!< in: index page */ + const page_t* page, /*!< in: index page */ dict_index_t* index) /*!< in: data dictionary index containing the page record type definition */ { - page_dir_slot_t*slot; - mem_heap_t* heap; - byte* buf; - ulint count; - ulint own_count; - ulint rec_own_count; - ulint slot_no; - ulint data_size; - rec_t* rec; - rec_t* old_rec = NULL; - ulint offs; - ulint n_slots; - ibool ret = FALSE; - ulint i; - ulint* offsets = NULL; - ulint* old_offsets = NULL; + const page_dir_slot_t* slot; + mem_heap_t* heap; + byte* buf; + ulint count; + ulint own_count; + ulint rec_own_count; + ulint slot_no; + ulint data_size; + const rec_t* rec; + const rec_t* old_rec = NULL; + ulint offs; + ulint n_slots; + ibool ret = FALSE; + ulint i; + ulint* offsets = NULL; + ulint* old_offsets = NULL; if (UNIV_UNLIKELY((ibool) !!page_is_comp(page) != dict_table_is_comp(index->table))) { @@ -2482,7 +2482,7 @@ page_validate( count++; own_count++; old_rec = rec; - rec = page_rec_get_next(rec); + rec = page_rec_get_next_const(rec); /* set old_offsets to offsets; recycle offsets */ { @@ -2556,7 +2556,7 @@ n_owned_zero: buf[offs + i] = 1; } - rec = page_rec_get_next(rec); + rec = page_rec_get_next_const(rec); } if (UNIV_UNLIKELY(page_dir_get_n_heap(page) != count + 1)) {