GIF89a; Mini Shell

Mini Shell

Direktori : /usr/share/mysql-test/suite/innodb_zip/t/
Upload File :
Current File : //usr/share/mysql-test/suite/innodb_zip/t/innodb_wl6347_comp_indx_stat.test

#******************************************************************
# test the interaction between wl6347 & wl6344 (2.1)
# This testcase is to verify the table/idex level comoression stats
# When the flags are set as follows
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=0
# page size 1K,2K,4K,8K,16K
# check the size and compression stats of the table tab5
#******************************************************************

# This test case needs InnoDB.
-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- source include/have_innodb_16k.inc
-- source include/not_valgrind.inc

-- vertical_results

let MYSQLD_DATADIR=`SELECT @@datadir`;
let $innodb_compression_level = `SELECT @@global.innodb_compression_level`;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SET GLOBAL innodb_compression_level=0;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=0
# with page size 1K
#******************************************************************

--echo # create a table with page size=1K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=1;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for deterministic reasons simple data should be inserted.
--echo # insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # Restarting server
-- source include/restart_mysqld.inc

--echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_compression_level=0;

--echo # fetch the compressed page and check the stats
--echo # The stats figure may be different/same for each restart.
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table
-- echo # testcase : pass = 1 fail = 0
SET @comp_val=0;
SET @uncomp_val=1;
--source suite/innodb_zip/include/innodb_stats_restart.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=0
# with page size 2K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1;

--echo # create a table with page size=2K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=2;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # Restarting server
-- source include/restart_mysqld.inc

--echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_compression_level=0;

--echo # fetch the compressed page and check the stats
--echo # The stats figure may be different/same for each restart.
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table
-- echo # testcase : pass = 1 fail = 0
SET @comp_val=0;
SET @uncomp_val=2;
--source suite/innodb_zip/include/innodb_stats_restart.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=0
#  with page size 4K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1;

--echo # create a table with page size=4K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=4;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=0
#  with page size 8K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1;

--echo # create a table with page size=8K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=8;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=0
#  with page size 16K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1;

--echo # create a table with page size=16K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=16;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# test the interaction between wl6347 & wl6344 (2.2)
# This testcase is to verify the table/idex level comoression stats
# When the flags are set as follows
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=9
# page size 1K,2K,4K,8K,16K
# check the size and compression stats of the table tab5
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_compression_level=9;


#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=9
#  with page size 1K
#******************************************************************

--echo # create a table with page size=1K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=1;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 65536
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 2097152
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # Restarting server
-- source include/restart_mysqld.inc

--echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_compression_level=9;


--echo # fetch the compressed page and check the stats
--echo # The stats figure may be different/same for each restart.
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table
-- echo # testcase : pass = 1 fail = 0
SET @comp_val=0;
SET @uncomp_val=1;
--source suite/innodb_zip/include/innodb_stats_restart.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=9
#  with page size 2K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=2K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=2;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 65536
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 2097152
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # Restarting server
-- source include/restart_mysqld.inc

--echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_compression_level=9;


--echo # fetch the compressed page and check the stats
--echo # The stats figure may be different/same for each restart.
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table
-- echo # testcase : pass = 1 fail = 0
SET @comp_val=0;
SET @uncomp_val=1;
--source suite/innodb_zip/include/innodb_stats_restart.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=9
#  with page size 4K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=4K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=4;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 65536
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 159744
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=9
#  with page size 8K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=8K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=8;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 122880
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 212992
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=9
#  with page size 16K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=16K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=16;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 245760
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 344064
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# test the interaction between wl6347 & wl6344 (2.3)
# This testcase is to verify the table/idex level comoression stats
# When the flags are set as follows
# innodb_cmp_per_index_enabled=ON and
# innodb_compression_level=6 (default)
# page size 1K,2K,4K,8K,16K
# check the size and compression stats of the table tab5
#******************************************************************

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=Def
#  with page size 1K
#******************************************************************


--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

SET GLOBAL innodb_compression_level=default;

--echo # create a table with page size=1K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=1;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 65536
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 65536
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=Def
#  with page size 4K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

SET GLOBAL innodb_compression_level=default;

--echo # create a table with page size=4K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=4;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 65536
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 86016
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=Def
#  with page size 8K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

SET GLOBAL innodb_compression_level=default;

--echo # create a table with page size=8K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=8;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 122880
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 172032
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and innodb_compression_level=Def
#  with page size 16K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

SET GLOBAL innodb_compression_level=default;

--echo # create a table with page size=16K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=16;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 245760
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
--echo # The size of the file with 0 compress = 344064
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# Test the interaction between wl6347 & wl6344 (2.5 & 2.6)
# This testcase is to verify the table/idex level comoression stats
# When the flags are set as follows
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=0
# page size 1K,2K,4K,8K,16K
# check the size and compression stats of the table tab5
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_compression_failure_threshold_pct=0;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # check the flags
SELECT @@innodb_cmp_per_index_enabled;
SELECT @@innodb_compression_failure_threshold_pct;
SELECT @@innodb_file_format;
SELECT @@innodb_file_per_table;
SELECT @@innodb_compression_level;


