An error occurred fetching the project authors.
  1. 04 Sep, 2009 1 commit
    • V Narayanan's avatar
      Bug#45823 Assertion failure in file row/row0mysql.c line 1386 · 9776b6f9
      V Narayanan authored
      Inserting a negative value in the autoincrement column of a
      partitioned innodb table was causing the value of the auto
      increment counter to wrap around into a very large positive
      value. The consequences are the same as if a very large positive
      value was inserted into a column, e.g. reduced autoincrement
      range, failure to read autoincrement counter.
      
      The current patch ensures that before calculating the next
      auto increment value, the current value is within the positive
      maximum allowed limit.
      
      mysql-test/suite/parts/inc/partition_auto_increment.inc:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Adds tests for performing insert,update and delete on a partition
        table with negative auto_increment values.
      mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Result file for the innodb engine.
      mysql-test/suite/parts/r/partition_auto_increment_memory.result:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Result file for the memory engine.
      mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Result file for the myisam engine.
      mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Result file for the ndb engine.
      mysql-test/suite/parts/t/partition_auto_increment_archive.test:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Adds a variable that allows the Archive engine to skip tests
        that involve insertion of negative auto increment values.
      mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Adds a variable that allows the Blackhole engine to skip tests
        that involve insertion of negative auto increment values.
      sql/ha_partition.cc:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Ensures that the current value is lesser than the upper limit
        for the type of the field before setting the next auto increment
        value to be calculated.
      sql/ha_partition.h:
        Bug#45823 Assertion failure in file row/row0mysql.c line 1386
        
        Modifies the set_auto_increment_if_higher function, to take
        into account negative auto increment values when doing a
        comparison.
      9776b6f9
  2. 21 Aug, 2009 1 commit
    • Mattias Jonsson's avatar
      Bug#46639: 1030 (HY000): Got error 124 from storage engine on · a4e832d6
      Mattias Jonsson authored
      INSERT ... SELECT ...
      
      Problem was that when bulk insert is used on an empty
      table/partition, it disables the indexes for better
      performance, but in this specific case it also tries
      to read from that partition using an index, which is
      not possible since it has been disabled.
      
      Solution was to allow index reads on disabled indexes
      if there are no records.
      
      Also reverted the patch for bug#38005, since that was a workaround
      in the partitioning engine instead of a fix in myisam.
      
      mysql-test/r/partition.result:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        updated result file
      mysql-test/t/partition.test:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        Added testcase
      sql/ha_partition.cc:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        reverted the patch for bug#38005, since that was a workaround
        around this problem, not needed after fixing it in myisam.
      storage/myisam/mi_search.c:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        Return HA_ERR_END_OF_FILE instead of HA_ERR_WRONG_INDEX
        when there are no rows.
      a4e832d6
  3. 06 Aug, 2009 1 commit
    • Satya B's avatar
      Fix for BUG#45816 - assertion failure with index containing double · d933cb16
      Satya B authored
                          column on partitioned table
            
            
      An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query 
      is executed with index containing double column on partitioned table.
      The problem is that assertion expects all the fields which are read,
      to be in the read_set.
            
      In this query only the field 'a' is in the readset as the tables in
      the query are joined by the field 'a' and so the assertion fails 
      expecting other field 'b'.
            
      Since the function cmp() is just comparison of two parameters passed, 
      the assertion is not required.
            
      Fixed by removing the assertion in the double fields comparision
      function and also fixed the index initialization to do ordered
      index scan with RW LOCK which ensures all the fields from a key are in
      the read_set.
       
      
      Note: this bug is not reproducible with other datatypes because the
            assertion doesn't exist in comparision function for other 
            datatypes.
      
      mysql-test/r/partition.result:
        Testcase for BUG#45816
      mysql-test/t/partition.test:
        Testcase for BUG#45816
      sql/field.cc:
        Removed the assertion ASSERT_COLUMN_MARED_FOR_READ in Field_double::cmp()
        function
      sql/ha_partition.cc:
        Fixed index_int() method to make it initialize the read_set properly if
        ordered index scan with RW lock is requested.
      d933cb16
  4. 31 Jul, 2009 1 commit
    • Tatiana A. Nurnberg's avatar
      Bug#40281, partitioning the general log table crashes the server · 717d6054
      Tatiana A. Nurnberg authored
      We disallow the partitioning of a log table. You could however
      partition a table first, and then point logging to it. This is
      not only against the docs, it also crashes the server.
      
      We catch this case now.
      
      mysql-test/r/partition.result:
        results for 40281
      mysql-test/t/partition.test:
        test for 40281: show that trying to log to partitioned table fails rather
        to crash the server
      sql/ha_partition.cc:
        Signal that we no longer support logging to partitioned tables,
        as per the docs.
      sql/sql_partition.cc:
        Some commands like "USE ..." have no select, yet we may try
        to parse partition info after their execution if user set a
        partitioned table as log target. This shouldn't lead to a
        NULL-deref/crash.
      717d6054
  5. 24 Jul, 2009 1 commit
    • Anurag Shekhar's avatar
      Bug#30102: Rename table does corrupt tables with partition files on failure · 0498988b
      Anurag Shekhar authored
      Problem was that a failing rename just left the partitions at the state
      it was at the failure.
      
      Solution was to try to revert the started rename if a failure occured.
      
      mysql-test/r/partition_not_embedded.result:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        New result file
      mysql-test/t/partition_not_embedded.test:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        New test file
        (list_files does not report the files in embedded)
      sql/ha_partition.cc:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        Better error handling for rename partitions (reverting the started rename
        operation)
        
        Different order of files for delete.
      sql/handler.cc:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        Tries to remove as many table files as possible
        if the first delete succeeds.
      0498988b
  6. 08 Jul, 2009 1 commit
    • Satya B's avatar
      Bug#35111 - Truncate a MyISAM partitioned table does not reset · 02e70f16
      Satya B authored
      the auto_increment value
            
      This is an alternative patch that instead of allowing RECREATE TABLE
      on TRUNCATE TABLE it implements reset_auto_increment that is called
      after delete_all_rows.
      
      Note: this bug was fixed by Mattias Jonsson:
      Pusing this patch: http://lists.mysql.com/commits/70370
      
      
      mysql-test/suite/parts/r/partition_auto_increment_memory.result:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
      mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
      sql/ha_partition.cc:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
        
        Added reset_auto_increment, to be used after delete_all_rows
        to simulate truncate.
      storage/heap/ha_heap.cc:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
        
        Added reset_auto_increment, to be used after delete_all_rows
        to simulate truncate
      storage/heap/ha_heap.h:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
        
        Added reset_auto_increment, to be used after delete_all_rows
        to simulate truncate
      storage/myisam/ha_myisam.cc:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
        
        Added reset_auto_increment, to be used after delete_all_rows
        to simulate truncate.
      storage/myisam/ha_myisam.h:
        Bug#35111: Truncate a MyISAM partitioned table does not reset
        the auto_increment value
        
        Added reset_auto_increment, to be used after delete_all_rows
        to simulate truncate.
      02e70f16
  7. 20 Feb, 2009 1 commit
  8. 19 Dec, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#36312: InnoDB DATA_FREE BUG? · dc9c5440
      Mattias Jonsson authored
      Problem is that DATA_FREE in SHOW TABLE STATUS
      is not correct when not using innodb_file_per_table.
      
      The solution is to use I_S.PARTITIONS instead.
      
      This is only a small fix for correcting mean record length and
      always return 0 if the table is empty.
      
      sql/ha_partition.cc:
        Bug#36312: InnoDB DATA_FREE BUG?
        
        This is only a small fix for correcting mean record length and
        always return 0 if the table is empty.
      dc9c5440
  9. 16 Dec, 2008 1 commit
    • Mattias Jonsson's avatar
      post push fix for bug#40595 · 23d569ed
      Mattias Jonsson authored
      Addition of hander function was_semi_consistent_read
      
      mysql-test/r/partition_innodb_semi_consistent.result:
        post push fix for bug#40595
        Addition of hander function was_semi_consistent_read
        
        Added test result
      mysql-test/t/partition_innodb_semi_consistent-master.opt:
        post push fix for bug#40595
        Addition of hander function was_semi_consistent_read
        
        Added test opt file
      mysql-test/t/partition_innodb_semi_consistent.test:
        post push fix for bug#40595
        Addition of hander function was_semi_consistent_read
        
        Added test case
      sql/ha_partition.cc:
        post push fix for bug#40595
        Addition of hander function was_semi_consistent_read
        
        The lack of was_semi_consistent_read opened a regression
        for bug-31310 when useing a partitioned InnoDB table
      23d569ed
  10. 04 Dec, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#40515: Query on a partitioned table does not return · 8adc9d1b
      Mattias Jonsson authored
      'lock wait timeout exceeded'
      
      Problem was a bug in the implementation of scan in partitioning
      which masked the error code from the partition's handler.
      
      Fixed by returning the value from the underlying handler.
      
      mysql-test/suite/parts/r/partition_special_innodb.result:
        Bug#40515: Query on a partitioned table does not return
        'lock wait timeout exceeded'
        
        Updated test result
      mysql-test/suite/parts/t/partition_special_innodb.test:
        Bug#40515: Query on a partitioned table does not return
        'lock wait timeout exceeded'
        
        Updated test case for covering the bug.
      sql/ha_partition.cc:
        Bug#40515: Query on a partitioned table does not return
        'lock wait timeout exceeded'
        
        Removing redeclaration of result variable,
        which resulted in never returning the correct return value.
      8adc9d1b
  11. 25 Nov, 2008 1 commit
    • Build Team's avatar
      mysql-test/r/partition.result · 74b35409
      Build Team authored
      mysql-test/t/partition.test
      sql/ha_partition.cc
        Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
        Problem was usage of read_range_first with an empty key.
        Solution was to not to give a key if it was empty. (real author Mattias Jonsson)
      
      storage/archive/archive_reader.c
      client/mysqlslap.c
        Aligned the copyright texts output from "--version" of tools, to
        let internal tools be able to change them if needed.
      
      storage/ndb/test/tools/connect.cpp
      storage/ndb/test/run-test/atrt.hpp
        Corrected a few GPL headers not restricted to GPL version 2
      
      Makefile.am
        Added missing --report-features to the 'test-bt-fast' target
      
      support-files/mysql.spec.sh
        Reversed the removal of the "%define license GPL" in as internal
        tools depended on it
      74b35409
  12. 24 Nov, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables · d5057740
      Mattias Jonsson authored
      Problem was usage of read_range_first with an empty key.
      
      Solution was to not to give a key if it was empty.
      
      mysql-test/r/partition.result:
        Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
        
        Updated test result.
      mysql-test/t/partition.test:
        Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
        
        Added test case
      d5057740
  13. 10 Nov, 2008 2 commits
    • Build Team's avatar
      e85fe794
    • Mattias Jonsson's avatar
      Bug#40595: Non-matching rows not released with READ-COMMITTED · a5ec6953
      Mattias Jonsson authored
      on tables with partitions
      
      Problem was that the handler function try_semi_consistent_read
      was not propagated to the innodb handler.
      
      Solution was to implement that function in the partitioning
      handler.
      
      mysql-test/r/partition_innodb.result:
        Bug#40595: Non-matching rows not released with READ-COMMITTED
        on tables with partitions
        
        Updated test result.
      mysql-test/t/partition_innodb.test:
        Bug#40595: Non-matching rows not released with READ-COMMITTED
        on tables with partitions
        
        Added test case for bug#40595.
        
        Note: the replace_regex is taking long time. I have not found
        any better regex (it takes time using 'sed' too).
      sql/ha_partition.cc:
        Bug#40595: Non-matching rows not released with READ-COMMITTED
        on tables with partitions
        
        Added function to the partitioning handler for handling
        semi consistent reads (unlock_row was already implemented,
        and this is needed for unlock_row to work properly in innodb).
        It uses pruning for optimizing the call.
      sql/ha_partition.h:
        Bug#40595: Non-matching rows not released with READ-COMMITTED
        on tables with partitions
        
        Added function to the partitioning handler for handling
        semi consistent reads (unlock_row was already implemented,
        and this is needed for unlock_row to work properly in innodb).
      a5ec6953
  14. 06 Nov, 2008 1 commit
  15. 05 Nov, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#40494: MYSQL server crashes on range access with partitioning and · bcd88c9f
      Mattias Jonsson authored
      order by
      
      Problem was that the first index read was unordered,
      and the next was ordered, resulting in use of
      uninitialized data.
      
      Solution was to use the correct variable to see if
      the 'next' call should be ordered or not.
      
      mysql-test/r/partition.result:
        Bug#40494: MYSQL server crashes on range access with
        partitioning and order by
        
        Added test case for the bug.
      mysql-test/t/partition.test:
        Bug#40494: MYSQL server crashes on range access with
        partitioning and order by
        
        Added test case for the bug.
      sql/ha_partition.cc:
        Bug#40494: MYSQL server crashes on range access with
        partitioning and order by
        
        Used the wrong variable to decide to continue with
        ordered or unordered scan.
      bcd88c9f
  16. 30 Oct, 2008 1 commit
  17. 29 Oct, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#39084: Getting intermittent errors with statement-based binary logging · b72d1507
      Mattias Jonsson authored
      Problem was that partitioning cached the table flags.
      These flags could change due to TRANSACTION LEVEL changes.
      Solution was to remove the cache and always return the table flags
      from the first partition (if the handler was initialized).
      
      mysql-test/r/partition_innodb_stmt.result:
        Bug#39084: Getting intermittent errors with statement-based binary logging
        
        New test result file.
      mysql-test/t/partition_innodb_stmt.test:
        Bug#39084: Getting intermittent errors with statement-based binary logging
        
        New test file.
      sql/ha_partition.cc:
        Bug#39084: Getting intermittent errors with statement-based binary logging
        
        Removed m_table_flags, and added m_handler_status.
        Added checks that all partitions have the same
        table flags.
        Moved some variable initializations.
        Updated some comments.
        Fixed typo initialise -> initialize
        Changed HA_EXTTA_NO_READCHECK to do nothing, since it
        is only used in ha_open, which is called for every
        partition in ::open anyway.
      sql/ha_partition.h:
        Bug#39084: Getting intermittent errors with statement-based binary logging
        
        Removed m_table_flags, and added m_handler_status.
        Always return the first partitions table flags, instead of using
        cached table flags.
        Added define of enabled/disabled partitioning table flags
        Fixed type initialise -> initialize
        Updated some comments.
      sql/handler.cc:
        Bug#39084: Getting intermittent errors with statement-based binary logging
        
        Fixed type initialise -> initialize.
      sql/handler.h:
        Bug#39084: Getting intermittent errors with statement-based binary logging
        
        Added comment to understand where the cached value is set.
      b72d1507
  18. 23 Oct, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#40176: update as first partitioning statement · 620d955e
      Mattias Jonsson authored
      breaks auto increment
      
      The auto_increment value was not initialized if
      the first statement after opening a table was
      an 'UPDATE'.
      
      solution was to check initialize if it was not,
      before trying to increase it in update.
      
      mysql-test/suite/parts/inc/partition_auto_increment.inc:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Added tests for verifying the bug and show some more
        auto_increment flaws
      mysql-test/suite/parts/r/partition_auto_increment_archive.result:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Updated test results, due to added tests
      mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Updated test results, due to added tests
      mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Updated test results, due to added tests
      mysql-test/suite/parts/r/partition_auto_increment_memory.result:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Updated test results, due to added tests
      mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Updated test results, due to added tests
      mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Updated test results, due to added tests
      sql/ha_partition.cc:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        make sure that the auto_increment value is initialized
        before updating it.
        
        (missed initializing in mysql_update_row).
      sql/ha_partition.h:
        Bug#40176: update as first partitioning statement
        breaks auto increment
        
        Assert that it is initialized, before updating
        the auto_increment value
      620d955e
  19. 10 Oct, 2008 2 commits
    • Mattias Jonsson's avatar
      Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work · c6115db4
      Mattias Jonsson authored
      on non-partitioned table
      
      Problem was that partitioning specific commands was accepted
      for non partitioned tables and treated like
      ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed,
      which changed the code path from mysql_alter_table to
      mysql_admin_table.
      
      Solution was to check if the table was partitioned before
      trying to execute the admin command
      
      mysql-test/r/partition_mgm_err.result:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Updated test result
      mysql-test/t/partition_mgm_err.test:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Updated test case
      sql/ha_partition.cc:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Simplified the code by using ALTER_ADMIN_PARTITION for all
        commands that go through mysql_admin_tables and is set
        for partitioning specific commands that.
      sql/ha_partition.h:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Simplified the code by using ALTER_ADMIN_PARTITION for all
        commands that go through mysql_admin_tables and is set
        for partitioning specific commands that.
      sql/sql_lex.h:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Simplified the code by using ALTER_ADMIN_PARTITION for all
        commands that go through mysql_admin_tables and is set
        for partitioning specific commands that.
        
        Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
        added ALTER_ADMIN_PARTITION instead.
      sql/sql_partition.cc:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Simplified the code by using ALTER_ADMIN_PARTITION for all
        commands that go through mysql_admin_tables and is set
        for partitioning specific commands that.
        
        Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
        added ALTER_ADMIN_PARTITION instead.
      sql/sql_table.cc:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Give error and return if trying partitioning admin command
        on non partitioned table.
        
        Simplified the code by using ALTER_ADMIN_PARTITION for all
        commands that go through mysql_admin_tables and is set
        for partitioning specific commands that.
        
        Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
        added ALTER_ADMIN_PARTITION instead.
      sql/sql_yacc.yy:
        Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
        on non-partitioned table
        
        Simplified the code by using ALTER_ADMIN_PARTITION for all
        commands that go through mysql_admin_tables and is set
        for partitioning specific commands that.
        
        Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
        added ALTER_ADMIN_PARTITION instead.
      c6115db4
    • Mattias Jonsson's avatar
      Bug#37721: ORDER BY when WHERE contains non-partitioned · d3ea7430
      Mattias Jonsson authored
      index column
      
      There was actually two problems
      1) when clustered pk, order by non pk index should also
      compare with pk as last resort to differ keys from each
      other
      2) bug in the index search handling in ha_partition (was
      found when extending the test case
      
      Solution to 1 was to include the pk in key compare if
      clustered pk and search on other index.
      
      Solution for 2 was to remove the optimization from
      ordered scan to unordered scan if clustered pk.
      
      mysql-test/r/partition_innodb.result:
        Bug#37721: ORDER BY when WHERE contains non-partitioned
        index column
        
        updated test result.
      mysql-test/t/partition_innodb.test:
        Bug#37721: ORDER BY when WHERE contains non-partitioned
        index column
        
        Added test case for bug verification.
      sql/ha_partition.cc:
        Bug#37721: ORDER BY when WHERE contains non-partitioned
        index column
        
        using m_curr_key_info with both given index and PK
        if clustered PK.
        Also including PK in read_set.
        Added debug prints for easier verification.
      sql/ha_partition.h:
        Bug#37721: ORDER BY when WHERE contains non-partitioned
        index column
        
        Changed m_curr_key_info to a null terminated array
        with max 2 keys and a terminating null.
        For use with key_rec_cmp with both given index and PK.
      sql/key.cc:
        Bug#37721: ORDER BY when WHERE contains non-partitioned
        index column
        
        added handling of a null terminated array of keys for
        use in compare.
      d3ea7430
  20. 06 Oct, 2008 1 commit
    • Alexey Botchkov's avatar
      Bug#38005 Partitions: error with insert select. · afbb52c4
      Alexey Botchkov authored
      MyISAM blocks index usage for bulk insert into zero-records tables.
      See ha_myisam::start_bulk_insert() lines from
      ...
          if (file->state->records == 0 ...
      ...
      
      That causes problems for partition engine when some partitions have records some not
      as the engine uses same access method for all partitions.
      
      Now partition engine doesn't call index_first/index_last
      for empty tables.
      
      per-file comments:
        mysql-test/r/partition.result
              Bug#38005 Partitions: error with insert select.
              test result
      
        mysql-test/t/partition.test
              Bug#38005 Partitions: error with insert select.
              test case
      
        sql/ha_partition.cc
              Bug#38005 Partitions: error with insert select.
              ha_engine::index_first and
              ha_engine::index_last not called for empty tables.
      afbb52c4
  21. 04 Oct, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#37453: Dropping/creating index on partitioned table with · 65811a33
      Mattias Jonsson authored
      InnoDB Plugin locks table
      
      The fast/on-line add/drop index handler calls was not implemented
      whithin the partitioning.
      
      This implements it in the partitioning handler.
      
      Since this is only used by the not included InnoDB plugin, there
      is no test case. (Have tested it manually with the plugin, and
      it does not allow unique indexes not including partitioning
      function, or removal of pk, which in innodb generates a new pk,
      which is not in the partitioning function.)
      
      NOTE: This introduces a new handler method, and because of that
      changes the storage engine api. (One cannot use a handlerton to
      see the capabilities of a table's handler if it is partitioned.
      So I added a wrapper function in the handler that defaults to
      the handlerton function, which the partitioning handler overrides.
      
      sql/ha_partition.cc:
        Bug#37453: Dropping/creating index on partitioned table with
        InnoDB Plugin locks table
        
        Added support for fast/on-line add/drop index.
        Implemented alter_table_flags as bit-or of the partitioned
        hton and the first partitions alter_table_flags.
        
        It is only to forward the calls for the other functions:
        check_if_incompatible_data
        add_index
        prepare_drop_index
        final_drop_index
        
        to all parts handler
      sql/ha_partition.h:
        Bug#37453: Dropping/creating index on partitioned table with
        InnoDB Plugin locks table
        
        Added support for fast/on-line add/drop index.
      sql/handler.h:
        Bug#37453: Dropping/creating index on partitioned table with
        InnoDB Plugin locks table
        
        Added the function on handler level, defaulting to use
        the handlerton function, but a handler can override it.
        Needed for partitioned tables.
        
        NOTE: Change of storage engine api.
      sql/sql_partition.cc:
        Bug#37453: Dropping/creating index on partitioned table with
        InnoDB Plugin locks table
        
        Using the new handler function, instead of the handlerton
        function. This works better with the partitioning handler.
      sql/sql_table.cc:
        Bug#37453: Dropping/creating index on partitioned table with
        InnoDB Plugin locks table
        
        Using the new handler function, instead of the handlerton
        function. This works better with the partitioning handler.
        Also using new process info for 'manage keys' (kind of fix
        for bug-37550).
      65811a33
  22. 03 Oct, 2008 1 commit
    • Mattias Jonsson's avatar
      post push fix for bug#38804 (back port of bug#33479) · 51cb9ac0
      Mattias Jonsson authored
      Removes the regression bug#38751.
      
      sql/ha_partition.cc:
        post push fix for bug#38804 (back port of bug#33479)
        Removes the regression bug#38751.
        
        archive relies on a ha_archive::info call to flush data before
        the copy takes place in alter table.
        
        This ensures that all partitions gets a info call, without having
        to always forward info(HA_STATUS_AUTO) to all partitions.
      51cb9ac0
  23. 01 Oct, 2008 1 commit
  24. 18 Sep, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#30573: Ordered range scan over partitioned tables returns some rows twice · 3e1d88d1
      Mattias Jonsson authored
      and
      Bug#33555: Group By Query does not correctly aggregate partitions
      
      Backport of bug-33257 which is the same bug.
      
      read_range_*() calls was not passed to the partition handlers,
      but was translated to index_read/next family calls.
      Resulting in duplicates rows and wrong aggregations.
      
      mysql-test/r/partition_range.result:
        Bug#30573: Ordered range scan over partitioned tables returns some rows twice
        
        Updated result file
      mysql-test/t/partition_range.test:
        Bug#30573: Ordered range scan over partitioned tables returns some rows twice
        
        Re-enabled the test
      sql/ha_partition.cc:
        Bug#30573: Ordered range scan over partitioned tables returns some rows twice
        
        backport of bug-33257, correct handling of read_range_* calls,
        without converting them to index_read/next calls
      sql/ha_partition.h:
        Bug#30573: Ordered range scan over partitioned tables returns some rows twice
        
        backport of bug-33257, correct handling of read_range_* calls,
        without converting them to index_read/next calls
      3e1d88d1
  25. 08 Sep, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#38804: Query deadlock causes all tables to be inaccessible. · be63f0af
      Mattias Jonsson authored
      Problem was a mutex added in bug n 27405 for solving a problem
      with auto_increment in partitioned innodb tables.
      (in ha_partition::write_row over partitions file->ha_write_row)
      
      Solution is to use the patch for bug#33479, which refines the
      usage of mutexes for auto_increment.
      
      Backport of bug-33479 from 6.0:
      
      Bug-33479: auto_increment failures in partitioning
      
      Several problems with auto_increment in partitioning
      (with MyISAM, InnoDB. Locking issues, not handling
      multi-row INSERTs properly etc.)
      
      Changed the auto_increment handling for partitioning:
      Added a ha_data variable in table_share for storage engine specific data
      such as auto_increment value handling in partitioning, also see WL 4305
      and using the ha_data->mutex to lock around read + update.
      
      The idea is this:
      Store the table's reserved auto_increment value in
      the TABLE_SHARE and use a mutex to, lock it for reading and updating it
      and unlocking it, in one block. Only accessing all partitions
      when it is not initialized.
      Also allow reservations of ranges, and if no one has done a reservation
      afterwards, lower the reservation to what was actually used after
      the statement is done (via release_auto_increment from WL 3146).
      The lock is kept from the first reservation if it is statement based
      replication and a multi-row INSERT statement where the number of
      candidate rows to insert is not known in advance (like INSERT SELECT,
      LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
      
      This should also lead to better concurrancy (no need to have a mutex
      protection around write_row in all cases)
      and work with any local storage engine.
      
      mysql-test/suite/parts/inc/partition_auto_increment.inc:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        Test source file for testing auto_increment
      mysql-test/suite/parts/r/partition_auto_increment_archive.result:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        result file for testing auto_increment
      mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        result file for testing auto_increment
      mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        result file for testing auto_increment
      mysql-test/suite/parts/r/partition_auto_increment_memory.result:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        result file for testing auto_increment
      mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        result file for testing auto_increment
      mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        result file for testing auto_increment
      mysql-test/suite/parts/t/partition_auto_increment_archive.test:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        test file for testing auto_increment
      mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        test file for testing auto_increment
      mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        test file for testing auto_increment
      mysql-test/suite/parts/t/partition_auto_increment_memory.test:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        test file for testing auto_increment
      mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        test file for testing auto_increment
      mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        test file for testing auto_increment
      sql/ha_partition.cc:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: Failures using auto_increment and partitioning
        
        Changed ha_partition::get_auto_increment from file->get_auto_increment
        to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
        (InnoDB can have issues with partitioning and auto_increment,
        where get_auto_increment sometimes can return a non updated value.)
        
        Using the new table_share->ha_data for keeping the auto_increment
        value, shared by all instances of the same table.
        It is read+updated when holding a auto_increment specific mutex.
        Also added release_auto_increment to decrease gaps if possible.
        And a lock for multi-row INSERT statements where the number of candidate
        rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
        Unlike INSERT INTO (row1),(row2),,(rowN)).
        Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
        Changed from current_thd, to ha_thd()
      sql/ha_partition.h:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: Failures using auto_increment and partitioning
        
        Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
        Added a private function to set auto_increment values if needed
        Removed the restore_auto_increment (the hander version is better)
        Added lock/unlock functions for auto_increment handling.
        Changed copied/deleted to const.
      sql/handler.h:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: auto_increment failures in partitioning
        
        Added const for changed_partitions
        Added comments about SQLCOM_TRUNCATE for delete_all_rows
      sql/table.h:
        Bug#38804: Query deadlock causes all tables to be inaccessible.
        Backporting from 6.0 of:
        Bug-33479: Failures using auto_increment and partitioning
        
        Added a variable in table_share: ha_data for storage of storage engine
        specific data (such as auto_increment handling in partitioning).
      be63f0af
  26. 20 Aug, 2008 1 commit
    • Mattias Jonsson's avatar
      Backport of patch for Bug#34604 (from 6.0) · 5d5d1a81
      Mattias Jonsson authored
      post push fix for bug#20129, test failed due to non existing
      source files.
      
      mysql-test/Makefile.am:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Test parts.partition_repair_myisam failed because the corrupted
        pre fabricated files was not included in the dist-file.
      mysql-test/suite/parts/r/partition_special_innodb.result:
        Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
        
        updated result file
      mysql-test/suite/parts/t/partition_special_innodb-master.opt:
        Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
        
        Added parameter to speed up the test.
        Set to 2 seconds to be working on slow machines.
      mysql-test/suite/parts/t/partition_special_innodb.test:
        Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
        
        Added test for verifying the bug (without the patch in
        ha_partition.cc, this crashes a debug compiled server)
      sql/ha_partition.cc:
        Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
        
        In some cases error was not properly propagated through
        ha_partition::rnd_next.
        
        Will now return the error code from the partitions rnd_next and
        update m_part_spec.start_part and m_last_part properly.
        This makes the inited state to be correct.
      5d5d1a81
  27. 19 Aug, 2008 1 commit
    • Mattias Jonsson's avatar
      Post push fix for valgrind warning in ha_partition.cc · ad15cd68
      Mattias Jonsson authored
      Bug#35161
      Fixed memory leak when failing to open a partition.
      
      Bug#20129
      Added tests for verifying REPAIR PARTITION.
      
      mysql-test/std_data/parts/t1_will_crash#P#p1_first_1024.MYD:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test
        Created by:
        CREATE TABLE t1_will_crash (
          a VARCHAR(255),
          b INT,
          c LONGTEXT,
          PRIMARY KEY (a, b))ENGINE=MyISAM
        PARTITION BY HASH (b)
        PARTITIONS 7;
        INSERT INTO t1_will_crash VALUES ...
        and then
        head -c 1024 var/master-data/test/t1_will_crash#P#p1.MYD
        into this file.
      mysql-test/std_data/parts/t1_will_crash#P#p2.MYD:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after _mi_mark_file_changed in mi_write
        was done.
      mysql-test/std_data/parts/t1_will_crash#P#p2.MYI:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after _mi_mark_file_changed in mi_write
        was done.
      mysql-test/std_data/parts/t1_will_crash#P#p3.MYI:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after *share->write_record was done.
      mysql-test/std_data/parts/t1_will_crash#P#p4.MYI:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after flush_cached_blocks
      mysql-test/std_data/parts/t1_will_crash#P#p6.MYD:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after _mi_write_part_record in
        write_dynamic_record returned for the first time.
      mysql-test/std_data/parts/t1_will_crash#P#p6_2.MYD:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after _mi_write_part_record in
        write_dynamic_record returned for the second time.
      mysql-test/std_data/parts/t1_will_crash#P#p6_3.MYD:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        (see mysql-test/suite/parts/t/partition_repair_myisam.test)
        copy of file right after _mi_write_part_record in
        write_dynamic_record returned for the third time.
        (data file fully updated).
      mysql-test/suite/parts/r/partition_recover_myisam.result:
        Bug#35161
        
        Renamed since it was a test of recover
        and to make repair free for use without
        --myisam-recover
      mysql-test/suite/parts/r/partition_repair_myisam.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        New result file for testing CHECK/REPAIR of partitioned tables
      mysql-test/suite/parts/t/partition_recover_myisam-master.opt:
        Bug#35161
        
        Renamed since it was a test of recover
        and to make repair free for use without
        --myisam-recover
      mysql-test/suite/parts/t/partition_recover_myisam.test:
        Bug#35161
        
        Renamed since it was a test of recover
        and to make repair free for use without
        --myisam-recover
      mysql-test/suite/parts/t/partition_repair_myisam.test:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
        
        New test file for testing CHECK/REPAIR of partitioned tables
      sql/ha_partition.cc:
        Bug#35161
        
        Fix of memory leak when open of partition failed.
      ad15cd68
  28. 15 Aug, 2008 1 commit
    • Chad MILLER's avatar
      Bug#38272: timestamps fields incorrectly defaulted on \ · 35c8b4c5
      Chad MILLER authored
      	update accross partitions.
            
      It's not Innodb-specific bug.
      ha_partition::update_row() didn't set
      table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET when
      orig_timestamp_type == TIMESTAMP_AUTO_SET_ON_INSERT.
      
      So that a partition sets the timestamp field when a record
      is moved to a different partition.
      
      Fixed by doing '= TIMESTAMP_NO_AUTO_SET' unconditionally.
      Also ha_partition::write_row() is fixed in same way as now
      Field_timestamp::set() is called twice in SET_ON_INSERT case.
      
      (Chad queues this patch on demand by Trudy/Davi.)
      
      mysql-test/r/partition.result:
        Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
        test result
      mysql-test/t/partition.test:
        Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
        test case
      sql/ha_partition.cc:
        Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
        Do table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET unconditionally
        in ha_partition::update_row and ::write_row()
      35c8b4c5
  29. 13 Aug, 2008 1 commit
  30. 11 Aug, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that · f50c4207
      Mattias Jonsson authored
      partition is corrupt
      
      The main problem was that ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR
      PARTITION took another code path (over mysql_alter_table instead of
      mysql_admin_table) which differs in two ways:
      1) alter table opens the tables in a different way than admin tables do
         resulting in returning with error before it tried the command
      2) alter table does not start to send any diagnostic rows to the client
         which the lower admin functions continue to use -> resulting in
         assertion crash
      
      The fix:
      Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use
      the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE t.
      Adding check in mysql_admin_table to setup the partition list for
      which partitions that should be used.
      
      
      Partitioned tables will still not work with
      REPAIR TABLE/PARTITION USE_FRM, since that requires moving partitions
      to tables, REPAIR TABLE t USE_FRM, and check that the data still
      fulfills the partitioning function and then move the table back to
      being a partition.
      
      NOTE: I have removed the following functions from the handler
      interface:
      analyze_partitions, check_partitions, optimize_partitions,
      repair_partitions
      Since they are not longer needed.
      THIS ALTERS THE STORAGE ENGINE API
      
      mysql-test/r/handler_innodb.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a note result row.
      mysql-test/r/innodb.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a note result row.
      mysql-test/r/innodb_mysql.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a note result row.
      mysql-test/r/partition.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      mysql-test/r/trigger-trans.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a note result row.
      mysql-test/suite/ndb/r/ndb_partition_key.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      mysql-test/suite/ndb/t/ndb_partition_key.test:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      mysql-test/suite/parts/inc/partition_alter4.inc:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      mysql-test/suite/parts/r/partition_alter4_innodb.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      mysql-test/suite/parts/r/partition_alter4_myisam.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      mysql-test/suite/rpl/r/rpl_failed_optimize.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a note result row.
      mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a note result row.
      mysql-test/t/partition.test:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
        tables.
      sql/ha_partition.cc:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added a function for returning admin commands result rows
        Updated handle_opt_partitions to handle admin commands result rows,
        and some error filtering (as mysql_admin_table do).
        
        Removed the functions analyze/check/optimize/repair_partitions
        since they have no longer any use.
      sql/ha_partition.h:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Removed analyze/check/optimize/repair_partitions since they
        are no longer are needed.
      sql/handler.cc:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Removed analyze/check/optimize/repair_partitions since they
        are no longer are needed.
      sql/handler.h:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Removed analyze/check/optimize/repair_partitions since they
        are no longer are needed.
      sql/mysql_priv.h:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added set_part_state for reuse of code in mysql_admin_table.
        (Originally fond in sql/sql_partition.cc:prep_alter_part_table)
      sql/protocol.cc:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added one assert and a debug print.
      sql/sql_partition.cc:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Refactored code for setting up partition state, set_part_state,
        now used in both prep_alter_part_table and
        sql_table.cc:mysql_admin_table.
        Removed code for handling ANALYZE/CHECK/OPTIMIZE/REPAIR partitions,
        since it is now handled by mysql_admin_table.
      sql/sql_table.cc:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Added functionality in mysql_admin_table to work with partitioned
        tables.
        Fixed a possible assertion bug for HA_ADMIN_TRY_ALTER
        (If analyze would output a row, it fails since the row was already
        started).
      sql/sql_yacc.yy:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        to use the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE
        instead of taking the ALTER TABLE path.
        Added reset of alter_info for ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE
        since it is now used by partitioned tables.
      storage/myisam/mi_check.c:
        Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
        partition is corrupt
        
        Changed warning message from "Found X parts  Should be: Y parts"
        to "Found X key parts. Should be Y", since it could be confusing
        with partitioned tables.
      f50c4207
  31. 10 Jul, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#37402: Mysql cant read partitioned table with capital letter in the name · c1e54765
      Mattias Jonsson authored
      Problem was that ha_partition had HA_FILE_BASED flag set
      (since it uses a .par file), but after open it uses the first partitions
      flags, which results in different case handling for create and for
      open.
      
      Solution was to change the underlying partition name so it was consistent.
      (Only happens when lower_case_table_names = 2, i.e. Mac OS X and storage
      engines without HA_FILE_BASED, like InnoDB and Memory.)
      
      (Recommit after adding rename of check_lowercase_names to
      get_canonical_filename, and moved it from handler.h to mysql_priv.h)
      
      NOTE: if a mixed case name for a partitioned table was created when
      lower_case_table_name = 2 it should be renamed or dropped before using
      the updated version (See bug#37402 for more info)
      
      mysql-test/include/have_case_insensitive_file_system.inc:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Added include file.
      mysql-test/include/have_lowercase0.inc:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        moved case insensitive file system to a new file, leaving only
        lower_case_table_names.
      mysql-test/include/have_lowercase2.inc:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Added include file.
      mysql-test/lib/mtr_report.pl:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Removed a duplicate row and suppressed warning about setting
        lower_case_table_names to 2 on case sensitive file systems.
      mysql-test/r/case_insensitive_file_system.require:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Added requirement file.
      mysql-test/r/lowercase0.require:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        moved case insensitive file system to a new file, leaving only
        lower_case_table_names.
      mysql-test/suite/parts/inc/partition_mgm.inc:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New include file for testing partitioning management functions for different
        settings of lower_case_table_names.
      mysql-test/suite/parts/r/partition_mgm_lc0_archive.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc0_memory.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc0_ndb.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc1_archive.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc1_memory.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc1_ndb.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc2_archive.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc2_memory.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/r/partition_mgm_lc2_ndb.result:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New result file.
      mysql-test/suite/parts/t/partition_mgm_lc0_archive.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc0_innodb.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc0_memory.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc0_myisam.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc0_ndb.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc1_archive-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc1_archive.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc1_innodb-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc1_innodb.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc1_memory-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc1_memory.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc1_myisam-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc1_myisam.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc1_ndb-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc1_ndb.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc2_archive-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc2_archive.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc2_innodb-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc2_innodb.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc2_memory-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc2_memory.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc2_myisam-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc2_myisam.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/suite/parts/t/partition_mgm_lc2_ndb-master.opt:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New opt file.
      mysql-test/suite/parts/t/partition_mgm_lc2_ndb.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        New test file.
      mysql-test/t/lowercase_table3.test:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Moved case sensitive file system to a specific inc-file instead of
        included in lowercase0.inc
      sql/ha_partition.cc:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Problem was that ha_partition had HA_FILE_BASED set
        (since it uses a .par file), but after open it uses the first partitions
        table_flags(), which results in different case handling for create and for
        open.
        
        Solution was to change the underlying partition name so it was consistent.
        (Only happens when lower_case_table_names = 2, i.e. Mac OS X)
      sql/handler.cc:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Renamed check_lowercase_names to get_canonical_filename, and exported it
        so that ha_partition.cc can use the function.
      sql/mysql_priv.h:
        Bug#37402: Mysql cant read partitioned table with capital letter in the name
        
        Renamed check_lowercase_names to get_canonical_filename, and exported it
        so that ha_partition.cc can use the function.
      c1e54765
  32. 07 Jul, 2008 2 commits
    • Mattias Jonsson's avatar
      Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables. · d11d5cfc
      Mattias Jonsson authored
      problem was that ha_partition::records was not implemented, thus
      using the default handler::records, which is not correct if the engine
      does not support HA_STATS_RECORDS_IS_EXACT.
      Solution was to implement ha_partition::records as a wrapper around
      the underlying partitions records.
      
      The rows column in explain partitions will now include the total
      number of records in the partitioned table.
      
      (recommit after removing out-commented code)
      
      d11d5cfc
    • Mattias Jonsson's avatar
      Bug#35161: --myisam-recover does not work for partitioned MyISAM tables · ce30b928
      Mattias Jonsson authored
      Problem was that auto_repair, is_crashed and check_and_repair was not
      implemented in ha_partition.
      
      Solution, implemented them as loop over all partitions for is_crashed and
      check_and_repair, and using the first partition for auto_repair.
      
      (Recommit after fixing review comments)
      
      mysql-test/lib/mtr_report.pl:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Added filter for crashed tables, when testing auto repair
      mysql-test/std_data/corrupt_t1#P#p1.MYI:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Corrupt MYI file for testing auto repair
      mysql-test/std_data/corrupt_t1.MYI:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Corrupt MYI file for testing auto repair
      mysql-test/suite/parts/r/partition_repair_myisam.result:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Result file for testing auto repair of crashed myisam partitions
      mysql-test/suite/parts/t/partition_repair_myisam-master.opt:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        opt file for testing auto repair of crashed myisam partitions
      mysql-test/suite/parts/t/partition_repair_myisam.test:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Test file for testing auto repair of crashed myisam partitions
      sql/ha_partition.cc:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Added auto_repair as returning the first partitions auto_repair
        Added is_crashed and check_and_repair as loop over all partitions
      sql/ha_partition.h:
        Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
        
        Activating check_and_repair, auto_repair and is_crashed
      ce30b928
  33. 17 Jun, 2008 1 commit
    • Mattias Jonsson's avatar
      Bug#35931 Index search of partitioned MyISAM table · 06f3c434
      Mattias Jonsson authored
      returns erroneous results
      
      Used the wrong function when fixing 30480 which lead to
      no stop on end_key resulting in duplicate results from index scan
      
      Includes test cases for the duplicates 37327 and 37329,
      Duplicate rows and bad performance/High Handler_read_next values
      
      Recommit after merge issues
      
      mysql-test/r/partition.result:
        Bug#35931 List partition MyISAM table returns erroneous results
        
        added test results.
      mysql-test/t/partition.test:
        Bug#35931 List partition MyISAM table returns erroneous results
        
        added test for 35931, 37327 and 37329.
      sql/ha_partition.cc:
        Bug#35931 List partition MyISAM table returns erroneous results
        
        HA_READ_ORDER is a index_flag, not a table_flag.
        Error made in 30480.
      06f3c434
  34. 17 Mar, 2008 1 commit
    • unknown's avatar
      Valgrind warnings found after bug#32943 and after merge from -main · 1bb10ccf
      unknown authored
      into -engines tree.
      
      hander::table_share was not updated after changing table->s.
      
      
      sql/ha_partition.cc:
        Valgrind warning after merge -main -> -engines, after bug#32943
        
        change_table_ptr can happen in a middle of
        alter table rename/drop/... partition
        
        the newly created partitions must get the updated table_share too.
      sql/sql_base.cc:
        Bug#32943 was missing a call to change_table_ptr, this was found by valgrind
        after a merge from -main to -engines.
      1bb10ccf
  35. 24 Feb, 2008 1 commit
    • unknown's avatar
      Pre push fixes · c37fdbcd
      unknown authored
      Test file fixes for bugs 20129, 31931 and 34225
      
      
      mysql-test/suite/parts/r/partition_basic_symlink_innodb.result:
        Manual merge, new test case to be modified for Bug#20129
      mysql-test/suite/parts/r/partition_basic_symlink_myisam.result:
        Manual merge, new test case to be modified for Bug#20129
      mysql-test/suite/parts/r/partition_engine_innodb.result:
        Manual merge, fix for bug#31931
      mysql-test/suite/parts/r/partition_engine_myisam.result:
        Manual merge, fix for bug#31931
      mysql-test/suite/parts/t/disabled.def:
        These should work now since Bug#34225 is fixed
      sql/ha_partition.cc:
        Bug#20129: partition maintenance command not working with crashed tables
        
        Fix for compiler warnings.
      c37fdbcd
  36. 11 Feb, 2008 1 commit
    • unknown's avatar
      Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION · 6a154536
      unknown authored
      Problem was that it did not work with corrupted/crashed tables.
      
      Solution is to disable these commands until WL#4176 is completed
      
      
      mysql-test/r/partition.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/inc/partition_alter4.inc:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        copy-paste error, changed from REBUILT to REPAIR, as the heading says
      mysql-test/suite/parts/r/partition_alter1_innodb.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_alter1_myisam.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_alter2_innodb.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_alter2_myisam.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_basic_innodb.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_basic_myisam.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_engine_innodb.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/r/partition_engine_myisam.result:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Test result
      mysql-test/suite/parts/t/disabled.def:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Disabled test since the tested feature is not longer supported
      mysql-test/t/partition.test:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        OPTIMIZE PARTITION is not longer supported, waiting for WL#4176
      sql/ha_partition.cc:
        Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
        
        Problem was that it did not work with corrupted/crashed tables.
        
        Solution is to disable these commands until WL#4176 is completed
        (returning HA_ADMIN_NOT_IMPLEMENTED and
        #ifdef'ed the non-reachable code)
      6a154536
  37. 20 Dec, 2007 1 commit
    • unknown's avatar
      A pre-requisite for the fix for Bug#12713 "Error in a stored function · 0fbc29c1
      unknown authored
      called from a SELECT doesn't cause ROLLBACK of state"
      Make private all class handler methods (PSEA API) that may modify
      data. Introduce and deploy public ha_* wrappers for these methods in 
      all sql/.
      This necessary to keep track of all data modifications in sql/,
      which is in turn necessary to be able to optimize two-phase
      commit of those transactions that do not modify data.
      
      
      sql/ha_partition.cc:
        Class ha_partition is no longer a friend of class handler.
        Use the public handler interface (handler::ha_ methods) for partition
        operations.
        Remove unnecessary casts from char[] to const char *.ppзи выафвыаafa
      sql/handler.cc:
        Function ha_create_table() is no longer a friend of class handler.
        Use public handler::change_table_ptr() to access private members.
        This fixes a subtle bug (no test case in the test suite) when a
        deletion error occurs inside one partition of a partitioned engine. 
        The old code would crash in handler::print_error() in this case.
        
        Implement the newly introduced public ha_* wrappers of the private
        virtual handler methods.
      sql/handler.h:
        Introduce ha_* wrappers to all class handler methods that may
        modify data. This is necessary to be able to keep track of
        data modifying operations of class handler and optimize read-only
        transactions.
      sql/item_sum.cc:
        delete_all_rows -> ha_delete_all_rows
      sql/sql_base.cc:
        Use the new public wrappers.
      sql/sql_delete.cc:
        delete_all_rows -> ha_delete_all_rows
      sql/sql_partition.cc:
        Use the new public wrappers.
      sql/sql_select.cc:
        delete_all_rows -> ha_delete_all_rows
        delete_table -> ha_delete_table
        disabe_indexes -> ha_disable_idnexes
      sql/sql_show.cc:
        delete_all_rows -> ha_delete_all_rows
      sql/sql_table.cc:
        Use the public wrappers for class handler DDL methods.
        All methods which may change handler data are now accessed via a public
        wrapper.
      sql/sql_union.cc:
        delete_all_rows -> ha_delete_all_rows
        {enable,disable}_indexes -> ha_{enable,disable}_indexes
      sql/sql_update.cc:
        bulk_update_row -> ha_bulk_update_row
      sql/unireg.cc:
        create_handler_files -> ha_create_handler_files
      0fbc29c1