• marko's avatar
    branches/zip: Implement ROW_FORMAT=COMPRESSED and ROW_FORMAT=DYNAMIC. · 7afea563
    marko authored
    Throw warnings, not errors for wrong ROW_FORMAT or KEY_BLOCK_SIZE,
    so that any table dump can be loaded.
    
    As of this change, InnoDB supports the following table formats:
    
    ROW_FORMAT=REDUNDANT
    	the only format before MySQL/InnoDB 5.0.3
    ROW_FORMAT=COMPACT
    	the new default format of MySQL/InnoDB 5.0.3
    ROW_FORMAT=DYNAMIC
    	uncompressed, no prefix in the clustered index record for BLOBs
    ROW_FORMAT=COMPRESSED
    	like ROW_FORMAT=DYNAMIC, but zlib compressed B-trees and BLOBs;
    	the compressed page size is specified by KEY_BLOCK_SIZE in
    	kilobytes (1, 2, 4, 8, or 16; default 8)
    
    KEY_BLOCK_SIZE=1, 2, 4, 8, or 16: implies ROW_FORMAT=COMPRESSED;
    ignored if ROW_FORMAT is not COMPRESSED
    
    KEY_BLOCK_SIZE=anything else: ignored
    
    The InnoDB row format is displayed in the 4th column (Row_format) of
    the output of SHOW TABLE STATUS.  The Create_options column may show
    ROW_FORMAT= and KEY_BLOCK_SIZE=, but they do not necessarily have
    anything to do with InnoDB.
    
    The table format can also be queried like this:
    
    SELECT table_schema, table_name, row_format
    FROM information_schema.tables
    WHERE engine='innodb' and row_format in ('Compressed','Dynamic');
    
    When Row_format='Compressed', KEY_BLOCK_SIZE should usually correspond
    to the compressed page size.  But the .frm file could be manipulated
    to show any KEY_BLOCK_SIZE.
    
    For some reason, INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS does not
    include KEY_BLOCK_SIZE.  It does include row_format (spelled in
    lowercase).  This looks like a MySQL bug, because the table
    INFORMATION_SCHEMA.TABLES probably tries to replace SHOW TABLE STATUS.
    I reported this as Bug #35275 <http://bugs.mysql.com/35275>.
    
    ha_innobase::get_row_type(): Add ROW_TYPE_COMPRESSED, ROW_TYPE_DYNAMIC.
    
    ha_innobase::create(): Implement ROW_FORMAT=COMPRESSED and
    ROW_FORMAT=DYNAMIC.  Do not throw errors for wrong ROW_FORMAT or
    KEY_BLOCK_SIZE, but issue warnings instead.
    
    ha_innobase::check_if_incompatible_data(): Return COMPATIBLE_DATA_NO
    if KEY_BLOCK_SIZE has been specified.
    
    innodb.result: Adjust the result for the warning issued for ROW_FORMAT=FIXED.
    
    innodb-zip.test: Add tests.  Query INFORMATION_SCHEMA.TABLES for ROW_FORMAT.
    7afea563
innodb.result 94.3 KB