Commit 22015f39 authored by marko's avatar marko

branches/zip: Minor cleanup.

buf_calc_page_new_checksum(), buf_calc_page_old_checksum(),
buf_page_is_corrupted(), buf_page_print():
Add const qualifier to byte* parameter.

page_parse_create_zip(): Remove this declaration of non-existing function.

page_rec_check(), page_rec_print(), row_vers_impl_x_locked_off_kernel():
Add const qualifier to rec_t* parameter.

row_vers_old_has_index_entry(): Add const qualifier to dtuple_t* parameter.

row_sel_sec_rec_is_for_blob(): Add const qualifiers.

Replace some occurrences of mtr_memo_contains_page() with mtr_memo_contains().
parent 839a9664
...@@ -241,8 +241,8 @@ to a file. Note that we must be careful to calculate the same value on ...@@ -241,8 +241,8 @@ to a file. Note that we must be careful to calculate the same value on
ulint ulint
buf_calc_page_new_checksum( buf_calc_page_new_checksum(
/*=======================*/ /*=======================*/
/* out: checksum */ /* out: checksum */
byte* page) /* in: buffer page */ const byte* page) /* in: buffer page */
{ {
ulint checksum; ulint checksum;
...@@ -275,8 +275,8 @@ because this takes that field as an input! */ ...@@ -275,8 +275,8 @@ because this takes that field as an input! */
ulint ulint
buf_calc_page_old_checksum( buf_calc_page_old_checksum(
/*=======================*/ /*=======================*/
/* out: checksum */ /* out: checksum */
byte* page) /* in: buffer page */ const byte* page) /* in: buffer page */
{ {
ulint checksum; ulint checksum;
...@@ -293,10 +293,10 @@ Checks if a page is corrupt. */ ...@@ -293,10 +293,10 @@ Checks if a page is corrupt. */
ibool ibool
buf_page_is_corrupted( buf_page_is_corrupted(
/*==================*/ /*==================*/
/* out: TRUE if corrupted */ /* out: TRUE if corrupted */
byte* read_buf, /* in: a database page */ const byte* read_buf, /* in: a database page */
ulint zip_size) /* in: size of compressed page; ulint zip_size) /* in: size of compressed page;
0 for uncompressed pages */ 0 for uncompressed pages */
{ {
ulint checksum_field; ulint checksum_field;
ulint old_checksum_field; ulint old_checksum_field;
...@@ -404,8 +404,8 @@ Prints a page to stderr. */ ...@@ -404,8 +404,8 @@ Prints a page to stderr. */
void void
buf_page_print( buf_page_print(
/*===========*/ /*===========*/
byte* read_buf, /* in: a database page */ const byte* read_buf, /* in: a database page */
ulint zip_size) /* in: compressed page size, or ulint zip_size) /* in: compressed page size, or
0 for uncompressed pages */ 0 for uncompressed pages */
{ {
dict_index_t* index; dict_index_t* index;
......
...@@ -122,8 +122,8 @@ btr_cur_compress_recommendation( ...@@ -122,8 +122,8 @@ btr_cur_compress_recommendation(
{ {
page_t* page; page_t* page;
ut_ad(mtr_memo_contains_page(mtr, btr_cur_get_rec(cursor), ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
...@@ -158,8 +158,8 @@ btr_cur_can_delete_without_compress( ...@@ -158,8 +158,8 @@ btr_cur_can_delete_without_compress(
{ {
page_t* page; page_t* page;
ut_ad(mtr_memo_contains_page(mtr, btr_cur_get_rec(cursor), ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
......
...@@ -395,8 +395,8 @@ on 32-bit and 64-bit architectures. */ ...@@ -395,8 +395,8 @@ on 32-bit and 64-bit architectures. */
ulint ulint
buf_calc_page_new_checksum( buf_calc_page_new_checksum(
/*=======================*/ /*=======================*/
/* out: checksum */ /* out: checksum */
byte* page); /* in: buffer page */ const byte* page); /* in: buffer page */
/************************************************************************ /************************************************************************
In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only
looked at the first few bytes of the page. This calculates that old looked at the first few bytes of the page. This calculates that old
...@@ -408,18 +408,18 @@ because this takes that field as an input! */ ...@@ -408,18 +408,18 @@ because this takes that field as an input! */
ulint ulint
buf_calc_page_old_checksum( buf_calc_page_old_checksum(
/*=======================*/ /*=======================*/
/* out: checksum */ /* out: checksum */
byte* page); /* in: buffer page */ const byte* page); /* in: buffer page */
/************************************************************************ /************************************************************************
Checks if a page is corrupt. */ Checks if a page is corrupt. */
ibool ibool
buf_page_is_corrupted( buf_page_is_corrupted(
/*==================*/ /*==================*/
/* out: TRUE if corrupted */ /* out: TRUE if corrupted */
byte* read_buf, /* in: a database page */ const byte* read_buf, /* in: a database page */
ulint zip_size); /* in: size of compressed page; ulint zip_size); /* in: size of compressed page;
0 for uncompressed pages */ 0 for uncompressed pages */
/************************************************************************** /**************************************************************************
Gets the space id, page offset, and byte offset within page of a Gets the space id, page offset, and byte offset within page of a
pointer pointing to a buffer frame containing a file page. */ pointer pointing to a buffer frame containing a file page. */
...@@ -479,9 +479,9 @@ Prints a page to stderr. */ ...@@ -479,9 +479,9 @@ Prints a page to stderr. */
void void
buf_page_print( buf_page_print(
/*===========*/ /*===========*/
byte* read_buf, /* in: a database page */ const byte* read_buf, /* in: a database page */
ulint zip_size); /* in: compressed page size, or ulint zip_size); /* in: compressed page size, or
0 for uncompressed pages */ 0 for uncompressed pages */
/************************************************************************* /*************************************************************************
Returns the number of latched pages in the buffer pool. */ Returns the number of latched pages in the buffer pool. */
......
...@@ -374,8 +374,8 @@ UNIV_INLINE ...@@ -374,8 +374,8 @@ UNIV_INLINE
ibool ibool
page_rec_check( page_rec_check(
/*===========*/ /*===========*/
/* out: TRUE if succeed */ /* out: TRUE if succeed */
rec_t* rec); /* in: record */ const rec_t* rec); /* in: record */
/******************************************************************* /*******************************************************************
Gets the record pointed to by a directory slot. */ Gets the record pointed to by a directory slot. */
UNIV_INLINE UNIV_INLINE
...@@ -841,19 +841,6 @@ page_parse_create( ...@@ -841,19 +841,6 @@ page_parse_create(
ulint comp, /* in: nonzero=compact page format */ ulint comp, /* in: nonzero=compact page format */
buf_block_t* block, /* in: block or NULL */ buf_block_t* block, /* in: block or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/***************************************************************
Parses a redo log record of creating a compressed page. */
byte*
page_parse_create_zip(
/*==================*/
/* out: end of log record or NULL */
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
page_t* page, /* in/out: page or NULL */
page_zip_des_t* page_zip,/* in/out: compressed page or NULL */
dict_index_t* index, /* in: index of the page */
mtr_t* mtr); /* in: mtr or NULL */
/**************************************************************** /****************************************************************
Prints record contents including the data relevant only in Prints record contents including the data relevant only in
the index page context. */ the index page context. */
...@@ -861,7 +848,7 @@ the index page context. */ ...@@ -861,7 +848,7 @@ the index page context. */
void void
page_rec_print( page_rec_print(
/*===========*/ /*===========*/
rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
const ulint* offsets);/* in: record descriptor */ const ulint* offsets);/* in: record descriptor */
/******************************************************************* /*******************************************************************
This is used to print the contents of the directory for This is used to print the contents of the directory for
......
...@@ -543,17 +543,15 @@ UNIV_INLINE ...@@ -543,17 +543,15 @@ UNIV_INLINE
ibool ibool
page_rec_check( page_rec_check(
/*===========*/ /*===========*/
/* out: TRUE if succeed */ /* out: TRUE if succeed */
rec_t* rec) /* in: record */ const rec_t* rec) /* in: record */
{ {
page_t* page; const page_t* page = page_align((rec_t*) rec);
ut_a(rec); ut_a(rec);
page = page_align(rec); ut_a(page_offset(rec) <= page_header_get_field(page, PAGE_HEAP_TOP));
ut_a(page_offset(rec) >= PAGE_DATA);
ut_a(rec <= page_header_get_ptr(page, PAGE_HEAP_TOP));
ut_a(rec >= page + PAGE_DATA);
return(TRUE); return(TRUE);
} }
......
...@@ -29,7 +29,7 @@ row_vers_impl_x_locked_off_kernel( ...@@ -29,7 +29,7 @@ row_vers_impl_x_locked_off_kernel(
/* out: NULL if committed, else the active /* out: NULL if committed, else the active
transaction; NOTE that the kernel mutex is transaction; NOTE that the kernel mutex is
temporarily released! */ temporarily released! */
rec_t* rec, /* in: record in a secondary index */ const rec_t* rec, /* in: record in a secondary index */
dict_index_t* index, /* in: the secondary index */ dict_index_t* index, /* in: the secondary index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */ const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/********************************************************************* /*********************************************************************
...@@ -62,7 +62,7 @@ row_vers_old_has_index_entry( ...@@ -62,7 +62,7 @@ row_vers_old_has_index_entry(
mtr_t* mtr, /* in: mtr holding the latch on rec; it will mtr_t* mtr, /* in: mtr holding the latch on rec; it will
also hold the latch on purge_view */ also hold the latch on purge_view */
dict_index_t* index, /* in: the secondary index */ dict_index_t* index, /* in: the secondary index */
dtuple_t* ientry); /* in: the secondary index entry */ const dtuple_t* ientry);/* in: the secondary index entry */
/********************************************************************* /*********************************************************************
Constructs the version of a clustered index record which a consistent Constructs the version of a clustered index record which a consistent
read should see. We assume that the trx id stored in rec is such that read should see. We assume that the trx id stored in rec is such that
......
...@@ -1512,7 +1512,7 @@ the index page context. */ ...@@ -1512,7 +1512,7 @@ the index page context. */
void void
page_rec_print( page_rec_print(
/*===========*/ /*===========*/
rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
const ulint* offsets)/* in: record descriptor */ const ulint* offsets)/* in: record descriptor */
{ {
ut_a(!page_rec_is_comp(rec) == !rec_offs_comp(offsets)); ut_a(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
......
...@@ -3518,7 +3518,7 @@ page_zip_reorganize( ...@@ -3518,7 +3518,7 @@ page_zip_reorganize(
page_t* temp_page; page_t* temp_page;
ulint log_mode; ulint log_mode;
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_is_comp(page)); ut_ad(page_is_comp(page));
/* Note that page_zip_validate(page_zip, page) may fail here. */ /* Note that page_zip_validate(page_zip, page) may fail here. */
......
...@@ -60,20 +60,21 @@ static ...@@ -60,20 +60,21 @@ static
ibool ibool
row_sel_sec_rec_is_for_blob( row_sel_sec_rec_is_for_blob(
/*========================*/ /*========================*/
/* out: TRUE if the columns are equal */ /* out: TRUE if the columns
ulint mtype, /* in: main type */ are equal */
ulint prtype, /* in: precise type */ ulint mtype, /* in: main type */
ulint mbminlen, /* in: minimum length of a ulint prtype, /* in: precise type */
ulint mbminlen, /* in: minimum length of a
multi-byte character */
ulint mbmaxlen, /* in: maximum length of a
multi-byte character */ multi-byte character */
ulint mbmaxlen, /* in: maximum length of a const byte* clust_field, /* in: the locally stored part of
multi-byte character */
byte* clust_field, /* in: the locally stored part of
the clustered index column, including the clustered index column, including
the BLOB pointer */ the BLOB pointer */
ulint clust_len, /* in: length of clust_field */ ulint clust_len, /* in: length of clust_field */
byte* sec_field, /* in: column in secondary index */ const byte* sec_field, /* in: column in secondary index */
ulint sec_len, /* in: length of sec_field */ ulint sec_len, /* in: length of sec_field */
ulint zip_size) /* in: compressed page size, or 0 */ ulint zip_size) /* in: compressed page size, or 0 */
{ {
ulint len; ulint len;
byte buf[DICT_MAX_INDEX_COL_LEN]; byte buf[DICT_MAX_INDEX_COL_LEN];
...@@ -101,14 +102,14 @@ row_sel_sec_rec_is_for_clust_rec( ...@@ -101,14 +102,14 @@ row_sel_sec_rec_is_for_clust_rec(
record is equal to the corresponding record is equal to the corresponding
fields in the clustered record, fields in the clustered record,
when compared with collation */ when compared with collation */
rec_t* sec_rec, /* in: secondary index record */ const rec_t* sec_rec, /* in: secondary index record */
dict_index_t* sec_index, /* in: secondary index */ dict_index_t* sec_index, /* in: secondary index */
rec_t* clust_rec, /* in: clustered index record */ const rec_t* clust_rec, /* in: clustered index record */
dict_index_t* clust_index) /* in: clustered index */ dict_index_t* clust_index) /* in: clustered index */
{ {
byte* sec_field; const byte* sec_field;
ulint sec_len; ulint sec_len;
byte* clust_field; const byte* clust_field;
ulint n; ulint n;
ulint i; ulint i;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
...@@ -3161,7 +3162,7 @@ row_sel_try_search_shortcut_for_mysql( ...@@ -3161,7 +3162,7 @@ row_sel_try_search_shortcut_for_mysql(
mtr_t* mtr) /* in: started mtr */ mtr_t* mtr) /* in: started mtr */
{ {
dict_index_t* index = prebuilt->index; dict_index_t* index = prebuilt->index;
dtuple_t* search_tuple = prebuilt->search_tuple; const dtuple_t* search_tuple = prebuilt->search_tuple;
btr_pcur_t* pcur = prebuilt->pcur; btr_pcur_t* pcur = prebuilt->pcur;
trx_t* trx = prebuilt->trx; trx_t* trx = prebuilt->trx;
rec_t* rec; rec_t* rec;
...@@ -3250,7 +3251,7 @@ row_search_for_mysql( ...@@ -3250,7 +3251,7 @@ row_search_for_mysql(
{ {
dict_index_t* index = prebuilt->index; dict_index_t* index = prebuilt->index;
ibool comp = dict_table_is_comp(index->table); ibool comp = dict_table_is_comp(index->table);
dtuple_t* search_tuple = prebuilt->search_tuple; const dtuple_t* search_tuple = prebuilt->search_tuple;
btr_pcur_t* pcur = prebuilt->pcur; btr_pcur_t* pcur = prebuilt->pcur;
trx_t* trx = prebuilt->trx; trx_t* trx = prebuilt->trx;
dict_index_t* clust_index; dict_index_t* clust_index;
......
...@@ -40,7 +40,7 @@ row_vers_impl_x_locked_off_kernel( ...@@ -40,7 +40,7 @@ row_vers_impl_x_locked_off_kernel(
/* out: NULL if committed, else the active /* out: NULL if committed, else the active
transaction; NOTE that the kernel mutex is transaction; NOTE that the kernel mutex is
temporarily released! */ temporarily released! */
rec_t* rec, /* in: record in a secondary index */ const rec_t* rec, /* in: record in a secondary index */
dict_index_t* index, /* in: the secondary index */ dict_index_t* index, /* in: the secondary index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */ const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{ {
...@@ -302,7 +302,7 @@ row_vers_old_has_index_entry( ...@@ -302,7 +302,7 @@ row_vers_old_has_index_entry(
mtr_t* mtr, /* in: mtr holding the latch on rec; it will mtr_t* mtr, /* in: mtr holding the latch on rec; it will
also hold the latch on purge_view */ also hold the latch on purge_view */
dict_index_t* index, /* in: the secondary index */ dict_index_t* index, /* in: the secondary index */
dtuple_t* ientry) /* in: the secondary index entry */ const dtuple_t* ientry) /* in: the secondary index entry */
{ {
rec_t* version; rec_t* version;
rec_t* prev_version; rec_t* prev_version;
...@@ -310,8 +310,8 @@ row_vers_old_has_index_entry( ...@@ -310,8 +310,8 @@ row_vers_old_has_index_entry(
ulint* clust_offsets; ulint* clust_offsets;
mem_heap_t* heap; mem_heap_t* heap;
mem_heap_t* heap2; mem_heap_t* heap2;
dtuple_t* row; const dtuple_t* row;
dtuple_t* entry; const dtuple_t* entry;
ulint err; ulint err;
ulint comp; ulint comp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment