WL#5757: InnoDB: Support Page Sizes 32k and 64k

Status: Complete   —   Priority: Medium

Support page sizes 32k and 64k, but don't support compression format. 
And we limit max record size to 16k.
Functional requirements:
F-1: innodb_page_size should support 32k and 64k.

F-2: Don't support compression format when innodb_page_size is 32k or 64k.

F-3 : Keep 16k as the max record size when innodb-page-size is 32k or 64k 

Non-Functional requirements:
NF-1: Implicit requirements: No new SQL needed, work on all platforms.
1. Set max value of innodb-page-size to 64k.

2. Handle 32k & 64k page size in file IO.

3. Increase extent size for 32k & 64k page size.
			4096    8192	16384	32768	65536
extent size(bytes)      1M      1M      1M      2M      4M
xdes size               88      56      40      40      40               
N_EXTENTS               16      64      256     512     1024
xdes[0] start           150     150     150     150     150
xdes[N_EXTENTS] end     1568    3744    10400   20640   41120

XDES_SIZE = 24 + UT_BITS_IN_BYTES(extent_size / innodb_page_size * 2).

N_EXTENTS = innodb_page_size * innodb_page_size / extent_size.

If we do not enlarge the extent size, we will have too many extent headers on the 
bitmap page and the bitmap page will overflow. See compilation check & assert in 
"xdes_calc_descriptor_page".

4. Push warning if ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE are used in CREATE 
TABLE when innodb-page-size is 32k or 64k.

5. Keep 16k as the max record size when innodb-page-size is 64k, even we can 
support much bigger record size for row formats except REDUNDANT.
1. Set max value of innodb-page-size to 64k.
a. storage/innobase/include/univ.i

#define UNIV_PAGE_SIZE_SHIFT_MAX	16

b. storage/innobase/include/page0size.h

#define PAGE_SIZE_T_SIZE_BITS	17

2. Handle 32k & 64k page size in file IO.
storage/innobase/fil/fil0fil.cc

fil_io(
		case 32768: size_shift = 15; break;
		case 65536: size_shift = 16; break;

3. Increase extent size for 32k & 64k page size.
storage/innobase/include/fsp0types.h

/** File space extent size (one megabyte if default) in pages */
#define FSP_EXTENT_SIZE         ((UNIV_PAGE_SIZE <= (1 << 14) ? \
                                (1048576U / UNIV_PAGE_SIZE) :   \
                                ((UNIV_PAGE_SIZE <= 1 << 15) ?  \
                                (2097152U / UNIV_PAGE_SIZE) :   \
                                (4194304U / UNIV_PAGE_SIZE))))

/** File space extent size (four megabyte) in pages for MAX page size */
#define FSP_EXTENT_SIZE_MAX     (4194304U / UNIV_PAGE_SIZE_MAX)


4. Push warning if ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE are used in CREATE 
TABLE when innodb-page-size is 32k or 64k.
a. storage/innobase/handler/ha_innodb.cc

innobase_table_flags

        /* Don't support compressed table when page size > 16k. */
	if (zip_allowed && zip_ssize && UNIV_PAGE_SIZE > UNIV_PAGE_SIZE_DEF) {
		push_warning(thd, Sql_condition::SL_WARNING,
			     ER_ILLEGAL_HA_CREATE_OPTION,
			     "InnoDB: Cannot create a COMPRESSED table"
			     " when innodb_page_size > 16k.");
		zip_allowed = FALSE;
	}

b. storage/innobase/page/page0zip.cc
page_zip_dir_encode

#if PAGE_ZIP_DIR_SLOT_MASK < UNIV_PAGE_SIZE_DEF - 1
# error "PAGE_ZIP_DIR_SLOT_MASK < UNIV_PAGE_SIZE_DEF - 1"
#endif

5. Keep 16k as the max record size when innodb-page-size is 64k, even we can 
support much bigger record size for row formats except REDUNDANT.
storage/innobase/btr/btr0cur.cc

btr_cur_optimistic_update
        /* If the record size > 16k, we need to store it externally.*/
	if (page_zip_rec_needs_ext(new_rec_size, page_is_comp(page),
				   dict_index_get_n_fields(index),
				   block->page.size)) {
		goto any_extern;
	}


6. Miscs
a. Set innodb_log_buffer_size default value from 8M to 16M.

b. storage/innobase/row/row0ftsort.cc
row_fts_merge_insert, change buf size from 16k to 64k.