#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=0 with page size 1K
#******************************************************************

--echo # create a table with page size=1K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=1;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # Restarting server
-- source include/restart_mysqld.inc

--echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_compression_failure_threshold_pct=0;
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';


--echo # fetch the compressed page and check the stats
--echo # The stats figure may be different/same for each restart.
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table
-- echo # testcase : pass = 1 fail = 0
SET @comp_val=0;
SET @uncomp_val=1;
--source suite/innodb_zip/include/innodb_stats_restart.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=0 with page size 2K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=2K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=2;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=0 with page size 4K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=4K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=4;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=0 with page size 8K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=8K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=8;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=0 with page size 16K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=16K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=16;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# Test the interaction between wl6347 & wl6344 (2.7)
# This testcase is to verify the table/idex level comoression stats
# When the flags are set as follows
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=10
# page size 1K,2K,4K,8K,16K
# check the size and compression stats of the table tab5
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SET GLOBAL innodb_compression_failure_threshold_pct=10;
SET GLOBAL innodb_compression_level=Default;


--echo # check the flags
SELECT @@innodb_cmp_per_index_enabled;
SELECT @@innodb_compression_failure_threshold_pct;
SELECT @@innodb_file_format;
SELECT @@innodb_file_per_table;
SELECT @@innodb_compression_level;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=10 with page size 1K
#******************************************************************

--echo # create a table with page size=1K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=1;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # Restarting server
-- source include/restart_mysqld.inc

--echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # set the flags
SET GLOBAL innodb_compression_failure_threshold_pct=10;
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_file_format='barracuda';
SET GLOBAL innodb_compression_failure_threshold_pct=10;


--echo # fetch the compressed page and check the stats
--echo # The stats figure may be different/same for each restart.
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table
-- echo # testcase : pass = 1 fail = 0
SET @comp_val=0;
SET @uncomp_val=1;
--source suite/innodb_zip/include/innodb_stats_restart.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=10 with page size 2K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SET GLOBAL innodb_compression_failure_threshold_pct=10;

--echo # create a table with page size=2K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=2;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=2;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=10 with page size 4K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=4K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=4;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=10 with page size 8K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SET GLOBAL innodb_compression_failure_threshold_pct=10;

--echo # create a table with page size=8K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=8;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# innodb_cmp_per_index_enabled=ON and
# Innodb_compression_failure_threshold_pct=10 with page size 16K
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON;

--echo # create a table with page size=16K
--echo # create indexes on each column.(total 9 indexes)
let $block_size=16;
--source suite/innodb_zip/include/innodb_create_tab_indx.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # for determintic resons simple data should be inserted.
--echo #insert some 100 records
let $i = 100;
--source suite/innodb_zip/include/innodb_load_data.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed page and check the stats
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

--echo # fetch the compressed same page once again and check the stats
--echo # the stat figures should be same as above query
--source suite/innodb_zip/include/innodb_fetch_records.inc

--echo # check the stats of the table & size of the table
SET @inl_val=1;
--source suite/innodb_zip/include/innodb_stats_comp_index.inc

DROP TABLE tab5;

#******************************************************************
# Create multiple tables & indexes having same name in 2 diff DB's
# Check the stats of the table. (1.1)
#******************************************************************

--echo #reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1;

SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_compression_level=default;
SET GLOBAL innodb_compression_failure_threshold_pct=default;


--echo #create a table page size=1K
CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB,
col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT,
col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255))
ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;

CREATE INDEX idx1 ON tab5(col_1(10));

--echo #check the stats of the table
SELECT database_name,table_name,index_name,compress_ops,compress_ops_ok
FROM information_schema.innodb_cmp_per_index
WHERE database_name='test' and table_name='tab5'
ORDER BY index_name,table_name,database_name ;

CREATE DATABASE sb;
USE sb;

--echo #create a table page size=1K (testcase-1)
CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB,
col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT,
col_7 LONGBLOB,col_8 LONGTEXT,col_9 VARCHAR(255))
ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;

CREATE INDEX idx1 ON tab5(col_1(10));

SELECT database_name,table_name,index_name,compress_ops,compress_ops_ok
FROM information_schema.innodb_cmp_per_index
WHERE database_name='sb' and table_name='tab5'
ORDER BY index_name,table_name,database_name ;

DROP TABLE tab5, test.tab5;
DROP DATABASE sb;

--echo # reset the flags
eval SET GLOBAL innodb_file_per_table=default;
eval SET GLOBAL innodb_file_format=default;
eval SET GLOBAL innodb_cmp_per_index_enabled=default;
--disable_query_log
eval SET GLOBAL innodb_compression_level=$innodb_compression_level;
--enable_query_log
eval SET GLOBAL innodb_compression_failure_threshold_pct=default;

./BlackJoker Mini Shell 1.0