# # Test for IBD2SDI tool # # restart: --datadir=MYSQLD_DATADIR1 --innodb_data_file_path=ibdata1:16M;ibdata2:20M:autoextend --innodb_log_file_size=15M --innodb_log_files_in_group=2 set global innodb_limit_optimistic_insert_debug = 2; INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only', 'innodb_only', 'innodb_only', 'innodb_only'); INSERT INTO config_options VALUES('separator', '|'); INSERT INTO containers VALUES ('desc_t1', 'test', 't1', 'c1', 'c2', '0', '0', '0', 'PRIMARY'); USE test; # ---------------------------------------------- # Case 1: Insert small SDI in uncompressed table # ---------------------------------------------- SET GLOBAL innodb_file_per_table=OFF; CREATE TABLE t1(c1 VARCHAR(32), c2 TEXT, primary key(c1)) ENGINE = INNODB; SET GLOBAL innodb_file_per_table=ON; CREATE TABLE t2(a INT) ENGINE = INNODB; SET GLOBAL innodb_file_per_table=OFF; INSTALL PLUGIN daemon_memcached SONAME 'libmemcached.so'; # check if ibdata* exist # Section I: Test options # 1. Read SDI with long option ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } , { "type": 1, "id": 0, "object": Test10 } , { "type": 2, "id": 0, "object": Test20 } , { "type": 3, "id": 0, "object": Test30 } , { "type": 3, "id": 1, "object": Test31 } , { "type": 3, "id": 2, "object": Test32 } , { "type": 3, "id": 3, "object": Test33 } , { "type": 3, "id": 4, "object": Test34 } , { "type": 3, "id": 5, "object": Test35 } , { "type": 4, "id": 4, "object": Test44 } , { "type": 5, "id": 0, "object": Test50 } ] # 3. Read with specific id & type (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": Test33 } ] # 4. Read with specific id & type (short option) ["ibd2sdi" , { "type": 4, "id": 4, "object": Test44 } ] # 5. Read with skip data ["ibd2sdi" , { "type": 0, "id": 0 } , { "type": 1, "id": 0 } , { "type": 2, "id": 0 } , { "type": 3, "id": 0 } , { "type": 3, "id": 1 } , { "type": 3, "id": 2 } , { "type": 3, "id": 3 } , { "type": 3, "id": 4 } , { "type": 3, "id": 5 } , { "type": 4, "id": 4 } , { "type": 5, "id": 0 } ] ["ibd2sdi" , { "type": 0, "id": 0 } , { "type": 1, "id": 0 } , { "type": 2, "id": 0 } , { "type": 3, "id": 0 } , { "type": 3, "id": 1 } , { "type": 3, "id": 2 } , { "type": 3, "id": 3 } , { "type": 3, "id": 4 } , { "type": 3, "id": 5 } , { "type": 4, "id": 4 } , { "type": 5, "id": 0 } ] # 6. Read SDI and dump into FILE ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } , { "type": 1, "id": 0, "object": Test10 } , { "type": 2, "id": 0, "object": Test20 } , { "type": 3, "id": 0, "object": Test30 } , { "type": 3, "id": 1, "object": Test31 } , { "type": 3, "id": 2, "object": Test32 } , { "type": 3, "id": 3, "object": Test33 } , { "type": 3, "id": 4, "object": Test34 } , { "type": 3, "id": 5, "object": Test35 } , { "type": 4, "id": 4, "object": Test44 } , { "type": 5, "id": 0, "object": Test50 } ] # 7. Read SDI and dump into FILE using short option ["ibd2sdi" , { "type": 0, "id": 0 } , { "type": 1, "id": 0 } , { "type": 2, "id": 0 } , { "type": 3, "id": 0 } , { "type": 3, "id": 1 } , { "type": 3, "id": 2 } , { "type": 3, "id": 3 } , { "type": 3, "id": 4 } , { "type": 3, "id": 5 } , { "type": 4, "id": 4 } , { "type": 5, "id": 0 } ] # 8. Print all records matching type (short option) ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] # 9. Print all records matching id (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": Test33 } ] # 10. Print version IBD2SDI Ver #.#.# # 11. Print help IBD2SDI Ver #.#.# Copyright (c) YEAR, YEAR, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] 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 Dump the tablespace SDI into the file passed by user. Without the filename, it will default to stdout -s, --skip-data Skip retrieving data from SDI records. Retrieve only id and type. -i, --id=# Retrieve the SDI record matching the id passed by user. -t, --type=# Retrieve the SDI records matching the type passed by user. -c, --strict-check=name 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) --------------------------------- ---------------------------------------- dump-file (No default value) skip-data FALSE id 0 type 0 strict-check crc32 no-check FALSE pretty TRUE # 12. Print all records ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } , { "type": 1, "id": 0, "object": Test10 } , { "type": 2, "id": 0, "object": Test20 } , { "type": 3, "id": 0, "object": Test30 } , { "type": 3, "id": 1, "object": Test31 } , { "type": 3, "id": 2, "object": Test32 } , { "type": 3, "id": 3, "object": Test33 } , { "type": 3, "id": 4, "object": Test34 } , { "type": 3, "id": 5, "object": Test35 } , { "type": 4, "id": 4, "object": Test44 } , { "type": 5, "id": 0, "object": Test50 } ] # 13. Retrieve explicit id & type ["ibd2sdi" , { "type": 3, "id": 3, "object": Test33 } ] # 14. Skip data and retrieve ["ibd2sdi" , { "type": 0, "id": 0 } , { "type": 1, "id": 0 } , { "type": 2, "id": 0 } , { "type": 3, "id": 0 } , { "type": 3, "id": 1 } , { "type": 3, "id": 2 } , { "type": 3, "id": 3 } , { "type": 3, "id": 4 } , { "type": 3, "id": 5 } , { "type": 4, "id": 4 } , { "type": 5, "id": 0 } ] # 15. Dump all records into outfile ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } , { "type": 1, "id": 0, "object": Test10 } , { "type": 2, "id": 0, "object": Test20 } , { "type": 3, "id": 0, "object": Test30 } , { "type": 3, "id": 1, "object": Test31 } , { "type": 3, "id": 2, "object": Test32 } , { "type": 3, "id": 3, "object": Test33 } , { "type": 3, "id": 4, "object": Test34 } , { "type": 3, "id": 5, "object": Test35 } , { "type": 4, "id": 4, "object": Test44 } , { "type": 5, "id": 0, "object": Test50 } ] # 16. Print all records matching type (short option) ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] # 17. Print all records matching id (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": Test33 } ] # 18. Pass --no-check & --strict-check together [ERROR] ibd2sdi: Invalid combination of options. Cannot use --no-check & --strict-check together. ibd2sdi: [ERROR] Unknown suffix '@' used for variable 'type' (value '@'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '@' to 'type'. ibd2sdi: [ERROR] IBD2SDI: option '-t' requires an argument. ibd2sdi: [ERROR] Unknown suffix '=' used for variable 'type' (value '='). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '=' to 'type'. # 22. Test --type option with # 22.1 non numeric/Alphanumeric ibd2sdi: [ERROR] Unknown suffix 'a' used for variable 'type' (value 'a'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value 'a' to 'type'. ibd2sdi: [ERROR] Unknown suffix 'b' used for variable 'type' (value 'b'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value 'b' to 'type'. # 22.2 numbers with +/- ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] ibd2sdi: [Warning] option 'type': value -0 adjusted to 0. ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] ["ibd2sdi" , { "type": 1, "id": 0, "object": Test10 } ] ibd2sdi: [Warning] option 'type': value -1 adjusted to 0. ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] ibd2sdi: [Warning] option 'type': value -15 adjusted to 0. ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] ["ibd2sdi" ] # 22.4 with no permitted values ["ibd2sdi" ] ibd2sdi: [Warning] option 'type': value -14 adjusted to 0. ["ibd2sdi" , { "type": 0, "id": 0, "object": Test00 } ] # 22.5 with very long value ibd2sdi: [ERROR] Incorrect unsigned integer value: '14324932470234893204293032'. ibd2sdi: [ERROR] IBD2SDI: Error while setting value '14324932470234893204293032' to 'type'. # 22.6 with blank value ibd2sdi: [ERROR] IBD2SDI: Empty value for 'type' specified. # 22.7 value with spaces ibd2sdi: [ERROR] IBD2SDI: Empty value for 'type' specified. # 23. Test for reading form more than type example (invalid): -t 0,1 ibd2sdi: [ERROR] Unknown suffix ',' used for variable 'type' (value '0,1'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '0,1' to 'type'. ibd2sdi: [ERROR] Unknown suffix ',' used for variable 'type' (value '2,3'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '2,3' to 'type'. # 24. With misspelled --type ibd2sdi: [ERROR] unknown variable 'tpe=0'. # 25. With Invalid file types # 25.1 With non IBD file [ERROR] ibd2sdi: Unable to read the page header of 1024 bytes. [ERROR] ibd2sdi: Bytes read was 5. # 25.2 with non existant file [ERROR] ibd2sdi: Unable to get file stats non_existant_file.txt. [ERROR] ibd2sdi: File doesn't exist. # 25.3 with empty file [ERROR] ibd2sdi: Unable to read the page header of 1024 bytes. [ERROR] ibd2sdi: Bytes read was 0. [ERROR] ibd2sdi: The first page num 0 of this datafile MYSQLD_DATADIR1/ibdata1 is not equal to last page num 1023 + 1 of previous data file. Skipping this tablespace. [ERROR] ibd2sdi: Multiple tablespaces passed. Please specify only one tablespace. # restart: --datadir=MYSQLD_DATADIR1 --innodb_data_file_path=ibdata1:16M;ibdata2:20M:autoextend --innodb_log_file_size=15M --innodb_log_files_in_group=2 DROP TABLE t2; SET GLOBAL innodb_limit_optimistic_insert_debug = default; # ---------------------------------------------- # Case 2: Insert large SDI in uncompressed table # ---------------------------------------------- # Section I: Test options # 1. Read SDI with long option # 3. Read with specific id & type (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz } ] # 4. Read with specific id & type (short option) # 5. Read with skip data # 6. Read SDI and dump into FILE # 7. Read SDI and dump into FILE using short option # 8. Print all records matching type (short option) # 9. Print all records matching id (long option) # 10. Print version IBD2SDI Ver #.#.# # 11. Print help IBD2SDI Ver #.#.# Copyright (c) YEAR, YEAR, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] 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 Dump the tablespace SDI into the file passed by user. Without the filename, it will default to stdout -s, --skip-data Skip retrieving data from SDI records. Retrieve only id and type. -i, --id=# Retrieve the SDI record matching the id passed by user. -t, --type=# Retrieve the SDI records matching the type passed by user. -c, --strict-check=name 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) --------------------------------- ---------------------------------------- dump-file (No default value) skip-data FALSE id 0 type 0 strict-check crc32 no-check FALSE pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" , { "type": 3, "id": 3, "object": abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz } ] # 14. Skip data and retrieve # 15. Dump all records into outfile # 16. Print all records matching type (short option) ["ibd2sdi" , { "type": 0, "id": 0, "object": abcdefghijklmnopqrstuvwxyz } ] # 17. Print all records matching id (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz } ] # 18. Pass --no-check & --strict-check together [ERROR] ibd2sdi: Invalid combination of options. Cannot use --no-check & --strict-check together. ibd2sdi: [ERROR] Unknown suffix '@' used for variable 'type' (value '@'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '@' to 'type'. ibd2sdi: [ERROR] IBD2SDI: option '-t' requires an argument. ibd2sdi: [ERROR] Unknown suffix '=' used for variable 'type' (value '='). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '=' to 'type'. # 22. Test --type option with # 22.1 non numeric/Alphanumeric ibd2sdi: [ERROR] Unknown suffix 'a' used for variable 'type' (value 'a'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value 'a' to 'type'. ibd2sdi: [ERROR] Unknown suffix 'b' used for variable 'type' (value 'b'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value 'b' to 'type'. # 22.2 numbers with +/- # 22.4 with no permitted values # 22.5 with very long value ibd2sdi: [ERROR] Incorrect unsigned integer value: '14324932470234893204293032'. ibd2sdi: [ERROR] IBD2SDI: Error while setting value '14324932470234893204293032' to 'type'. # 22.6 with blank value ibd2sdi: [ERROR] IBD2SDI: Empty value for 'type' specified. # 22.7 value with spaces ibd2sdi: [ERROR] IBD2SDI: Empty value for 'type' specified. # 23. Test for reading form more than type example (invalid): -t 0,1 ibd2sdi: [ERROR] Unknown suffix ',' used for variable 'type' (value '0,1'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '0,1' to 'type'. ibd2sdi: [ERROR] Unknown suffix ',' used for variable 'type' (value '2,3'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '2,3' to 'type'. # 24. With misspelled --type ibd2sdi: [ERROR] unknown variable 'tpe=0'. # 25. With Invalid file types # 25.1 With non IBD file [ERROR] ibd2sdi: Unable to read the page header of 1024 bytes. [ERROR] ibd2sdi: Bytes read was 5. # 25.2 with non existant file [ERROR] ibd2sdi: Unable to get file stats non_existant_file.txt. [ERROR] ibd2sdi: File doesn't exist. # 25.3 with empty file [ERROR] ibd2sdi: Unable to read the page header of 1024 bytes. [ERROR] ibd2sdi: Bytes read was 0. # # Bug#23036141 - IBD2SDI DOESN'T WORK IF ANY DATAFILE IS SMALLER THAN PREVIOUS DATAFILE # # restart: --datadir=MYSQLD_DATADIR1 --innodb_data_file_path=ibdata1:16M;ibdata2:2M:autoextend --innodb_log_file_size=15M --innodb_log_files_in_group=2 INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only', 'innodb_only', 'innodb_only', 'innodb_only'); INSERT INTO config_options VALUES('separator', '|'); INSERT INTO containers VALUES ('desc_t1', 'test', 't1', 'c1', 'c2', '0', '0', '0', 'PRIMARY'); SET GLOBAL innodb_file_per_table=OFF; USE test; CREATE TABLE t1(c1 VARCHAR(32), c2 TEXT, primary key(c1)) ENGINE = INNODB; INSTALL PLUGIN daemon_memcached SONAME 'libmemcached.so'; # Section I: Test options # 1. Read SDI with long option # 3. Read with specific id & type (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz } ] # 4. Read with specific id & type (short option) # 5. Read with skip data # 6. Read SDI and dump into FILE # 7. Read SDI and dump into FILE using short option # 8. Print all records matching type (short option) # 9. Print all records matching id (long option) # 10. Print version IBD2SDI Ver #.#.# # 11. Print help IBD2SDI Ver #.#.# Copyright (c) YEAR, YEAR, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. IBD2SDI [-v] [-c ] [-d ] [-n] filename1 [filenames] 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 Dump the tablespace SDI into the file passed by user. Without the filename, it will default to stdout -s, --skip-data Skip retrieving data from SDI records. Retrieve only id and type. -i, --id=# Retrieve the SDI record matching the id passed by user. -t, --type=# Retrieve the SDI records matching the type passed by user. -c, --strict-check=name 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) --------------------------------- ---------------------------------------- dump-file (No default value) skip-data FALSE id 0 type 0 strict-check crc32 no-check FALSE pretty TRUE # 12. Print all records # 13. Retrieve explicit id & type ["ibd2sdi" , { "type": 3, "id": 3, "object": abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz } ] # 14. Skip data and retrieve # 15. Dump all records into outfile # 16. Print all records matching type (short option) ["ibd2sdi" , { "type": 0, "id": 0, "object": abcdefghijklmnopqrstuvwxyz } ] # 17. Print all records matching id (long option) ["ibd2sdi" , { "type": 3, "id": 3, "object": abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz } ] # 18. Pass --no-check & --strict-check together [ERROR] ibd2sdi: Invalid combination of options. Cannot use --no-check & --strict-check together. ibd2sdi: [ERROR] Unknown suffix '@' used for variable 'type' (value '@'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '@' to 'type'. ibd2sdi: [ERROR] IBD2SDI: option '-t' requires an argument. ibd2sdi: [ERROR] Unknown suffix '=' used for variable 'type' (value '='). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '=' to 'type'. # 22. Test --type option with # 22.1 non numeric/Alphanumeric ibd2sdi: [ERROR] Unknown suffix 'a' used for variable 'type' (value 'a'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value 'a' to 'type'. ibd2sdi: [ERROR] Unknown suffix 'b' used for variable 'type' (value 'b'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value 'b' to 'type'. # 22.2 numbers with +/- # 22.4 with no permitted values # 22.5 with very long value ibd2sdi: [ERROR] Incorrect unsigned integer value: '14324932470234893204293032'. ibd2sdi: [ERROR] IBD2SDI: Error while setting value '14324932470234893204293032' to 'type'. # 22.6 with blank value ibd2sdi: [ERROR] IBD2SDI: Empty value for 'type' specified. # 22.7 value with spaces ibd2sdi: [ERROR] IBD2SDI: Empty value for 'type' specified. # 23. Test for reading form more than type example (invalid): -t 0,1 ibd2sdi: [ERROR] Unknown suffix ',' used for variable 'type' (value '0,1'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '0,1' to 'type'. ibd2sdi: [ERROR] Unknown suffix ',' used for variable 'type' (value '2,3'). ibd2sdi: [ERROR] IBD2SDI: Error while setting value '2,3' to 'type'. # 24. With misspelled --type ibd2sdi: [ERROR] unknown variable 'tpe=0'. # 25. With Invalid file types # 25.1 With non IBD file [ERROR] ibd2sdi: Unable to read the page header of 1024 bytes. [ERROR] ibd2sdi: Bytes read was 5. # 25.2 with non existant file [ERROR] ibd2sdi: Unable to get file stats non_existant_file.txt. [ERROR] ibd2sdi: File doesn't exist. # 25.3 with empty file [ERROR] ibd2sdi: Unable to read the page header of 1024 bytes. [ERROR] ibd2sdi: Bytes read was 0. # restart