An error occurred fetching the project authors.
  1. 07 Nov, 2009 1 commit
  2. 13 Aug, 2009 1 commit
    • unknown's avatar
      BUG#45574 CREATE IF NOT EXISTS is not binlogged if the object exists · fce4fa36
      unknown authored
      There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
      CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
      binlogged even if either the DB, TABLE or EVENT does not exist. In
      contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
      exists.  
      
      This patch fixes the following cases for all the replication formats:
      CREATE DATABASE IF NOT EXISTS.
      CREATE TABLE IF NOT EXISTS,
      CREATE TABLE IF NOT EXISTS ... LIKE,
      CREAET TABLE IF NOT EXISTS ... SELECT.
      
      sql/sql_insert.cc:
        Part of the code was moved from the create_table_from_items to select_create::prepare.
        When replication is row based, CREATE TABLE IF NOT EXISTS.. SELECT is binlogged if the table exists.
      fce4fa36
  3. 24 Jul, 2009 1 commit
    • Gleb Shchepa's avatar
      Bug #38816: kill + flush tables with read lock + stored · dc0a87fd
      Gleb Shchepa authored
                  procedures causes crashes!
      
      The problem of that bugreport was mostly fixed by the
      patch for bug 38691.
      However, attached test case focused on another crash or
      valgrind warning problem: SHOW PROCESSLIST query accesses
      freed memory of SP instruction that run in a parallel
      connection.
      
      Changes of thd->query/thd->query_length in dangerous
      places have been guarded with the per-thread
      LOCK_thd_data mutex (the THD::LOCK_delete mutex has been
      renamed to THD::LOCK_thd_data).
      
      
      sql/ha_myisam.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data
        mutex.
        Unnecessary locking with the global LOCK_thread_count
        mutex has been removed.
      sql/log_event.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the THD::set_query()) method call/LOCK_thd_data
        mutex.
      sql/slave.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the THD::set_query() method call/LOCK_thd_data mutex.
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sp_head.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data
        mutex.
      sql/sql_class.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        The new THD::LOCK_thd_data mutex and THD::set_query()
        method has been added to guard modifications of THD::query/
        THD::query_length fields, also the Statement::set_statement()
        method has been overloaded in the THD class.
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sql_class.h:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        The new THD::LOCK_thd_data mutex and THD::set_query()
        method has been added to guard modifications of THD::query/
        THD::query_length fields, also the Statement::set_statement()
        method has been overloaded in the THD class.
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sql_insert.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data
        mutex.
      sql/sql_parse.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data mutex.
      sql/sql_repl.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sql_show.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Inter-thread read of THD::query/query_length field has
        been protected with a new per-thread LOCK_thd_data
        mutex in the mysqld_list_processes function.
      dc0a87fd
  4. 21 Jul, 2009 1 commit
    • MySQL Build Team's avatar
      Backport into build-200907211706-5.0.82sp1 · 924ce229
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 2792
      > revision-id: sergey.glukhov@sun.com-20090703083500-jq8vhw0tqr37j7te
      > parent: bernt.johnsen@sun.com-20090703083610-o7l4s8syz05rc4w0
      > committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
      > branch nick: mysql-5.0-bugteam
      > timestamp: Fri 2009-07-03 13:35:00 +0500
      > message:
      >   Bug#45806 crash when replacing into a view with a join!
      >   The crash happend because for views which are joins
      >   we have table_list->table == 0 and 
      >   table_list->table->'any method' call leads to crash.
      >   The fix is to perform table_list->table->file->extra()
      >   method for all tables belonging to view.
      924ce229
  5. 03 Jul, 2009 1 commit
    • Sergey Glukhov's avatar
      Bug#45806 crash when replacing into a view with a join! · 2dd70946
      Sergey Glukhov authored
      The crash happend because for views which are joins
      we have table_list->table == 0 and 
      table_list->table->'any method' call leads to crash.
      The fix is to perform table_list->table->file->extra()
      method for all tables belonging to view.
      
      
      mysql-test/r/view.result:
        test result
      mysql-test/t/view.test:
        test case
      sql/sql_insert.cc:
        added prepare_for_positional_update() function
        which updates extra info about primary key for
        tables belonging to view.
      2dd70946
  6. 22 Jun, 2009 1 commit
    • Martin Hansson's avatar
      · 543885d1
      Martin Hansson authored
      Bug#44653: Server crash noticed when executing random queries with partitions.
      
      When opening a table, it is imperative that the flag
      TABLE::auto_increment_field_not_null be false. But if an error occured during
      the creation of a table (e.g. the table exists already) with an auto_increment
      column and a BEFORE trigger that used the INSERT ... SELECT construct, the
      flag was not reset until after error checking. Thus if an error occured,
      select_insert::send_data() returned immediately and it was not reset (see * in
      pseudocode below).  Crash happened if the table was opened again. Fixed by
      resetting the flag after error checking.
      
      nested-loops_join():
        for each row in SELECT table {
          select_insert::send_data():
            if a values is supplied for AUTO_INCREMENT column
               table->auto_increment_field_not_null= TRUE
             else
               table->auto_increment_field_not_null= FALSE
             if (error)
               return 1; *
             if (table->auto_increment_field_not_null == FALSE)
               ...
             table->auto_increment_field_not_null == FALSE 
        }
      <-- table returned to table cache and later retrieved by open_table: 
      open_table():
        assert(table->auto_increment_field_not_null)
      
      
      mysql-test/r/trigger.result:
        Bug#44653: Test result
      mysql-test/t/trigger.test:
        Bug#44653: Test case
      sql/sql_insert.cc:
        Bug#44653: Fix: Make sure to unset this field before returning in case of error
      543885d1
  7. 18 Jun, 2009 1 commit
    • Alfranio Correia's avatar
      BUG#43929 binlog corruption when max_binlog_cache_size is exceeded · 3cf052b7
      Alfranio Correia authored
      Large transactions and statements may corrupt the binary log if the size of the
      cache, which is set by the max_binlog_cache_size, is not enough to store the
      the changes.
      
      In a nutshell, to fix the bug, we save the position of the next character in the
      cache before starting processing a statement. If there is a problem, we simply
      restore the position thus removing any effect of the statement from the cache.
      Unfortunately, to avoid corrupting the binary log, we may end up loosing changes
      on non-transactional tables if they do not fit in the cache. In such cases, we
      store an Incident_log_event in order to stop the slave and alert users that some
      changes were not logged.
      
      Precisely, for every non-transactional changes that do not fit into the cache,
      we do the following:
        a) the statement is *not* logged
        b) an incident event is logged after committing/rolling back the transaction,
        if any. Note that if a failure happens before writing the incident event to
        the binary log, the slave will not stop and the master will not have reported
        any error.
        c) its respective statement gives an error
      
      For transactional changes that do not fit into the cache, we do the following:
        a) the statement is *not* logged
        b) its respective statement gives an error
      
      To work properly, this patch requires two additional things. Firstly, callers to
      MYSQL_BIN_LOG::write and THD::binlog_query must handle any error returned and
      take the appropriate actions such as undoing the effects of a statement. We
      already changed some calls in the sql_insert.cc, sql_update.cc and sql_insert.cc
      modules but the remaining calls spread all over the code should be handled in
      BUG#37148. Secondly, statements must be either classified as DDL or DML because
      DDLs that do not get into the cache must generate an incident event since they
      cannot be rolled back.
      3cf052b7
  8. 17 Jun, 2009 1 commit
    • Staale Smedseng's avatar
      Bug #43414 Parenthesis (and other) warnings compiling MySQL · 3b0e6e41
      Staale Smedseng authored
      with gcc 4.3.2
            
      Compiling MySQL with gcc 4.3.2 and later produces a number of 
      warnings, many of which are new with the recent compiler
      versions.
                        
      This bug will be resolved in more than one patch to limit the
      size of changesets. This is the second patch, fixing more
      of the warnings.
      3b0e6e41
  9. 10 Jun, 2009 1 commit
    • Staale Smedseng's avatar
      Bug #43414 Parenthesis (and other) warnings compiling MySQL · a1035097
      Staale Smedseng authored
      with gcc 4.3.2
      
      Compiling MySQL with gcc 4.3.2 and later produces a number of 
      warnings, many of which are new with the recent compiler
      versions.
                  
      This bug will be resolved in more than one patch to limit the
      size of changesets. This is the second patch, fixing more
      of the warnings.
      a1035097
  10. 04 Jun, 2009 1 commit
    • Tatiana A. Nurnberg's avatar
      Bug#32149: Long semaphore wait for adaptive hash latch · e34085fe
      Tatiana A. Nurnberg authored
      Holding on to the temporary inno hash index latch is an optimization in
      many cases, but a pessimization in some others.
      
      Release temporary latches for those corner cases we (or rather, or customers,
      thanks!) have identified, that is, when we are about to do something that
      might take a really long time, like REPAIR or filesort.
      
      sql/ha_myisam.cc:
        Let go of (inno, for now) latch when doing MyISAM-repair.
        (optimize passes through repair.) ("Stuck" in "Repair with
        keycache".)
      sql/sql_insert.cc:
        Let go of (inno, for now) latch when doing CREATE...SELECT
        in select_insert::send_data() -- it might take a while.
        ("stuck" in "Sending data")
      sql/sql_select.cc:
        Release temporary (inno, for now) latch on
        - free_tmp_table() (this can take surprisingly long, "removing tmp table")
        - create_myisam_from_heap() (HEAP table overflowing onto disk as MyISAM,
          "converting HEAP to MyISAM")
      e34085fe
  11. 30 May, 2009 1 commit
    • He Zhenxing's avatar
      BUG#41948 Query_log_event constructor needlessly contorted · abf5f8da
      He Zhenxing authored
      Make the caller of Query_log_event, Execute_load_log_event
      constructors and THD::binlog_query to provide the error code
      instead of having the constructors to figure out the error code.
      
      sql/log_event.cc:
        Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
      sql/log_event.h:
        Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
      abf5f8da
  12. 27 Mar, 2009 2 commits
    • Georgi Kodinov's avatar
      fixed a compilation warning · 5f2bda83
      Georgi Kodinov authored
      5f2bda83
    • He Zhenxing's avatar
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053 · 51a91166
      He Zhenxing authored
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
      51a91166
  13. 24 Mar, 2009 2 commits
    • Georgi Kodinov's avatar
      Fixed initialization order warining. · f3a08d56
      Georgi Kodinov authored
      f3a08d56
    • Leonard Zhou's avatar
      BUG#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging · 5fdc5510
      Leonard Zhou authored
      When do 'insert delayed' operation, the time_zone info doesn't be keeped in the row info.
      So when we do insert sometime later, time_zone didn't write into binlog.
      This will cause wrong result for timestamp column in slave.
      
      Our solution is that adding time_zone info with the delayed-row and
      restoring time_zone from row-info when execute that row in the furture by another thread.
      So we can write correct time_zone info into binlog and got correct result in slave.
      
      
      mysql-test/r/rpl_timezone.result:
        Test result
      mysql-test/t/rpl_timezone.test:
        Add test for bug#41719
      sql/sql_insert.cc:
        Add time_zone info in the delayed-row and restore time_zone when execute the row in the furture by another thread.
      5fdc5510
  14. 19 Feb, 2009 1 commit
    • Davi Arnaut's avatar
      Bug#41098: Query Cache returns wrong result with concurrent insert · 664bb23a
      Davi Arnaut authored
      The problem is that select queries executed concurrently with
      a concurrent insert on a MyISAM table could be cached if the
      select started after the query cache invalidation but before
      the unlock of tables performed by the concurrent insert. This
      race could happen because the concurrent insert was failing
      to prevent cache of select queries happening at the same time.
      
      The solution is to add a 'uncacheable' status flag to signal
      that a concurrent insert is being performed on the table and
      that queries executing at the same time shouldn't cache the
      results.
      
      mysql-test/r/query_cache_debug.result:
        Add test case result for Bug#41098
      mysql-test/t/disabled.def:
        Re-enable test case.
      mysql-test/t/query_cache_debug.test:
        Add test case for Bug#41098
      sql/sql_cache.cc:
        Debug sync point for regression testing purposes.
      sql/sql_insert.cc:
        Remove meaningless query cache invalidate. There is already
        a preceding invalidate for queries that started before the
        concurrent insert.
      storage/myisam/ha_myisam.cc:
        Check for a active concurrent insert.
      storage/myisam/mi_locking.c:
        Signal the start of a concurrent insert. Flag is zeroed once
        the state is updated back.
      storage/myisam/myisamdef.h:
        Add flag to signal a active concurrent insert.
      664bb23a
  15. 10 Feb, 2009 1 commit
  16. 03 Feb, 2009 1 commit
    • Davi Arnaut's avatar
      Bug#40536: SELECT is blocked by INSERT DELAYED waiting on · c9dc936a
      Davi Arnaut authored
                 upgrading lock, even with low_priority_updates
      
      The problem is that there is no mechanism to control whether a
      delayed insert takes a high or low priority lock on a table.
      
      The solution is to modify the delayed insert thread ("handler")
      to take into account the global value of low_priority_updates
      when taking table locks. The value of low_priority_updates is
      retrieved when the insert delayed thread is created and will
      remain the same for the duration of the thread.
      
      
      include/thr_lock.h:
        Update prototype.
      mysql-test/r/delayed.result:
        Add test case result for Bug#40536
      mysql-test/t/delayed.test:
        Add test case for Bug#40536
      mysys/thr_lock.c:
        Add function parameter which specifies the write lock type.
      sql/sql_insert.cc:
        Take a low priority write lock if global value of low_priority_updates
        was ON when the thread was created.
      c9dc936a
  17. 31 Jan, 2009 1 commit
    • Michael Widenius's avatar
      Fixed compiler warnings found by gcc 4.3.2 · bd4e6551
      Michael Widenius authored
      - Added braces around expressions with &&, ||, & and |
      - Added empty line before ; for empty while and for loops
      - Added () around if with assignments
      - Removed const before function returning simple type
      
      Changed BUILD scripts to not build with NDB 
      
      
      BUILD/SETUP.sh:
        By default, don't build ndb with --max in Maria tree.
        NDB is not kept up to date anyway in 5.1
      client/mysql.cc:
        Added braces around && to get rid of compiler warnings
      sql/event_db_repository.cc:
        Added braces around && to get rid of compiler warnings
      sql/events.cc:
        Added braces around && to get rid of compiler warnings
      sql/field.cc:
        Added braces around && to get rid of compiler warnings
        Fixed for loops
      sql/field.h:
        Added braces around & to get rid of compiler warnings
      sql/field_conv.cc:
        Added braces around && to get rid of compiler warnings
        Fixed bug when copying between DATETIME fields and strict dates are used
        Removed not needeed else
      sql/gstream.cc:
        Added braces around && to get rid of compiler warnings
      sql/ha_ndbcluster.cc:
        Added braces around && to get rid of compiler warnings
        Added {} to get rid of compiler warnings
      sql/handler.cc:
        Added braces around && to get rid of compiler warnings
      sql/item.cc:
        Added braces around && to get rid of compiler warnings
      sql/item_cmpfunc.cc:
        Added braces around && to get rid of compiler warnings
        Removed some not needed space
      sql/item_func.cc:
        Added braces around && to get rid of compiler warnings
      sql/item_strfunc.cc:
        Added braces around && to get rid of compiler warnings
      sql/item_subselect.cc:
        Added braces around && to get rid of compiler warnings
      sql/item_sum.cc:
        Added braces around && to get rid of compiler warnings
      sql/item_timefunc.cc:
        Added braces around && to get rid of compiler warnings
      sql/item_xmlfunc.cc:
        Added empty line before ; for empty while and for loops
      sql/log.cc:
        Added braces around && to get rid of compiler warnings
      sql/log_event.cc:
        Added braces around && to get rid of compiler warnings
        Removed not needed else
      sql/log_event_old.cc:
        Added braces around && to get rid of compiler warnings
      sql/opt_range.cc:
        Added braces around && to get rid of compiler warnings
      sql/opt_sum.cc:
        Added braces around && to get rid of compiler warnings
      sql/set_var.cc:
        Added empty line before ; for empty while and for loops
        Added () around if with assignments
      sql/slave.cc:
        Added braces around && to get rid of compiler warnings
        Added empty line before ; for empty while and for loops
      sql/spatial.h:
        Added braces around && to get rid of compiler warnings
      sql/sql_acl.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_analyse.cc:
        Added empty line before ; for empty while and for loops
      sql/sql_base.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_connect.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_db.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_delete.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_help.cc:
        Added empty line before ; for empty while and for loops
      sql/sql_insert.cc:
        Added braces around && to get rid of compiler warnings
        Added () around if with assignments
      sql/sql_lex.cc:
        Cast char array references to uchar; Fixed wrong array referencing when using characters > ASCII 128 in SQL statments
        Added empty line before ; for empty while and for loops
        Trivial indent fixes
        Added braces around && to get rid of compiler warnings
      sql/sql_load.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_parse.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_partition.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_plugin.cc:
        Fixed bug in detecing if option variable should be readonly
        Added empty line before ; for empty while and for loops
      sql/sql_prepare.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_select.cc:
        Added braces around && to get rid of compiler warnings
        Added () around if with assignments
        Added empty line before ; for empty while and for loops
      sql/sql_show.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_table.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_trigger.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_update.cc:
        Added braces around && to get rid of compiler warnings
      sql/sql_yacc.yy:
        Added braces around && to get rid of compiler warnings
      sql/table.cc:
        Added braces around && to get rid of compiler warnings
      sql/table.h:
        Added braces around && to get rid of compiler warnings
      sql/time.cc:
        Added braces around && to get rid of compiler warnings
      sql/tztime.cc:
        Added braces around && to get rid of compiler warnings
      sql/uniques.cc:
        Added braces around && to get rid of compiler warnings
      storage/federated/ha_federated.cc:
        Fixed bug in testing of variable to ha_info() (Not critical)
      storage/heap/ha_heap.cc:
        Added braces around && to get rid of compiler warnings
      storage/maria/ha_maria.cc:
        Fixed bug: Mark that maria_log_dir_path is readonly
        Added braces around && to get rid of compiler warnings
      storage/ndb/include/ndbapi/NdbEventOperation.hpp:
        Removed const before function returning simple type
      storage/ndb/include/ndbapi/NdbOperation.hpp:
        Removed const before function returning simple type
      storage/ndb/src/ndbapi/Ndb.cpp:
        Added empty line before ; for empty while and for loops
      storage/ndb/src/ndbapi/NdbEventOperation.cpp:
        Removed const before function returning simple type
      storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
        Removed const before function returning simple type
      storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
        Removed const before function returning simple type
      storage/ndb/src/ndbapi/NdbRecAttr.cpp:
        Added empty line before ; for empty while and for loops
      storage/ndb/src/ndbapi/TransporterFacade.hpp:
        Added braces around && to get rid of compiler warnings
      bd4e6551
  18. 16 Jan, 2009 1 commit
    • Michael Widenius's avatar
      Fixed issues in last push found by pushbuild · 364f8611
      Michael Widenius authored
      sql/sql_insert.cc:
        Removed DBUG_ASSERT() that is triggered by deadlock-innodb test
      storage/maria/ma_loghandler.c:
        Removed compiler warnings
      storage/maria/trnman_public.h:
        Fixed wrong code from last push
      364f8611
  19. 15 Jan, 2009 1 commit
    • Michael Widenius's avatar
      Log queries to maria_log if compiled with EXTRA_DEBUG · 3fca2390
      Michael Widenius authored
      Added DBUG_ASSERT() to unlikely error senario
      Don't use errno == 0 in maria_create() / myisam_create()
      
      sql/sql_insert.cc:
        Added DBUG_ASSERT() for case that should never happen in real life
        Added my_error() to avoid assert if mysql_lock() or postlock() doesn't call my_error()
      storage/maria/ha_maria.cc:
        Log queries to maria_log if compiled with EXTRA_DEBUG
      storage/maria/ma_create.c:
        Don't use errno == 0
      storage/maria/ma_loghandler.c:
        Added logging of debug info to maria_log
      storage/maria/ma_loghandler.h:
        Added logging of debug info to maria_log
      storage/maria/ma_recovery.c:
        Added printing of debug info from maria_log
      storage/maria/trnman.c:
        Added functions to read/store state in TRN
      storage/maria/trnman.h:
        Added functions to read/store state in TRN
      storage/maria/trnman_public.h:
        Added state in TRN to remmeber if we have already logged the query
      storage/myisam/mi_create.c:
        Don't use errno == 0
      3fca2390
  20. 09 Jan, 2009 1 commit
    • Michael Widenius's avatar
      Fixed bugs from my latest patch found by pushbuild: · 7dc83c50
      Michael Widenius authored
      Bug #41962 Maria: view-related test failures (insert, view, maria, trigger tests)
      Added error handling for wrong update of view.
      See Bug #41760 Inserting into multiple-table views is not working
      
      mysql-test/r/delayed.result:
        Fixed test as we are now testing values before fields.
        Added new tests to test all error combinations
      mysql-test/suite/maria/r/maria.result:
        Added error handling for not supported update of view.
      mysql-test/suite/maria/t/maria.test:
        Added error handling for not supported update of view.
      mysql-test/t/delayed.test:
        Fixed test as we are now testing values before fields.
        Added new tests to test all error combinations
      sql/sql_base.cc:
        Fixed warning from valgrind
      sql/sql_insert.cc:
        Don't test from which table values are in case of INSERT ... SELECT
        Run fix_fields() in values before we do it on fields.
        This is needed becasue check_view_single_update() are accessing values.
      storage/maria/ma_blockrec.c:
        Don't call pagecache_delete_pages() if no pages to delete.
        This fixes a DBUG_ASSERT() error in maria_test_recovery
      7dc83c50
  21. 27 Dec, 2008 1 commit
    • Michael Widenius's avatar
      Fixed bugs found by pushbuild · 910284e6
      Michael Widenius authored
      Added code to detect and give error when doing an insert into a view where we accessed fields in a not yet read table
      Disabled test in subselect.test as the CHECK_OPTION for views doesn't work for insert.
      This needs to be fixed properly later.
      
      The problem with views are described in Bug #41760 Inserting into multiple-table views is not working
      
      mysql-test/r/insert.result:
        Fixed wrong usage of insert into view.
      mysql-test/r/subselect.result:
        Disabled wrong test (temporary)
      mysql-test/suite/maria/r/maria.result:
        Added test of size of table
      mysql-test/suite/maria/t/maria.test:
        Added test of size of table
      mysql-test/t/insert.test:
        Fixed wrong usage of insert into view
        The bug is that during insert/update we currently don't read any of the referenced tables of the view.
        This means that we can't get a value from another table to use as part of the update.
      mysql-test/t/subselect.test:
        Disabled not working test until someone has time to fix insert into view properly
        Here we where refering to last used value in t2, which is wrong.
      sql/sql_insert.cc:
        Detect if we are trying to update one table in a view based on value in another, not yet read, table.
        This fixes the problem discovered in insert.test
      storage/maria/ma_blockrec.c:
        Don't ignore not critical changes to the last page in the table.
        We need to write the last page as otherwise we can during aborting of a row with a duplicate key get
        state.data_file_length and the real length of file out of sync
      storage/maria/ma_check.c:
        Flush the page cache even if we got an error during zerofill.
        (This fixes a call to assert() in case of a too short data file)
      storage/maria/ma_pagecache.c:
        Mark page as read when we do a write of a full page.
        This fixes a bug when we got an error during read and then used direct write to page to update it
      storage/maria/ma_state.c:
        Restore info->lock.type after call to maria_versioning.
        Fixed crash in maria_recover.test
      storage/maria/maria_read_log.c:
        Don't write thread id in debug log. (Not needed as maria_read_log is a single treaded program)
      910284e6
  22. 02 Dec, 2008 1 commit
    • Michael Widenius's avatar
      WL#3262 add mutex lock order checking to safemutex (also called safe_mutex_deadlock_detector) · 32f81bab
      Michael Widenius authored
      This writes a warning on stderr if one uses mutex in different order,
      like if one in one case would lock mutex in the order A,B and in another case
      would lock mutex in the order B,A
      This is inspired by and loosely based on the LOCKDEP patch by Jonas
      Wrong mutex order is either fixed or mutex are marked with MYF_NO_DEADLOCK_DETECTION
      if used inconsistently (need to be fixed by server team)
      
      KNOWN_BUGS.txt:
        Added information that one need to dump and restore Maria tables
      include/hash.h:
        Added prototype function for walking over all elements in a hash
      include/my_pthread.h:
        Added my_pthread_mutex_init() and my_pthread_mutex_lock(); These should be used if one wants to disable mutex order checking.
        Changed names of the nonposix mutex_init functions to not conflict with my_phread_mutex_init()
        Added and extended structures for mutex deadlock detection.
        New arguments to sage_mutex_init() and safe_mutex_lock() to allow one to disable mutex order checking.
        Added variable 'safe_mutex_deadlock_detector' to enable/disable deadlock detection for all pthread_mutex_init()
      mysys/Makefile.am:
        Added cleaning of test files
        Added test_thr_mutex
      mysys/hash.c:
        Added hash_iterate() to iterate over all elements in a hash
        More comments
      mysys/my_init.c:
        Added calls to destory all mutex uses by mysys()
        Added waiting for threads to end before calling TERMINATE() to list not freed memory
      mysys/my_pthread.c:
        Changed names to free my_pthread_mutex_init() for mutex-lock-order-checking
      mysys/my_sleep.c:
        Fixed too long wait if using 1000000L as argument
      mysys/my_thr_init.c:
        Mark THR_LOCK_threads and THR_LOCK_malloc to not have mutex deadlock detection.
        (We can't have it enabled for this as these are internal mutex used by the detector  
        Call my_thread_init() early as we need thread specific variables enabled for the following pthread_mutex_init()
        Move code to wait for threads to end to my_wait_for_other_threads_to_die()
        Don't destroy mutex and conditions unless all threads have died
        Added my_thread_destroy_mutex() to destroy all mutex used by the mysys thread system
        Name the thread specific mutex as "mysys_var->mutex"
        Added my_thread_var_mutex_in_use() to return pointer to mutex in use or 0 if thread variables are not initialized
      mysys/mysys_priv.h:
        Added prototypes for functions used internally with mutex-wrong-usage detection
      mysys/thr_mutex.c:
        Added runtime detection of mutex used in conflicting order
        See WL#3262 or test_thr_mutex.c for examples
        The base idea is for each mutex have two hashes:
        - mutex->locked_mutex points to all mutex used after this one
        - mutex->used_mutex points to all mutex which has this mutex in it's mutex->locked_mutex
        There is a wrong mutex order if any mutex currently locked before this mutex is in the mutex->locked_mutex hash
      sql/event_queue.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/event_scheduler.cc:
        Declare the right order to take the mutex
      sql/events.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/ha_ndbcluster_binlog.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/log.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/mysqld.cc:
        Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
        This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
        Added call to free sp cache.
        Add destruction of LOCK_server_started and COND_server_started.
        Added register_mutex_order() function to register in which order mutex should be taken
        (to initiailize mutex_deadlock_detector).
        Added option to turn off safe_mutex_deadlock_detector
      sql/protocol.cc:
        Fixed wrong argument to DBUG_PRINT (found by valgrind)
      sql/rpl_mi.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/set_var.cc:
        Remove wrong locking of LOCK_global_system_variables when reading and setting log variables
        (would cause inconsistent mutex order).
        Update global variables outside of logger.unlock() as LOCK_global_system_variables has to be taken before logger locks
        Reviewed by gluh
      sql/sp_cache.cc:
        Added function to destroy mutex used by sp cache
      sql/sp_cache.h:
        Added function to destroy mutex used by sp cache
      sql/sql_class.cc:
        Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
        This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
        Register order in which LOCK_delete and mysys_var->mutex is taken
      sql/sql_insert.cc:
        Give a name for Delayed_insert::mutex
        Mark mutex used inconsistently (need to be fixed by server team)
        Move closing of tables outside of di->mutex (to avoid wrong mutex order)
      sql/sql_show.cc:
        Don't keep LOCK_global_system_variables locked over value->show_type() as this leads to wrong mutex order
      storage/innobase/handler/ha_innodb.cc:
        Disable safe_muted_deadlock_detector for innobase intern mutex (to speed up page cache initialization)
      storage/maria/ha_maria.cc:
        Added flag to ha_maria::info() to signal if we need to lock table share or not.
        This is needed to avoid locking mutex in wrong order
      storage/maria/ha_maria.h:
        Added flag to ha_maria::info() to signal if we need to lock table share or not.
      storage/maria/ma_close.c:
        Destroy key_del_lock
        Simplify freeing ftparser_param
      storage/maria/ma_key.c:
        Better comment
      storage/maria/ma_loghandler.c:
        Mark mutex used inconsistently (need to be fixed by sanja)
      storage/maria/ma_state.c:
        More comments
      storage/maria/ma_test1.c:
        Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
      storage/maria/ma_test2.c:
        Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
      32f81bab
  23. 10 Nov, 2008 1 commit
  24. 15 Oct, 2008 1 commit
    • Georgi Kodinov's avatar
      Bug #38693: leaked memory with blobs! · 74735183
      Georgi Kodinov authored
      If delayed insert fails to upgrade the lock it was not
      freeing the temporary memory storage used to keep
      newly constructed blob values in memory.
      Fixed by iterating over the remaining rows in the delayed
      insert rowset and freeing the blob storage for each row.
      
      No test suite because it involves concurrent delayed inserts 
      on a table and cannot easily be made deterministic. 
      
      Added a correct valgrind suppression for Fedora 9.
      
      mysql-test/valgrind.supp:
        Added a vagrind suppression for Fedora 9
      sql/sql_insert.cc:
        Bug #38693: free the blobs temp storage on error.
      74735183
  25. 08 Oct, 2008 1 commit
    • Mats Kindahl's avatar
      Bug #34707: Row based replication: slave creates table within wrong database · dcd050c5
      Mats Kindahl authored
      The failure was caused by executing a CREATE-SELECT statement that creates a
      table in another database than the current one. In row-based logging, the
      CREATE statement was written to the binary log without the database, hence
      creating the table in the wrong database, causing the following inserts to
      fail since the table didn't exist in the given database.
      
      Fixed the bug by adding a parameter to store_create_info() that will make
      the function print the database name before the table name and used that
      in the calls that write the CREATE statement to the binary log. The database
      name is only printed if it is different than the currently selected database.
      
      The output of SHOW CREATE TABLE has not changed and is still printed without
      the database name.
      
      mysql-test/suite/rpl/t/rpl_row_create_table.test:
        Added test to check that CREATE-SELECT into another database than the
        current one replicates.
      sql/sql_insert.cc:
        Adding parameter to calls to store_create_info().
      sql/sql_show.cc:
        Adding parameter to calls to store_create_info().
        
        Extending store_create_info() with parameter 'show_database' that will cause
        the database to be written before the table name.
      sql/sql_show.h:
        Adding parameter to call to store_create_info() to tell if the database should be shown or not.
      sql/sql_table.cc:
        Adding parameter to calls to store_create_info().
      dcd050c5
  26. 07 Oct, 2008 1 commit
    • Kristofer Pettersson's avatar
      Bug#38692 concurrent inserts cause valgrind errors in Query_cache::invalidate · 85ca9837
      Kristofer Pettersson authored
      Concurrent inserts produce valgrind error messages.
      The reason is that the query cache is invalidated after the target table object
      is closed.
      
      Since the delayed insert thread already takes care of invalidating the query
      cache there is no need to try to synchronize an extra cache invalidation call.
      
      The fix is to remove the query_cache_invalidate3 call altogether.
      
      sql/sql_insert.cc:
        When end_delayed_insert is called, the table_list items will be invalidated
        by the concurrent insert thread. Further more there is no need to call
        query_cache_invalidate here since the delayed insert thread takes care of
        this already.
      85ca9837
  27. 26 Sep, 2008 1 commit
    • Michael Widenius's avatar
      Fixed for Bug #39248 Maria: INSERT ON DUPLICATE KEY UPDATE gives error if using a view · 2a9d33f0
      Michael Widenius authored
      The bug was that prepared statements didn't downgrade TL_WRITE_CONCURRENT properly
      
      mysql-test/r/maria.result:
        Added test case
      mysql-test/t/maria.test:
        Added test case
      sql/mysql_priv.h:
        Make upgrade_lock_type() global
      sql/sql_base.cc:
        Fixed indentation
      sql/sql_insert.cc:
        Make upgrade_lock_type() global
      sql/sql_prepare.cc:
        Call upgrade_lock_type_for_insert() to get right lock to use
      sql/sql_view.cc:
        Indentation fix
      2a9d33f0
  28. 16 Sep, 2008 1 commit
    • Narayanan V's avatar
      Bug#38338: REPLACE causes last_insert_id() to return an incorrect value · d714d290
      Narayanan V authored
                        
      Fix the write_record function to record auto increment
      values in a consistent way.
      
      mysql-test/r/auto_increment.result:
        Updated the test result file with the output of the
        new test case added to verify this bug.
      mysql-test/t/auto_increment.test:
        Added a new test case to verify this bug.
      sql/sql_insert.cc:
        The algorithm for the write_record function
        in sql_insert.cc is (more emphasis given to
        the parts that deal with the autogenerated values)
        
        1) If a write fails
        
           1.1) save the autogenerated value to avoid 
                thd->insert_id_for_cur_row to become 0.
        
           1.2) <logic to handle INSERT ON DUPLICATE KEY
                UPDATE and REPLACE>
        
        2) record the first successful insert id.
        
        explanation of the failure
        --------------------------
        
        As long as 1.1) was executed 2) worked fine.
        
        1.1) was always executed when REPLACE worked 
             with the last row update optimization, but
             in cases where 1.1) was not executed 2)
             would fail and would result in the autogenerated
             value not being saved.
        
        solution
        --------
        
        repeat a check for thd->insert_id_for_cur_row 
        being zero similar to 1.1) before 2) and ensure
        that the correct value is saved.
      d714d290
  29. 10 Sep, 2008 1 commit
    • Kristofer Pettersson's avatar
      Bug#38692 concurrent inserts cause valgrind errors in Query_cache::invalidate · a8b25524
      Kristofer Pettersson authored
            
      If a delayed insert thread was aborted by a concurrent 'truncate table'
      statement, then the diagnostic area would fail with an assert in a debug build
      because no actual error message was pushed on the stack despite a thread
      being killed.
            
      This patch adds an error message to the stack.
      
      
      sql/sql_insert.cc:
        * Changed sql_print_error() to my_error() to avoid assertion in the DA
        * Added assertion in "should never happen" branch.
      a8b25524
  30. 03 Sep, 2008 1 commit
    • Ramil Kalimullin's avatar
      Fix for bug#38821: Assert table->auto_increment_field_not_null failed · f0a50bd9
      Ramil Kalimullin authored
      in open_table()
      
      Problem: repeating "CREATE... ( AUTOINCREMENT) ... SELECT" may lead to
      an assertion failure.
      
      Fix: reset table->auto_increment_field_not_null after each record 
      writing.
      
      
      mysql-test/r/create.result:
        Fix for bug#38821: Assert table->auto_increment_field_not_null failed 
        in open_table()
          - test result.
      mysql-test/t/create.test:
        Fix for bug#38821: Assert table->auto_increment_field_not_null failed 
        in open_table()
          - test case.
      sql/sql_insert.cc:
        Fix for bug#38821: Assert table->auto_increment_field_not_null failed 
        in open_table()
          - reset table->auto_increment_field_not_null after writing a record
        for "{CREATE, INSERT}..SELECT".
      f0a50bd9
  31. 29 Aug, 2008 1 commit
    • Andrei Elkin's avatar
      Bug #38798 Assertion mysql_bin_log.is_open() failed in binlog_trans_log_savepos() · c0de944f
      Andrei Elkin authored
            
      The assert is about binlogging must have been activated, but it was
      not actually according to the reported how-to-repeat instuctions.
      Analysis revealed that binlog_start_trans_and_stmt() was called
      without prior testing if binlogging is ON.
      
      Fixed with avoing entering binlog_start_trans_and_stmt() if binlog is
      not activated.
      
      
      mysql-test/r/skip_log_bin.result:
        new results.
      mysql-test/t/skip_log_bin-master.opt:
        the option to deactivate binlogging.
      mysql-test/t/skip_log_bin.test:
        regression test for the bug.
      sql/sql_insert.cc:
        avoing entering binlog_start_trans_and_stmt() if binlog is not activated.
      c0de944f
  32. 19 Aug, 2008 1 commit
    • Mats Kindahl's avatar
      Bug #34707: Row based replication: slave creates table within wrong database · 5cd9d96a
      Mats Kindahl authored
      The failure was caused by executing a CREATE-SELECT statement that creates a
      table in another database than the current one. In row-based logging, the
      CREATE statement was written to the binary log without the database, hence
      creating the table in the wrong database, causing the following inserts to
      fail since the table didn't exist in the given database.
      
      Fixed the bug by adding a parameter to store_create_info() that will make
      the function print the database name before the table name and used that
      in the calls that write the CREATE statement to the binary log. The database
      name is only printed if it is different than the currently selected database.
      
      The output of SHOW CREATE TABLE has not changed and is still printed without
      the database name.
      
      mysql-test/suite/rpl/r/rpl_row_create_table.result:
        Result file change.
      mysql-test/suite/rpl/t/rpl_row_create_table.test:
        Added test to check that CREATE-SELECT into another database than the
        current one replicates.
      sql/sql_insert.cc:
        Adding parameter to calls to store_create_info().
      sql/sql_show.cc:
        Adding parameter to calls to store_create_info().
        
        Extending store_create_info() with parameter 'show_database' that will cause
        the database to be written before the table name.
      sql/sql_show.h:
        Adding parameter to call to store_create_info() to tell if the database should be shown or not.
      sql/sql_table.cc:
        Adding parameter to calls to store_create_info().
      5cd9d96a
  33. 30 Jun, 2008 1 commit
    • Mats Kindahl's avatar
      BUG#37426: RBR breaks for CHAR() UTF-8 fields > 85 chars · 711305e2
      Mats Kindahl authored
            
      In order to handle CHAR() fields, 8 bits were reserved for
      the size of the CHAR field. However, instead of denoting the
      number of characters in the field, field_length was used which
      denotes the number of bytes in the field.
      
      Since UTF-8 fields can have three bytes per character (and
      has been extended to have four bytes per character in 6.0),
      an extra two bits have been encoded in the field metadata
      work for fields of type Field_string (i.e., CHAR fields).
      
      Since the metadata word is filled, the extra bits have been
      encoded in the upper 4 bits of the real type (the most 
      significant byte of the metadata word) by computing the
      bitwise xor of the extra two bits. Since the upper 4 bits
      of the real type always is 1111 for Field_string, this 
      means that for fields of length <256, the encoding is
      identical to the encoding used in pre-5.1.26 servers, but
      for lengths of 256 or more, an unrecognized type is formed,
      causing an old slave (that does not handle lengths of 256
      or more) to stop.
      
      
      mysql-test/extra/rpl_tests/rpl_row_basic.test:
        Adding test cases for replicating UTF-8 fields of lengths
        of 256 or more (bytes).
      mysql-test/suite/binlog/r/binlog_base64_flag.result:
        Result file change.
      mysql-test/suite/binlog/t/binlog_base64_flag.test:
        Adding tests to trigger check that an error is generated when replicating from a
        5.1.25 server for tables with a CHAR(128) but not when replicating a table with a
        CHAR(63). Although the bug indicates that the limit is 83, we elected to use CHAR(63)
        since 6.0 uses 4-byte UTF-8, and anything exceeding 63 would then cause the test to fail
        when the patch is merged to 6.0.
      mysql-test/suite/bugs/combinations:
        Adding combinations file to run all bug reports in all binlog modes (where
        applicable).
      mysql-test/suite/bugs/r/rpl_bug37426.result:
        Result file change.
      mysql-test/suite/bugs/t/rpl_bug37426.test:
        Added test for reported bug.
      mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result:
        Result file change.
      mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result:
        Result file change.
      sql/field.cc:
        Encoding an extra two bits in the most significant nibble (4 bits)
        of the metadata word. Adding assertions to ensure that no attempt
        is made to use lengths longer than supported.
        
        Extending compatible_field_size() function with an extra parameter
        holding a Relay_log_instace for error reporting.
        
        Field_string::compatible_field_size() now reports an error if field
        size for a CHAR is >255.
      sql/field.h:
        Field length is now computed from most significant 4 bits
        of metadata word, or is equal to the row pack length if
        there is no metadata.
        
        Extending compatible_field_size() function with an extra parameter
        holding a Relay_log_instace for error reporting.
      sql/rpl_utility.cc:
        Adding relay log parameter to compatible_field_size().
        
        Minor refactoring to eliminate duplicate code.
      sql/slave.cc:
        Extending rpl_master_has_bug() with a single-argument predicate function and
        a parameter to the predicate function. The predicate function can be used to
        test for extra conditions for the bug before writing an error message.
      sql/slave.h:
        Extending rpl_master_has_bug() with a single-argument predicate function and
        a parameter to the predicate function. The predicate function can be used to
        test for extra conditions for the bug before writing an error message.
        
        Also removing gratuitous default argument.
      sql/sql_insert.cc:
        Changing calls to rpl_master_has_bug() to adapt to changed signature.
      711305e2
  34. 03 Jun, 2008 2 commits
    • Guilhem Bichot's avatar
      Fix for BUG#36104 "INFORMATION_SCHEMA.TABLES shows TRANSACTIONAL=1 twice in CREATE_OPTIONS" · cd8f6a1e
      Guilhem Bichot authored
      mysql-test/r/maria.result:
        result; before the bugfix it would be "TRANSACTIONAL=1 transactional=1"
      mysql-test/t/maria.test:
        test for BUG#36104 "INFORMATION_SCHEMA.TABLES shows TRANSACTIONAL=1 twice in CREATE_OPTIONS"
      sql-bench/example:
        doblewrite->doublewrite
      sql/mysqld.cc:
        fix of a wrong 5.1->maria merge of the past
      sql/sql_insert.cc:
        removing my old idea of disabling transactionality in CREATE SELECT:
        1) it caused bugs because re-enabling (ha_enable_transaction()) causes implicit commit, so in complex cases
        like "CREATE SELECT some_func())", where some_func() would want to insert two rows in another table, and fail on the second row, the implicit commit would commit the inserted row, while it should roll back.
        2) it's not needed anymore, because CREATE SELECT uses bulk insert, and Maria has transactionality disabled by
        bulk insert.
      sql/sql_show.cc:
        This was duplicate code, causing BUG#36104 "INFORMATION_SCHEMA.TABLES shows TRANSACTIONAL=1 twice in CREATE_OPTIONS"
      cd8f6a1e
    • Mattias Jonsson's avatar
      Bug#31210: INSERT DELAYED crashes server when used on partitioned tables · a8af693b
      Mattias Jonsson authored
        
      Problem was an unclear error message since it could suggest that
      MyISAM did not support INSERT DELAYED.
      Changed the error message to say that DELAYED is not supported by the
      table, instead of the table's storage engine.
      The confusion is that a partitioned table is in somewhat sense using
      the partitioning storage engine, which in turn uses the ordinary
      storage engine. By saying that the table does not support DELAYED we
      do not give any extra informantion about the storage engine or if it
      is partitioned.
      
      mysql-test/r/innodb-replace.result:
        Bug#31210: INSERT DELAYED crashes server when used on partitioned tables
        
        changed error message
      mysql-test/t/innodb-replace.test:
        Bug#31210: INSERT DELAYED crashes server when used on partitioned tables
        
        changed error message
      mysql-test/t/merge.test:
        Bug#31210: INSERT DELAYED crashes server when used on partitioned tables
        
        changed error message
      mysql-test/t/partition_hash.test:
        Bug#31210: INSERT DELAYED crashes server when used on partitioned tables
        
        changed error message
      sql/share/errmsg.txt:
        Bug#31210: INSERT DELAYED crashes server when used on partitioned tables
        
        added error message for tables not supporting DELAYED
      sql/sql_insert.cc:
        Bug#31210: INSERT DELAYED crashes server when used on partitioned tables
        
        changed error message
      a8af693b
  35. 29 May, 2008 1 commit
    • unknown's avatar
      WL#3138: Maria - fast "SELECT COUNT(*) FROM t;" and "CHECKSUM TABLE t" · 5099033c
      unknown authored
      Added argument to maria_end_bulk_insert() to know if the table will be deleted after the operation
      Fixed wrong call to strmake
      Don't call bulk insert in case of inserting only one row (speed optimization as starting/stopping bulk insert
      Allow storing year 2155 in year field
      When running with purify/valgrind avoid copying structures over themself
      Added hook 'trnnam_end_trans_hook' that is called when transaction ends
      Added trn->used_tables that is used to an entry for all tables used by transaction
      Fixed that ndb doesn't crash on duplicate key error when start_bulk_insert/end_bulk_insert are not called
      
      
      include/maria.h:
        Added argument to maria_end_bulk_insert() to know if the table will be deleted after the operation
      include/my_tree.h:
        Added macro 'reset_free_element()' to be able to ignore calls to the external free function.
        Is used to optimize end-bulk-insert in case of failures, in which case we don't want write the remaining keys in the tree
      mysql-test/install_test_db.sh:
        Upgrade to new mysql_install_db options
      mysql-test/r/maria-mvcc.result:
        New tests
      mysql-test/r/maria.result:
        New tests
      mysql-test/suite/ndb/r/ndb_auto_increment.result:
        Fixed error message now when bulk insert is not always called
      mysql-test/suite/ndb/t/ndb_auto_increment.test:
        Fixed error message now when bulk insert is not always called
      mysql-test/t/maria-mvcc.test:
        Added testing of versioning of count(*)
      mysql-test/t/maria-page-checksum.test:
        Added comment
      mysql-test/t/maria.test:
        More tests
      mysys/hash.c:
        Code style change
      sql/field.cc:
        Allow storing year 2155 in year field
      sql/ha_ndbcluster.cc:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/ha_ndbcluster.h:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/ha_partition.cc:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/ha_partition.h:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/handler.cc:
        Don't call get_dup_key() if there is no table object. This can happen if the handler generates a duplicate key error on commit
      sql/handler.h:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored (ie, the table will be deleted)
      sql/item.cc:
        Style fix
        Removed compiler warning
      sql/log_event.cc:
        Added new argument to ha_end_bulk_insert()
      sql/log_event_old.cc:
        Added new argument to ha_end_bulk_insert()
      sql/mysqld.cc:
        Removed compiler warning
      sql/protocol.cc:
        Added DBUG
      sql/sql_class.cc:
        Added DBUG
        Fixed wrong call to strmake
      sql/sql_insert.cc:
        Don't call bulk insert in case of inserting only one row (speed optimization as starting/stopping bulk insert involves a lot of if's)
        Added new argument to ha_end_bulk_insert()
      sql/sql_load.cc:
        Added new argument to ha_end_bulk_insert()
      sql/sql_parse.cc:
        Style fixes
        Avoid goto in common senario
      sql/sql_select.cc:
        When running with purify/valgrind avoid copying structures over themself.  This is not a real bug in itself, but it's a waste of cycles and causes valgrind warnings
      sql/sql_select.h:
        Avoid copying structures over themself.  This is not a real bug in itself, but it's a waste of cycles and causes valgrind warnings
      sql/sql_table.cc:
        Call HA_EXTRA_PREPARE_FOR_DROP if table created by ALTER TABLE is going to be dropped
        Added new argument to ha_end_bulk_insert()
      storage/archive/ha_archive.cc:
        Added new argument to end_bulk_insert()
      storage/archive/ha_archive.h:
        Added new argument to end_bulk_insert()
      storage/federated/ha_federated.cc:
        Added new argument to end_bulk_insert()
      storage/federated/ha_federated.h:
        Added new argument to end_bulk_insert()
      storage/maria/Makefile.am:
        Added ma_state.c and ma_state.h
      storage/maria/ha_maria.cc:
        Versioning of count(*) and checksum
        - share->state.state is now assumed to be correct, not handler->state
        - Call _ma_setup_live_state() in external lock to get count(*)/checksum versioning. In case of
          not versioned and not concurrent insertable table, file->s->state.state contains the correct state information
        
        Other things:
        - file->s -> share
        - Added DBUG_ASSERT() for unlikely case
        - Optimized end_bulk_insert() to not write anything if table is going to be deleted (as in failed alter table)
        - Indentation changes in external_lock becasue of removed 'goto' caused a big conflict even if very little was changed
      storage/maria/ha_maria.h:
        New argument to end_bulk_insert()
      storage/maria/ma_blockrec.c:
        Update for versioning of count(*) and checksum
        Keep share->state.state.data_file_length up to date (not info->state->data_file_length)
        Moved _ma_block_xxxx_status() and maria_versioning() functions to ma_state.c
      storage/maria/ma_check.c:
        Update and use share->state.state instead of info->state
        info->s to share
        Update info->state at end of repair
        Call _ma_reset_state() to update share->state_history at end of repair
      storage/maria/ma_checkpoint.c:
        Call _ma_remove_not_visible_states() on checkpoint to clean up not visible state history from tables
      storage/maria/ma_close.c:
        Remember state history for running transaction even if table is closed
      storage/maria/ma_commit.c:
        Ensure we always call trnman_commit_trn() even if other calls fails. If we don't do that, the translog and state structures will not be freed
      storage/maria/ma_delete.c:
        Versioning of count(*) and checksum:
        - Always update info->state->checksum and info->state->records
      storage/maria/ma_delete_all.c:
        Versioning of count(*) and checksum:
        - Ensure that share->state.state is updated, as here is where we store the primary information
      storage/maria/ma_dynrec.c:
        Use lock_key_trees instead of concurrent_insert to check if trees should be locked.
        This allows us to lock trees both for concurrent_insert and for index versioning.
      storage/maria/ma_extra.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        - share->concurrent_insert -> share->non_transactional_concurrent_insert
        - Don't update share->state.state from info->state if transactional table
        
        Optimization:
        - Don't flush io_cache or bitmap if we are using FLUSH_IGNORE_CHANGED
      storage/maria/ma_info.c:
        Get most state information from current state
      storage/maria/ma_init.c:
        Add hash table and free function to store states for closed tables
        Install hook for transaction commit/rollback to update history state
      storage/maria/ma_key_recover.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
      storage/maria/ma_locking.c:
        Versioning of count(*) and checksum:
        - Call virtual functions (if exists) to restore/update status
        - Move _ma_xxx_status() functions to ma_state.c
        
        info->s -> share
      storage/maria/ma_open.c:
        Versioning of count(*) and checksum:
        - For not transactional tables, set info->state to point to new allocated state structure.
        - Initialize new info->state_start variable that points to state at start of transaction
        - Copy old history states from hash table (maria_stored_states) first time the table is opened
        - Split flag share->concurrent_insert to non_transactional_concurrent_insert & lock_key_tree
        - For now, only enable versioning of tables without keys (to be fixed in soon!)
        - Added new virtual function to restore status in maria_lock_database)
        
        More DBUG
      storage/maria/ma_page.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        - Modify share->state.state.key_file_length under share->intern_lock
      storage/maria/ma_range.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
        
        info->s -> share
      storage/maria/ma_recovery.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        - Update state information on close and when reenabling logging
      storage/maria/ma_rkey.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_rnext.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_rnext_same.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
        - Only skip rows based on file length if non_transactional_concurrent_insert is set
      storage/maria/ma_rprev.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_rsame.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_sort.c:
        Use share->state.state instead of info->state
        Fixed indentation
      storage/maria/ma_static.c:
        Added maria_stored_state
      storage/maria/ma_update.c:
        Versioning of count(*) and checksum:
        - Always update info->state->checksum and info->state->records
        - Remove optimization for index file update as it doesn't work for transactional tables
      storage/maria/ma_write.c:
        Versioning of count(*) and checksum:
        - Always update info->state->checksum and info->state->records
      storage/maria/maria_def.h:
        Move MARIA_STATUS_INFO to ma_state.h
        
        Changes to MARIA_SHARE:
        - Added state_history to store count(*)/checksum states
        - Added in_trans as counter if table is used by running transactions
        - Split concurrent_insert into lock_key_trees and on_transactional_concurrent_insert.
        - Added virtual function lock_restore_status
        
        Changes to MARIA_HA:
        - save_state -> state_save
        - Added state_start to store state at start of transaction
      storage/maria/maria_pack.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        
        Indentation fixes
      storage/maria/trnman.c:
        Added hook 'trnnam_end_trans_hook' that is called when transaction ends
        Added trn->used_tables that is used to an entry for all tables used by transaction
        More DBUG
        Changed return type of trnman_end_trn() to my_bool
        Added trnman_get_min_trid() to get minimum trid in use.
        Added trnman_exists_active_transactions() to check if there exist a running transaction started between two commit id
      storage/maria/trnman.h:
        Added 'used_tables'
        Moved all pointers into same groups to get better memory alignment
      storage/maria/trnman_public.h:
        Added prototypes for new functions and variables
        Chagned return type of trnman_end_trn() to my_bool
      storage/myisam/ha_myisam.cc:
        Added argument to end_bulk_insert() if operation should be aborted
      storage/myisam/ha_myisam.h:
        Added argument to end_bulk_insert() if operation should be aborted
      storage/maria/ma_state.c:
        Functions to handle state of count(*) and checksum
      storage/maria/ma_state.h:
        Structures and declarations to handle state of count(*) and checksum
      5099033c
  36. 14 May, 2008 1 commit
    • unknown's avatar
      Manual merge and some fixes. · e771ee75
      unknown authored
      mysql-test/include/varchar.inc:
        Manual merge between 5.1 and maria.
        
        Added a comment.
      mysql-test/r/maria.result:
        Temporary fix.
      mysql-test/suite/binlog/r/binlog_unsafe.result:
        Manual merge.
      mysql-test/suite/binlog/t/binlog_unsafe.test:
        Manual merge.
      sql/handler.h:
        Manual merge + fix.
      sql/item.h:
        Manual merge + fix.
      sql/log.cc:
        Manual merge + fix.
      sql/sql_insert.cc:
        Manual merge + fix. A commit was done when using
        create table ... select from for transactional tables
        other than maria, when an error occurred and
        transaction should have been aborted.
      e771ee75
  37. 08 Apr, 2008 1 commit
    • unknown's avatar
      Bug #35762 Failing CREATE-SELECT steels Table map of the following query · 73febb3b
      unknown authored
      Among two claimed artifacts the critical one is in that the Table map of 
      a query following the failing with a duplicate key error CREATE-SELECT is skipped from
      instantionating (and thus binlogging). That leads to sending a "chopped" group of the data
      row-events without the table map head to the slave. 
      The slave can not apply the only data row events.
      It's not easy to force the slave to react with an error in such a case (the second complaint
      on the bug report), because the lack of a table Rows_log_event::do_apply_event the data row event
      handler is a common situation which  normally designates the event has to be filtered out
      basing on the repliation do/ingore rules decision.
      
      Fixed: table map creating and binlogging is restored via deploying the standard cleanup call in
      select_create::abort().
      No error is reported if by chance the table map was not been binlogged.
      Leaving this out to resolve with considering how to combine the do/ingore rules with the situation
      when erronoulsy the Table_map is not written to binlog.
      
      
      mysql-test/suite/rpl/r/rpl_row_create_table.result:
        results changed
      mysql-test/suite/rpl/t/rpl_row_create_table.test:
        regression test for the bug
      sql/sql_insert.cc:
        adding resetting of thd binlogging state that was missed for the particular case of failing CREATE..SELECT
      73febb3b