[Commits] fe8186ea971: Type changes and output fixed for innochecksum.

jan jan.lindstrom at mariadb.com
Tue Aug 8 09:39:42 EEST 2017


revision-id: fe8186ea971bf78167f4c8fe64b7e351b5d55128 (mariadb-10.2.7-48-gfe8186ea971)
parent(s): c34f5cf051fb787051df34dbfa7ff4b5dae3a8e9 c4ee41cdb042d6484ce016f2d5c3c89e2478d78b
author: Jan Lindström
committer: Jan Lindström
timestamp: 2017-08-08 09:39:28 +0300
message:

Type changes and output fixed for innochecksum.


 extra/innochecksum.cc                              | 232 +++++++++++----------
 mysql-test/suite/encryption/t/innochecksum.test    |   1 +
 .../suite/innodb_zip/r/innochecksum_3.result       |  30 +--
 storage/innobase/buf/buf0buf.cc                    |  44 ++--
 storage/innobase/include/univ.i                    |   6 +-
 storage/innobase/page/page0zip.cc                  |   8 +-
 6 files changed, 167 insertions(+), 154 deletions(-)

diff --cc extra/innochecksum.cc
index 6553a46ba46,a0976970db7..2aed1623fcc
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@@ -802,83 -804,96 +804,91 @@@ parse_page
  	switch (mach_read_from_2(page + FIL_PAGE_TYPE)) {
  
  	case FIL_PAGE_INDEX: {
+ 		uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
  		page_type.n_fil_page_index++;
- 		id = mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID);
- 		n_recs = page_get_n_recs(page);
- 		page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
- 		left_page_no = mach_read_from_4(page + FIL_PAGE_PREV);
- 		right_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
- 		ulint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
  
  		/* If page is encrypted we can't read index header */
- 		if (!key_version) {
- 			data_bytes = page_get_data_size(page);
- 		} else {
- 			data_bytes = 0;
- 		}
- 
- 		is_leaf = page_is_leaf(page);
- 		size_range_id = (data_bytes * SIZE_RANGES_FOR_PAGE
- 			+ page_size.logical() - 1) /
- 			page_size.logical();
+ 		if (!is_encrypted) {
+ 			id = mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID);
+ 			n_recs = mach_read_from_2(page + PAGE_HEADER + PAGE_N_RECS);
+ 			page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
+ 			left_page_no = mach_read_from_4(page + FIL_PAGE_PREV);
+ 			right_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
+ 			ulint is_comp = mach_read_from_2(page + PAGE_HEADER + PAGE_N_HEAP) & 0x8000;
+ 			ulint level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL);
+ 			ulint garbage = mach_read_from_2(page + PAGE_HEADER + PAGE_GARBAGE);
+ 
+ 
+ 			data_bytes = (ulint)(mach_read_from_2(page + PAGE_HEADER + PAGE_HEAP_TOP)
+ 				- (is_comp
+ 					? PAGE_NEW_SUPREMUM_END
+ 					: PAGE_OLD_SUPREMUM_END)
+ 				- garbage);
+ 
+ 			is_leaf = (!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL)));
 -
+ 			if (page_type_dump) {
+ 				fprintf(file, "#::%llu\t\t|\t\tIndex page\t\t\t|"
+ 					"\tindex id=%llu,", cur_page_num, id);
 -
+ 				fprintf(file,
+ 					" page level=" ULINTPF
+ 					", No. of records=" ULINTPF
+ 					", garbage=" ULINTPF ", %s\n",
+ 					level, n_recs, garbage, str);
+ 			}
 -
+ 			size_range_id = (data_bytes * SIZE_RANGES_FOR_PAGE
+ 				+ page_size.logical() - 1) /
+ 				page_size.logical();
  
