diff --git a/mysql-test/suite/memcached/include/ibd2sdi_common.inc b/mysql-test/suite/memcached/include/ibd2sdi_common.inc index 5e80bfebfefe..ca8951971510 100644 --- a/mysql-test/suite/memcached/include/ibd2sdi_common.inc +++ b/mysql-test/suite/memcached/include/ibd2sdi_common.inc @@ -5,35 +5,35 @@ # For example: --let SKIP_LARGE_DATA_FILE = > $MYSQLD_VARDIR/log/ibd2sdi-large.err --echo # 1. Read SDI with long option ---exec $IBD2SDI $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 3. Read with specific id & type (long option) ---exec $IBD2SDI --id=3 --type=3 $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --id=3 --type=3 $IBD_FILE 2>&1 --echo # 4. Read with specific id & type (short option) ---exec $IBD2SDI -i 4 -t 4 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty -i 4 -t 4 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 5. Read with skip data --exec $IBD2SDI --skip-data $IBD_FILE $SKIP_LARGE_DATA_FILE --exec $IBD2SDI -s $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 6. Read SDI and dump into FILE ---exec $IBD2SDI --dump-file=$DUMP_FILE $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --dump-file=$DUMP_FILE $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 if (!$SKIP_LARGE_DATA_FILE) { --cat_file $DUMP_FILE } --echo # 7. Read SDI and dump into FILE using short option ---exec $IBD2SDI -s -d $DUMP_FILE $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty -s -d $DUMP_FILE $IBD_FILE 2>&1 if (!$SKIP_LARGE_DATA_FILE) { --cat_file $DUMP_FILE } --echo # 8. Print all records matching type (short option) ---exec $IBD2SDI -t 0 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty -t 0 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 9. Print all records matching id (long option) ---exec $IBD2SDI --id=3 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --id=3 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 10. Print version --exec $IBD2SDI -v > $MYSQLTEST_VARDIR/tmp/ver_output @@ -85,29 +85,29 @@ EOF --remove_file $MYSQLTEST_VARDIR/tmp/help_output --echo # 12. Print all records ---exec $IBD2SDI $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 13. Retrieve explicit id & type ---exec $IBD2SDI --id=3 --type=3 $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --id=3 --type=3 $IBD_FILE 2>&1 --echo # 14. Skip data and retrieve ---exec $IBD2SDI --skip-data $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --skip-data $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 15. Dump all records into outfile ---exec $IBD2SDI --dump-file=$DUMP_FILE $IBD_FILE +--exec $IBD2SDI --skip-pretty --dump-file=$DUMP_FILE $IBD_FILE if (!$SKIP_LARGE_DATA_FILE) { --cat_file $DUMP_FILE } --echo # 16. Print all records matching type (short option) ---exec $IBD2SDI -t 0 $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty -t 0 $IBD_FILE 2>&1 --echo # 17. Print all records matching id (long option) ---exec $IBD2SDI --id=3 $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --id=3 $IBD_FILE 2>&1 --echo # 18. Pass --no-check & --strict-check together --error 1 ---exec $IBD2SDI --no-check --strict-check="crc32" $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --no-check --strict-check="crc32" $IBD_FILE 2>&1 --replace_result $IBD2SDI IBD2SDI --error 1 @@ -130,16 +130,16 @@ if (!$SKIP_LARGE_DATA_FILE) { --exec $IBD2SDI -t b $IBD_FILE 2>&1 --echo # 22.2 numbers with +/- ---exec $IBD2SDI --type=+0 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 ---exec $IBD2SDI --type=-0 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 ---exec $IBD2SDI --type=+1 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 ---exec $IBD2SDI --type=-1 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 ---exec $IBD2SDI --type=-15 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 ---exec $IBD2SDI --type=+16 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=+0 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=-0 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=+1 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=-1 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=-15 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=+16 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 22.4 with no permitted values ---exec $IBD2SDI --type=14 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 ---exec $IBD2SDI --type=-14 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=14 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --type=-14 $IBD_FILE $SKIP_LARGE_DATA_FILE 2>&1 --echo # 22.5 with very long value --replace_result $IBD2SDI IBD2SDI diff --git a/mysql-test/suite/memcached/r/memc292_ibd2sdi_system_tablespace.result b/mysql-test/suite/memcached/r/memc292_ibd2sdi_system_tablespace.result index 989971826a1d..c887356c6c75 100644 --- a/mysql-test/suite/memcached/r/memc292_ibd2sdi_system_tablespace.result +++ b/mysql-test/suite/memcached/r/memc292_ibd2sdi_system_tablespace.result @@ -407,7 +407,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -422,6 +422,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -432,6 +435,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records ["ibd2sdi" , @@ -817,7 +821,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -832,6 +836,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -842,6 +849,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" @@ -958,7 +966,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -973,6 +981,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -983,6 +994,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" diff --git a/mysql-test/suite/memcached/r/memc293_ibd2sdi.result b/mysql-test/suite/memcached/r/memc293_ibd2sdi.result index 5ad28840b9ee..57a78bb372c4 100644 --- a/mysql-test/suite/memcached/r/memc293_ibd2sdi.result +++ b/mysql-test/suite/memcached/r/memc293_ibd2sdi.result @@ -402,7 +402,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -417,6 +417,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -427,6 +430,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records ["ibd2sdi" , @@ -963,11 +967,11 @@ affiliates. Other names may be trademarks of their respective owners. Usage: IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -#, --debug[=name] Output debug log. See - http://dev.mysql.com/doc/refman/9.0/en/dbug-package.html + http://dev.mysql.com/doc/refman/8.0/en/dbug-package.html -d, --dump-file=name Dump the tablespace SDI into the file passed by user. Without the filename, it will default to stdout @@ -980,6 +984,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -991,6 +998,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE [ERROR] ibd2sdi: Error: Unable to seek to necessary offset for file with descriptor X and error msg is: Invalid argument. [ERROR] ibd2sdi: SDI doesn't exist for this tablespace or the SDI root page numbers couldn't be determined. [ERROR] ibd2sdi: Read requested on invalid page number 20. The maximum valid page number in the tablespace is 19. @@ -1755,7 +1763,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -1770,6 +1778,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -1780,6 +1791,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" @@ -1891,7 +1903,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -1906,6 +1918,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -1916,6 +1931,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" @@ -2027,7 +2043,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -2042,6 +2058,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -2052,6 +2071,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" @@ -2168,7 +2188,7 @@ affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] -See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. +See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints. -h, --help Display this help and exit. -v, --version Display version information and exit. -d, --dump-file=name @@ -2183,6 +2203,9 @@ See http://dev.mysql.com/doc/refman/9.0/en/ibd2sdi.html for usage hints. Specify the strict checksum algorithm by the user. Allowed values are innodb, crc32, none. -n, --no-check Ignore the checksum verification. + -p, --pretty Pretty format the SDI output.If false, SDI would be not + human readable but it will be of less size + (Defaults to on; use --skip-pretty to disable.) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -2193,6 +2216,7 @@ id 0 type 0 strict-check crc32 no-check FALSE +pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" diff --git a/mysql-test/suite/memcached/t/memc287_sdi_corruption.test b/mysql-test/suite/memcached/t/memc287_sdi_corruption.test index fb68c596b4a6..e4a17a6f9a0c 100644 --- a/mysql-test/suite/memcached/t/memc287_sdi_corruption.test +++ b/mysql-test/suite/memcached/t/memc287_sdi_corruption.test @@ -37,7 +37,7 @@ ENGINE = INNODB; INSTALL PLUGIN daemon_memcached SONAME 'libmemcached.so'; --echo # 1. Corrupt SDI Leaf Page -let SDI_PAGE_NUM = 27; +let SDI_PAGE_NUM = 22; --source ../include/sdi_corrupt_table.inc # TRUNCATE will not re-create SDI indexes for now. So drop+create table @@ -50,7 +50,7 @@ CREATE TABLE t1 (c1 INT PRIMARY KEY, ENGINE = INNODB; --echo # 2. Corrupt SDI Non-Leaf Page -let SDI_PAGE_NUM = 23; +let SDI_PAGE_NUM = 21; --source ../include/sdi_corrupt_table.inc # TRUNCATE will not re-create SDI indexes for now. So drop+create table diff --git a/mysql-test/suite/memcached/t/memc293_ibd2sdi.test b/mysql-test/suite/memcached/t/memc293_ibd2sdi.test index eb7f073412ea..8c84ace279fb 100644 --- a/mysql-test/suite/memcached/t/memc293_ibd2sdi.test +++ b/mysql-test/suite/memcached/t/memc293_ibd2sdi.test @@ -95,7 +95,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t2; # Shutdown server --source include/shutdown_mysqld.inc ---exec $IBD2SDI $IBD_FILE -c innodb 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE -c innodb 2>&1 --let restart_parameters=restart: --innodb_checksum_algorithm=none --source include/start_mysqld.inc @@ -127,7 +127,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; # Shutdown server --source include/shutdown_mysqld.inc ---exec $IBD2SDI $IBD_FILE --strict-check=none 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE --strict-check=none 2>&1 --let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd @@ -150,7 +150,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --error 1 --exec $IBD2SDI --debug=d,ib_file_open_error $IBD_FILE 2>&1 ---exec $IBD2SDI --debug=d,ib_partial_page $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty --debug=d,ib_partial_page $IBD_FILE 2>&1 --error 1 --exec $IBD2SDI --debug=d,ib_no_sdi $IBD_FILE 2>&1 @@ -169,7 +169,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --let IBD_CHAR_LEN= 8 --source include/corrupt_ibd2sdi.inc ---exec $IBD2SDI $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE 2>&1 # Restore original copy --remove_file $IBD_FILE @@ -187,7 +187,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --replace_regex /into file.*\./into file: FILENAME/ --error 1 ---exec $IBD2SDI -n $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty -n $IBD_FILE 2>&1 # Restore original copy --remove_file $IBD_FILE @@ -205,12 +205,12 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --replace_regex /into file.*\./into file: FILENAME/ --error 1 ---exec $IBD2SDI -n $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty -n $IBD_FILE 2>&1 --echo # Retrieve from .ibd file --replace_regex /space=[0-9]*/space=X/ --error 1 ---exec $IBD2SDI $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE 2>&1 # Restore original copy --remove_file $IBD_FILE @@ -226,7 +226,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --replace_regex /into file.*\./into file: FILENAME/ --error 1 ---exec $IBD2SDI $IBD_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE 2>&1 # Restore original copy --remove_file $IBD_FILE @@ -250,7 +250,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --replace_regex /into file.*\./into file: FILENAME/ --error 1 ---exec $IBD2SDI $IBD_FILE -n -d $DUMP_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1 --cat_file $DUMP_FILE # Restore original copy @@ -265,7 +265,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --let IBD_CHAR_LEN = 4 --source include/corrupt_ibd2sdi.inc ---exec $IBD2SDI $IBD_FILE -n -d $DUMP_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1 --cat_file $DUMP_FILE # Restore original copy @@ -280,7 +280,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --let IBD_CHAR_LEN = 4 --source include/corrupt_ibd2sdi.inc ---exec $IBD2SDI $IBD_FILE -n -d $DUMP_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1 --cat_file $DUMP_FILE # Restore original copy @@ -295,7 +295,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --let IBD_OFFSET = 110 --source include/corrupt_ibd2sdi.inc ---exec $IBD2SDI $IBD_FILE -n -d $DUMP_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1 --cat_file $DUMP_FILE # Restore original copy @@ -309,7 +309,7 @@ let MEMCACHED_TABLE_MAPPING = desc_t3; --let IBD_OFFSET = 54 --source include/corrupt_ibd2sdi.inc ---exec $IBD2SDI $IBD_FILE -n -d $DUMP_FILE 2>&1 +--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1 --cat_file $DUMP_FILE # Restore original copy diff --git a/utilities/ibd2sdi.cc b/utilities/ibd2sdi.cc index 15d733d1f83b..ef8e96c19f3f 100644 --- a/utilities/ibd2sdi.cc +++ b/utilities/ibd2sdi.cc @@ -174,6 +174,7 @@ struct sdi_options { const char *dbug_setting; char *dump_filename; ulong strict_check; + bool pretty; }; struct sdi_options opts; @@ -217,6 +218,10 @@ static struct my_option ibd2sdi_options[] = { GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"no-check", 'n', "Ignore the checksum verification.", &opts.no_checksum, &opts.no_checksum, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"pretty", 'p', + "Pretty format the SDI output." + "If false, SDI would be not human readable but it will be of less size", + &opts.pretty, &opts.pretty, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}}; @@ -335,6 +340,8 @@ extern "C" bool ibd2sdi_get_one_option( case 'n': opts.no_checksum = true; break; + case 'p': + break; case 'h': usage(); exit(EXIT_SUCCESS); @@ -1658,7 +1665,7 @@ uint64_t ibd2sdi::copy_compressed_blob(ib_tablespace *ts, if (next_page_num == FIL_NULL) { goto func_exit; } - /* fall through */ + /* fall through */ default: inflate_error : { page_id_t page_id(space_id, page_num); @@ -2032,11 +2039,25 @@ void ibd2sdi::dump_sdi_rec(uint64_t sdi_type, uint64_t sdi_id, byte *sdi_data, fprintf(out_stream, "\t\t"); char *sdi = reinterpret_cast(sdi_data); - rapidjson::Document d; - d.Parse(sdi); - rapidjson::FileWriteStream os(out_stream, sdi, sdi_data_len); - rapidjson::PrettyWriter writer(os); - d.Accept(writer); + if (opts.pretty) { + rapidjson::Document d; + + rapidjson::ParseResult ok = d.Parse(sdi); + if (!ok) { + std::cerr << "JSON parse error: " + << rapidjson::GetParseError_En(ok.Code()) << " (offset " + << ok.Offset() << ")" + << " sdi: " << sdi << std::endl; + exit(1); + } + + rapidjson::StringBuffer _b; + rapidjson::PrettyWriter writer(_b); + d.Accept(writer); + fprintf(out_stream, "%s", _b.GetString()); + } else { + fwrite(sdi_data, 1, static_cast(sdi_data_len - 1), out_stream); + } } fprintf(out_stream, "\n}\n");