1. 13 Jan, 2009 1 commit
    • marko's avatar
      branches/zip: In hash table lookups, assert that the traversed items · 2f7bcc7d
      marko authored
      satisfy some conditions when UNIV_DEBUG is defined.
      
      HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
      ut_ad() or nothing.
      
      dict_table_add_to_columns(): Assert that the table being added to the data
      dictionary cache is not already being pointed to by the name_hash and
      id_hash tables.
      
      HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
      
      dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
      check ut_ad(table->cached) when traversing the hash tables, as in
      HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
      HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
      
      dict_table_get_low(), dict_table_get_on_id_low(): Assert
      ut_ad(!table || table->cached).
      
      fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
      in HASH_SEARCH(hash, fil_system->spaces, ...).
      
      fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
      in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
      
      buf_buddy_block_free(): Check that the blocks are in valid state in
      HASH_SEARCH(hash, buf_pool->zip_hash, ...).
      
      buf_page_hash_get(): Check that the blocks are in valid state in
      HASH_SEARCH(hash, buf_pool->page_hash, ...).
      
      get_share(), free_share(): Check ut_ad(share->use_count > 0) in
      HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
      
      This was posted as rb://75 for tracking down errors similar to Issue #153.
      2f7bcc7d
  2. 31 Oct, 2008 1 commit
    • sunny's avatar
      branches/zip: · 7fed1c70
      sunny authored
        1. We add a vector of locks to trx_t. This array contains the autoinc
        locks granted to a transaction. There is one per table.
      
        2. We enforce releasing of these locks in the reverse order from the
        one in which they are acquired. The assumption is that since the
        AUTOINC locks are statement level locks. Nested statements introduced
        by triggers are stacked it should hold.
      
      There was some cleanup done to the vector code too by adding const and
      some new functions. Rename dict_table_t::auto_inc_lock to autoinc_lock.
      
      Fix Bug#26316 Triggers create duplicate entries on auto-increment columns
      rb://22
      7fed1c70
  3. 23 Oct, 2008 1 commit
    • sunny's avatar
      branches/zip: · 119142d2
      sunny authored
      Merge revisions 2852:2854 from branches/5.1:
      
        ------------------------------------------------------------------------
        r2854 | sunny | 2008-10-23 08:30:32 +0300 (Thu, 23 Oct 2008) | 13 lines
        Changed paths:
           M /branches/5.1/dict/dict0dict.c
           M /branches/5.1/dict/dict0mem.c
           M /branches/5.1/handler/ha_innodb.cc
           M /branches/5.1/handler/ha_innodb.h
           M /branches/5.1/include/dict0dict.h
           M /branches/5.1/include/dict0mem.h
           M /branches/5.1/row/row0mysql.c
        
        branches/5.1: Backport changes from branches/zip r2725
        
        Simplify the autoinc initialization code. This removes the
        non-determinism related to reading the table's autoinc value for the first
        time. This change has also reduced the sizeof dict_table_t by sizeof(ibool)
        bytes because we don't need the dict_table_t::autoinc_inited field anymore.
        
        Bug#39830 Table autoinc value not updated on first insert.
        Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info
        Bug#36411 Failed to read auto-increment value from storage engine" in 5.1.24 auto-inc
        rb://16
        
        
        ------------------------------------------------------------------------
      119142d2
  4. 04 Oct, 2008 1 commit
    • sunny's avatar
      branches/zip: Merge revisions 2702:2722 from branches/5.1: · cb0cacc2
      sunny authored
        ------------------------------------------------------------------------
        r2702 | sunny | 2008-09-30 11:41:56 +0300 (Tue, 30 Sep 2008) | 13 lines
        Changed paths:
           M /branches/5.1/handler/ha_innodb.cc
        
        branches/5.1: Since handler::get_auto_increment() doesn't allow us
        to return the cause of failure we have to inform MySQL using the
        sql_print_warning() function to return the cause for autoinc failure.
        Previously we simply printed the error code, this patch prints the
        text string representing the following two error codes:
        
        DB_LOCK_WAIT_TIMEOUT
        DB_DEADLOCK.
        
        Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info
        
        Approved by Marko.
        
        ------------------------------------------------------------------------
        r2709 | vasil | 2008-10-01 10:13:13 +0300 (Wed, 01 Oct 2008) | 10 lines
        Changed paths:
           M /branches/5.1/include/lock0lock.h
           M /branches/5.1/lock/lock0lock.c
           A /branches/5.1/mysql-test/innodb_bug38231.result
           A /branches/5.1/mysql-test/innodb_bug38231.test
           M /branches/5.1/row/row0mysql.c
        
        branches/5.1:
        
        Fix Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
        
        In TRUNCATE TABLE and discard tablespace: do not remove table-level S
        and X locks and do not assert on such locks not being wait locks.
        Leave such locks alone.
        
        Approved by:	Heikki (rb://14)
        
        ------------------------------------------------------------------------
        r2710 | vasil | 2008-10-01 14:13:58 +0300 (Wed, 01 Oct 2008) | 6 lines
        Changed paths:
           M /branches/5.1/include/sync0sync.ic
        
        branches/5.1:
        
        Silence a compilation warning in UNIV_DEBUG.
        
        Approved by:	Marko (via IM)
        
        ------------------------------------------------------------------------
        r2719 | vasil | 2008-10-03 18:17:28 +0300 (Fri, 03 Oct 2008) | 49 lines
        Changed paths:
           M /branches/5.1/handler/ha_innodb.cc
           A /branches/5.1/mysql-test/innodb_bug39438-master.opt
           A /branches/5.1/mysql-test/innodb_bug39438.result
           A /branches/5.1/mysql-test/innodb_bug39438.test
        
        branches/5.1:
        
        Fix Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
        
        In ha_innobase::info() - do not try to get the free space for a tablespace
        which has been discarded with ALTER TABLE ... DISCARD TABLESPACE or if the
        .ibd file is missing for some other reason.
        
        ibd_file_missing and tablespace_discarded are manipulated only in
        row_discard_tablespace_for_mysql() and in row_import_tablespace_for_mysql()
        and the manipulation is protected/surrounded by
        row_mysql_lock_data_dictionary()/row_mysql_unlock_data_dictionary() thus we
        do the same in ha_innobase::info() when checking the values of those members
        to avoid race conditions. I have tested the code-path with UNIV_DEBUG and
        UNIV_SYNC_DEBUG.
        
        Looks like it is not possible to avoid mysqld printing warnings in the
        mysql-test case and thus this test innodb_bug39438 must be added to the
        list of exceptional test cases that are allowed to print warnings. For this,
        the following patch must be applied to the mysql source tree:
        
          --- cut ---
          === modified file 'mysql-test/lib/mtr_report.pl'
          --- mysql-test/lib/mtr_report.pl	2008-08-12 10:26:23 +0000
          +++ mysql-test/lib/mtr_report.pl	2008-10-01 11:57:41 +0000
          @@ -412,7 +412,10 @@
           
                           # When trying to set lower_case_table_names = 2
                           # on a case sensitive file system. Bug#37402.
          -                /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive.  Now setting lower_case_table_names to 0 to avoid future problems./
          +                /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive.  Now setting lower_case_table_names to 0 to avoid future problems./ or
          +
          +                # this test is expected to print warnings
          +                ($testname eq 'main.innodb_bug39438')
           		)
                       {
                         next;                       # Skip these lines
          
          --- cut ---
        
        The mysql-test is currently somewhat disabled (see inside
        innodb_bug39438.test), after the above patch has been applied to the mysql
        source tree, the test can be enabled.
        
        rb://20
        
        Reviewed by:	Inaam, Calvin
        Approved by:	Heikki
        
        ------------------------------------------------------------------------
        r2720 | vasil | 2008-10-03 19:52:39 +0300 (Fri, 03 Oct 2008) | 8 lines
        Changed paths:
           M /branches/5.1/handler/ha_innodb.cc
        
        branches/5.1:
        
        Print a warning if an attempt is made to get the free space for a table
        whose .ibd file is missing or the tablespace has been discarded. This is a
        followup to r2719.
        
        Suggested by:	Inaam
        
        ------------------------------------------------------------------------
        r2721 | sunny | 2008-10-04 02:08:23 +0300 (Sat, 04 Oct 2008) | 6 lines
        Changed paths:
           M /branches/5.1/handler/ha_innodb.cc
        
        branches/5.1: We need to send the messages to the client because
        handler::get_auto_increment() doesn't allow a way to return the
        specific error for why it failed.
        
        rb://18
        
        ------------------------------------------------------------------------
        r2722 | sunny | 2008-10-04 02:48:04 +0300 (Sat, 04 Oct 2008) | 18 lines
        Changed paths:
           M /branches/5.1/dict/dict0mem.c
           M /branches/5.1/handler/ha_innodb.cc
           M /branches/5.1/include/dict0mem.h
           M /branches/5.1/include/row0mysql.h
           M /branches/5.1/mysql-test/innodb-autoinc.result
           M /branches/5.1/mysql-test/innodb-autoinc.test
           M /branches/5.1/row/row0mysql.c
        
        branches/5.1: This bug has always existed but was masked by other errors. The
        fix for bug# 38839 triggered this bug. When the offset and increment are > 1
        we need to calculate the next value taking into consideration the two
        variables. Previously we simply assumed they were 1 particularly offset was
        never used. MySQL does its own calculation and that's probably why it seemed
        to work in the past. We would return what we thought was the correct next
        value and then MySQL would recalculate the actual value from that and return
        it to the caller (e.g., handler::write_row()). Several new tests have been
        added that try and catch some edge cases. The tests exposed a wrap around
        error in MySQL next value calculation which was filed as bug#39828. The tests
        will need to be updated once MySQL fix that bug.
        
        One good side effect of this fix is that dict_table_t size has been
        reduced by 8 bytes because we have moved the autoinc_increment field to
        the row_prebuilt_t structure. See review-board for a detailed discussion.
        
        rb://3
        
        ------------------------------------------------------------------------
      cb0cacc2
  5. 10 Mar, 2008 1 commit
    • marko's avatar
      branches/zip: Implement the configuration parameter and settable global · 86361e03
      marko authored
      variable innodb_file_format.  Implement file format version stamping of
      *.ibd files and SYS_TABLES.TYPE.
      
      This change breaks introduces an incompatible change for for
      compressed tables.  We can do this, as we have not released yet.
      
      innodb-zip.test: Add tests for stricter KEY_BLOCK_SIZE and ROW_FORMAT
      checks.
      
      DICT_TF_COMPRESSED_MASK, DICT_TF_COMPRESSED_SHIFT: Replace with
      DICT_TF_ZSSIZE_MASK, DICT_TF_ZSSIZE_SHIFT.
      
      DICT_TF_FORMAT_MASK, DICT_TF_FORMAT_SHIFT, DICT_TF_FORMAT_51,
      DICT_TF_FORMAT_ZIP: File format version, stored in table->flags,
      in the .ibd file header, and in SYS_TABLES.TYPE.
      
      dict_create_sys_tables_tuple(): Write the table flags to SYS_TABLES.TYPE
      if the format is at least DICT_TF_FORMAT_ZIP.  For old formats
      (DICT_TF_FORMAT_51), write DICT_TABLE_ORDINARY as the table type.
      
      DB_TABLE_ZIP_NO_IBD: Remove the error code.  The error handling is done
      in ha_innodb.cc; as a failsafe measure, dict_build_table_def_step() will
      silently clear the compression and format flags instead of returning this
      error.
      
      dict_mem_table_create(): Assert that no extra bits are set in the flags.
      
      dict_sys_tables_get_zip_size(): Rename to dict_sys_tables_get_flags().
      Check all flag bits, and return ULINT_UNDEFINED if the combination is
      unsupported.
      
      dict_boot(): Document the SYS_TABLES columns N_COLS and TYPE.
      
      dict_table_get_format(), dict_table_set_format(),
      dict_table_flags_to_zip_size(): New accessors to table->flags.
      
      dtuple_convert_big_rec(): Introduce the auxiliary variables
      local_len, local_prefix_len.  Store a 768-byte prefix locally
      if the file format is less than DICT_TF_FORMAT_ZIP.
      
      dtuple_convert_back_big_rec(): Restore the columns.
      
      srv_file_format: New variable: innodb_file_format.
      
      fil_create_new_single_table_tablespace(): Replace the parameter zip_size
      with table->flags.
      
      fil_open_single_table_tablespace(): Replace the parameter zip_size_in_k
      with table->flags.  Check the flags.
      
      fil_space_struct, fil_space_create(), fil_op_write_log():
      Replace zip_size with flags.
      
      fil_node_open_file(): Note a TODO item for InnoDB Hot Backup.
      Check that the tablespace flags match.
      
      fil_space_get_zip_size(): Rename to fil_space_get_flags().  Add a
      wrapper for fil_space_get_zip_size().
      
      fsp_header_get_flags(): New function.
      
      fsp_header_init_fields(): Replace zip_size with flags.
      
      FSP_SPACE_FLAGS: New name for the tablespace flags.  This field used
      to be called FSP_PAGE_ZIP_SIZE, or FSP_LOWEST_NO_WRITE.  It has always
      been written as 0 in MySQL/InnoDB versions 4.1 to 5.1.
      
      MLOG_ZIP_FILE_CREATE: Rename to MLOG_FILE_CREATE2.  Add a 32-bit
      parameter for the tablespace flags.
      
      ha_innobase::create(): Check the table attributes ROW_FORMAT and
      KEY_BLOCK_SIZE.  Issue errors if they are inappropriate, or warnings
      if the inherited attributes (in ALTER TABLE) will be ignored.
      
      PAGE_ZIP_MIN_SIZE_SHIFT: New constant: the 2-logarithm of PAGE_ZIP_MIN_SIZE.
      86361e03
  6. 06 Feb, 2008 1 commit
    • marko's avatar
      branches/zip: Introduce UNIV_INTERN, a linkage specifier for InnoDB-global · 2c2b06ad
      marko authored
      symbols.  Use it for all definitions of non-static variables and functions.
      
      lexyy.c, make_flex.sh: Declare yylex as UNIV_INTERN, not static.  It is
      referenced from pars0grm.c.
      
      Actually, according to
      	nm .libs/ha_innodb.so|grep -w '[ABCE-TVXYZ]'
      the following symbols are still global:
      
      * The vtable for class ha_innodb
      * pars0grm.c: The function yyparse() and the variables yychar, yylval, yynerrs
      
      The required changes to the Bison-generated file pars0grm.c will be addressed
      in a separate commit, which will add a script similar to make_flex.sh.
      
      The class ha_innodb is renamed from class ha_innobase by a #define.  Thus,
      there will be no clash with the builtin InnoDB.  However, there will be some
      overhead for invoking virtual methods of class ha_innodb.  Ideas for making
      the vtable hidden are welcome.  -fvisibility=hidden is not available in GCC 3.
      2c2b06ad
  7. 27 Sep, 2007 1 commit
  8. 20 Aug, 2007 1 commit
  9. 16 Aug, 2007 1 commit
  10. 01 Aug, 2007 1 commit
  11. 19 Jun, 2007 1 commit
  12. 11 Jun, 2007 1 commit
    • marko's avatar
      branches/zip: Initialize some uninitialized variables in order to avoid · 5ab4cfd4
      marko authored
      comparing uninitialized values.
      
      dict_mem_table_create(): Initialize table->version_number.
      
      ins_node_create(): Initialize node->table_version_number.
      
      row_create_prebuilt(): Initialize all fields.  Initialize most fields
      by memset(), so that any fields that are added will be initialized
      automatically.
      5ab4cfd4
  13. 18 May, 2007 1 commit
  14. 04 Apr, 2007 1 commit
  15. 02 Apr, 2007 1 commit
  16. 05 Mar, 2007 1 commit
  17. 30 Jan, 2007 1 commit
    • marko's avatar
      branches/zip: Avoid memory fragmentation when adding column definitions · 0178dba1
      marko authored
      to tables.
      
      dict_mem_table_add_col(): Add the parameter "heap" for temporary memory
      allocation.  Allow it and "name" to be NULL.  These parameters are NULL
      when creating dummy indexes.
      
      dict_add_col_name(): Remove calls to ut_malloc() and ut_free().
      
      dict_table_get_col_name(): Allow table->col_names to be NULL.
      
      dict_table_add_system_columns(), dict_table_add_to_cache():
      Add the parameter "heap".
      0178dba1
  18. 19 Oct, 2006 1 commit
    • marko's avatar
      branches/zip: Remove the casts introduced in r920 and r925. Replace the · e8a779e7
      marko authored
      accessors returning pointers with macros that preserve const qualifiers.
      In UNIV_DEBUG builds, retain the accessors and cast away constness there.
      
      dfield_get_type(), dfield_get_data(), dtuple_get_nth_field(),
      dict_table_get_nth_col(), dict_table_get_sys_col(): Implement as macro
      unless #ifdef UNIV_DEBUG.
      
      rec_get_nth_field(): Replace with rec_get_nth_field_offs() that does not
      do pointer arithmetics.  Implement rec_get_nth_field() as a macro.
      e8a779e7
  19. 26 Sep, 2006 1 commit
  20. 19 Sep, 2006 1 commit
  21. 31 Aug, 2006 1 commit
    • marko's avatar
      branches/zip: dtuple_convert_big_rec(): Shorten the locally stored part · 6429e2e6
      marko authored
      of externally stored columns to 108 bytes when possible.
      
      This will unmask a bug in the handling of BLOBs on compressed tablespaces,
      especially of small page sizes.  Apparently, the locally stored part must
      be less than 235 bytes in size for the bug to occur.
      
      dict_col_struct: Add field min_prefix.
      
      dict_index_build_internal_non_clust(): Adjust min_prefix.
      6429e2e6
  22. 29 Aug, 2006 1 commit
  23. 13 Jun, 2006 1 commit
  24. 08 May, 2006 1 commit
  25. 25 Apr, 2006 1 commit
    • marko's avatar
      branches/zip: Write the compressed page size to SYS_TABLES.TYPE · 121623c1
      marko authored
      and to the file space header (FSP_PAGE_ZIP_SIZE, renamed from
      FSP_LOWEST_NO_WRITE).
      
      fil_space_struct: Add zip_size.
      
      dict_table_struct: Embed zip_size in flags.
      
      dict_table_zip_size(): Infer zip_size from table->flags.
      
      dict_sys_tables_get_zip_size(): Read zip_size from SYS_TABLES.TYPE.
      
      fil_space_get_zip_size(): Read zip_size from the file space header.
      
      Add the redo log entry type MLOG_ZIP_FILE_CREATE.
      121623c1
  26. 12 Apr, 2006 2 commits
  27. 05 Apr, 2006 1 commit
    • marko's avatar
      branches/zip: Initial steps towards disk-based storage of compressed pages. · f4c776f5
      marko authored
      dict_mem_table_create(): Account for DICT_TF_COMPRESSED in a debug assertion.
      
      btr_store_big_rec_extern_fields(), btr_free_externally_stored_field(),
      btr_copy_externally_stored_field(): Implement the disk format for
      compressed BLOB pages.
      
      btr_copy_externally_stored_field(): Improve error reporting and handling
      when decompressing BLOB pages.
      
      buf_flush_init_for_writing(), buf_page_is_corrupted(), buf_page_print():
      Account for compressed BLOB pages (FIL_PAGE_TYPE_ZBLOB).
      
      buf_calc_zblob_page_checksum(): New function.
      f4c776f5
  28. 03 Mar, 2006 1 commit
  29. 27 Feb, 2006 1 commit
  30. 23 Feb, 2006 1 commit
  31. 21 Feb, 2006 1 commit
  32. 27 Oct, 2005 1 commit