- 		if (size_range_id > SIZE_RANGES_FOR_PAGE + 1) {
- 			/* data_bytes is bigger than logical_page_size */
- 			size_range_id = SIZE_RANGES_FOR_PAGE + 1;
- 		}
- 		if (per_page_details) {
- 			printf("index %llu page %lu leaf %u n_recs %lu data_bytes %lu"
- 				"\n", id, page_no, is_leaf, n_recs, data_bytes);
- 		}
- 		/* update per-index statistics */
- 		{
- 			if (index_ids.count(id) == 0) {
- 				index_ids[id] = per_index_stats();
+ 			if (size_range_id > SIZE_RANGES_FOR_PAGE + 1) {
+ 				/* data_bytes is bigger than logical_page_size */
+ 				size_range_id = SIZE_RANGES_FOR_PAGE + 1;
  			}
- 			std::map<unsigned long long, per_index_stats>::iterator it;
- 			it = index_ids.find(id);
- 			per_index_stats &index = (it->second);
- 			const byte* des = xdes + XDES_ARR_OFFSET
- 				+ XDES_SIZE * ((page_no & (page_size.physical() - 1))
- 					/ FSP_EXTENT_SIZE);
- 			if (xdes_get_bit(des, XDES_FREE_BIT,
- 					page_no % FSP_EXTENT_SIZE)) {
- 				index.free_pages++;
- 				return;
+ 			if (per_page_details) {
+ 				printf("index id=%llu page " ULINTPF " leaf %d n_recs " ULINTPF " data_bytes " ULINTPF
+ 					"\n", id, page_no, is_leaf, n_recs, data_bytes);
  			}
- 			index.pages++;
- 			if (is_leaf) {
- 				index.leaf_pages++;
- 				if (data_bytes > index.max_data_size) {
- 					index.max_data_size = data_bytes;
+ 			/* update per-index statistics */
+ 			{
+ 				if (index_ids.count(id) == 0) {
+ 					index_ids[id] = per_index_stats();
+ 				}
+ 				std::map<unsigned long long, per_index_stats>::iterator it;
+ 				it = index_ids.find(id);
+ 				per_index_stats &index = (it->second);
+ 				const byte* des = xdes + XDES_ARR_OFFSET
+ 					+ XDES_SIZE * ((page_no & (page_size.physical() - 1))
+ 						/ FSP_EXTENT_SIZE);
+ 				if (xdes_get_bit(des, XDES_FREE_BIT,
+ 						page_no % FSP_EXTENT_SIZE)) {
+ 					index.free_pages++;
+ 					return;
  				}
- 				struct per_page_stats pp(n_recs, data_bytes,
- 					left_page_no, right_page_no);
  
- 				index.leaves[page_no] = pp;
+ 				index.pages++;
 -
+ 				if (is_leaf) {
+ 					index.leaf_pages++;
+ 					if (data_bytes > index.max_data_size) {
+ 						index.max_data_size = data_bytes;
+ 					}
+ 					struct per_page_stats pp(n_recs, data_bytes,
+ 						left_page_no, right_page_no);
  
- 				if (left_page_no == ULINT32_UNDEFINED) {
- 					index.first_leaf_page = page_no;
- 					index.count++;
+ 					index.leaves[page_no] = pp;
+ 
+ 					if (left_page_no == ULINT32_UNDEFINED) {
+ 						index.first_leaf_page = page_no;
+ 						index.count++;
+ 					}
  				}
 -
+ 				index.total_n_recs += n_recs;
+ 				index.total_data_bytes += data_bytes;
+ 				index.pages_in_size_range[size_range_id] ++;
  			}
- 			index.total_n_recs += n_recs;
- 			index.total_data_bytes += data_bytes;
- 			index.pages_in_size_range[size_range_id] ++;
+ 		} else {
+ 			fprintf(file, "#::%llu\t\t|\t\tEncrypted Index page\t\t\t|"
+ 				"\tkey_version %u,%s\n", cur_page_num, key_version, str);
  		}
  
- 		if (page_type_dump) {
- 			fprintf(file, "#::%8" PRIuMAX "\t\t|\t\tIndex page\t\t\t|"
- 				"\tindex id=%llu,", cur_page_num, id);
- 
- 			fprintf(file,
- 				" page level=" ULINTPF
- 				", No. of records=" ULINTPF
- 				", garbage=" ULINTPF ", %s\n",
- 				page_header_get_field(page, PAGE_LEVEL),
- 				page_header_get_field(page, PAGE_N_RECS),
- 				page_header_get_field(page, PAGE_GARBAGE), str);
- 		}
  		break;
  	}
  	case FIL_PAGE_UNDO_LOG:
@@@ -1510,6 -1524,6 +1519,7 @@@ rewrite_checksum
  	return (exit_status);
  }
  
++
  int main(
  	int	argc,
  	char	**argv)


More information about the commits mailing list