1. 01 Jul, 2006 1 commit
    • unknown's avatar
      Fix for bug#18437 "Wrong values inserted with a before update trigger on · ae9724cc
      unknown authored
      NDB table".
      
      SQL-layer was not marking fields which were used in triggers as such. As
      result these fields were not always properly retrieved/stored by handler
      layer. So one might got wrong values or lost changes in triggers for NDB,
      Federated and possibly InnoDB tables.
      This fix solves the problem by marking fields used in triggers
      appropriately.
      
      Also this patch contains the following cleanup of ha_ndbcluster code:
      
      We no longer rely on reading LEX::sql_command value in handler in order
      to determine if we can enable optimization which allows us to handle REPLACE
      statement in more efficient way by doing replaces directly in write_row()
      method without reporting error to SQL-layer.
      Instead we rely on SQL-layer informing us whether this optimization
      applicable by calling handler::extra() method with
      HA_EXTRA_WRITE_CAN_REPLACE flag.
      As result we no longer apply this optimzation in cases when it should not
      be used (e.g. if we have on delete triggers on table) and use in some
      additional cases when it is applicable (e.g. for LOAD DATA REPLACE).
      
      Finally this patch includes fix for bug#20728 "REPLACE does not work
      correctly for NDB table with PK and unique index".
        
      This was yet another problem which was caused by improper field mark-up.
      During row replacement fields which weren't explicity used in REPLACE
      statement were not marked as fields to be saved (updated) so they have
      retained values from old row version. The fix is to mark all table
      fields as set for REPLACE statement. Note that in 5.1 we already solve
      this problem by notifying handler that it should save values from all
      fields only in case when real replacement happens.
      
      
      include/my_base.h:
        Added HA_EXTRA_WRITE_CAN_REPLACE, HA_EXTRA_WRITE_CANNOT_REPLACE - new
        parameters for ha_extra() method. We use them to inform handler that
        write_row() which tries to insert new row into the table and encounters
        some already existing row with same primary/unique key can replace old
        row with new row instead of reporting error.
      mysql-test/r/federated.result:
        Additional test for bug#18437 "Wrong values inserted with a before update
        trigger on NDB table".
      mysql-test/r/ndb_replace.result:
        Added test for bug #20728 "REPLACE does not work correctly for NDB table
        with PK and unique index". Updated wrong results from older test.
      mysql-test/t/federated.test:
        Additional test for bug#18437 "Wrong values inserted with a before update
        trigger on NDB table".
      mysql-test/t/ndb_replace.test:
        Added test for bug #20728 "REPLACE does not work correctly for NDB table
        with PK and unique index".
      sql/ha_ndbcluster.cc:
        We no longer rely on reading LEX::sql_command value in handler in order
        to determine if we can enable optimization which allows us to handle REPLACE
        statement in more efficient way by doing replaces directly in write_row()
        method without reporting error to SQL-layer.
        Instead we rely on SQL-layer informing us whether this optimization
        applicable by calling handler::extra() method with
        HA_EXTRA_WRITE_CAN_REPLACE flag.
        As result we no longer apply this optimization in cases when it should not
        be used (e.g. if we have on delete triggers on table) and use in some
        additional cases when it is applicable (e.g. for LOAD DATA REPLACE).
      sql/item.cc:
        Item_trigger_field::setup_field():
          Added comment explaining why we don't set Field::query_id in this method.
      sql/mysql_priv.h:
        mysql_alter_table() function no longer takes handle_duplicates argument.
        Added declaration of mark_fields_used_by_triggers_for_insert_stmt() function.
      sql/sql_delete.cc:
        Mark fields which are used by ON DELETE triggers so handler will retrieve
        values for these fields.
      sql/sql_insert.cc:
        Explicitly inform handler that we are doing REPLACE (using ha_extra() method)
        in cases when it can promote insert operation done by write_row() to replace.
        Also when we do REPLACE we want to store values for all columns so we should
        inform handler about it.
        Finally we should mark fields used by ON UPDATE/ON DELETE triggers as such
        so handler can properly retrieve/restore values in these fields during
        execution of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE statements.
      sql/sql_load.cc:
        Explicitly inform handler that we are doing LOAD DATA REPLACE (using
        ha_extra() method) in cases when it can promote insert operation done by
        write_row() to replace.
        Also when we do replace we want to save (replace) values for all columns
        so we should inform handler about it.
        Finally to properly execute LOAD DATA for table with triggers we should
        mark fields used by ON INSERT triggers as such so handler can properly
        store values for these fields.
      sql/sql_parse.cc:
        mysql_alter_table() function no longer takes handle_duplicates argument.
      sql/sql_table.cc:
        Got rid of handle_duplicates argument in mysql_alter_table() and
        copy_data_between_tables() functions. These functions were always
        called with handle_duplicates == DUP_ERROR and thus contained dead
        (and probably incorrect) code.
      sql/sql_trigger.cc:
        Added Table_triggers_list::mark_fields_used() method which is used to mark
        fields read/set by triggers as such so handlers will be able properly
        retrieve/store values in these fields.
      sql/sql_trigger.h:
        Table_triggers_list:
          Added mark_fields_used() method which is used to mark fields read/set by
          triggers as such so handlers will be able properly retrieve/store values
          in these fields. To implement this method added 'trigger_fields' member
          which is array of lists linking items for all fields used in triggers
          grouped by event and action time.
      sql/sql_update.cc:
        Mark fields which are used by ON UPDATE triggers so handler will retrieve
        and save values for these fields.
      mysql-test/r/ndb_trigger.result:
        Added test for bug#18437 "Wrong values inserted with a before update trigger
        on NDB table".
      mysql-test/t/ndb_trigger.test:
        Added test for bug#18437 "Wrong values inserted with a before update trigger
        on NDB table".
      ae9724cc
  2. 24 Jun, 2006 2 commits
    • unknown's avatar
      Merge knielsen@10.100.52.19:/usr/local/mysql/tmp-5.0 · 9d7799e7
      unknown authored
      into  mysql.com:/data0/knielsen/tmp-5.0
      
      
      9d7799e7
    • unknown's avatar
      Fix race condition in test case wait_timeout. · 4a9a0b9a
      unknown authored
      Sometimes the helper connection (that is watching for the main connection
      to time out) would itself time out first, causing the test to fail.
      
      
      mysql-test/t/wait_timeout.test:
        Increase connection timeout in connection wait_con so we will not loose
        the connection that is watching for the real wait_timeout to trigger.
      4a9a0b9a
  3. 23 Jun, 2006 4 commits
    • unknown's avatar
      key.result: · 907acc78
      unknown authored
        After merge fix
      
      
      mysql-test/r/key.result:
        After merge fix
      907acc78
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0 · cbc5f34c
      unknown authored
      into moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      sql/sql_parse.cc:
        Auto merged
      cbc5f34c
    • unknown's avatar
      Merge moonbone.local:/work/tmp_merge-4.1-opt-mysql · 27cc0204
      unknown authored
      into moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      mysql-test/r/key.result:
        Auto merged
      mysql-test/t/key.test:
        Auto merged
      sql/table.cc:
        Auto merged
      support-files/mysql.spec.sh:
        Auto merged
      27cc0204
    • unknown's avatar
      Bug#11228: DESC shows arbitrary column as "PRI" · 89e41595
      unknown authored
        An UNIQUE KEY consisting of NOT NULL columns
        was displayed as PRIMARY KEY in "DESC t1".
        According to the code, that was intentional
        behaviour for some reasons unknown to me.
        This code was written before bitkeeper time,
        so I cannot check who and why made this.
        After discussing on dev-public, a decision
        was made to remove this code
      
      
      mysql-test/r/key.result:
        Adding test case.
      mysql-test/t/key.test:
        Adding test case.
      sql/table.cc:
        Removing old wrong code
      89e41595
  4. 22 Jun, 2006 9 commits
    • unknown's avatar
      mysql.spec.sh: · 92ad3d5b
      unknown authored
        Disable the simplistic auto dependency scan for test/bench (bug#20078)
      
      
      support-files/mysql.spec.sh:
        Disable the simplistic auto dependency scan for test/bench (bug#20078)
      92ad3d5b
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 0f0e518e
      unknown authored
      into  mysql.com:/opt/local/work/mysql-5.0-runtime
      
      
      0f0e518e
    • unknown's avatar
      Merge clam.ndb.mysql.com:/space/pekka/ndb/version/my50 · 1c288073
      unknown authored
      into  clam.ndb.mysql.com:/space/pekka/ndb/version/my50-bug18781
      
      
      ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        Auto merged
      ndb/src/ndbapi/ndberror.c:
        Auto merged
      1c288073
    • unknown's avatar
      Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0 · dca36865
      unknown authored
      into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug15811
      
      
      dca36865
    • unknown's avatar
      Merge mysql.com:/opt/local/work/mysql-5.0-root · 8eb00d0a
      unknown authored
      into  mysql.com:/opt/local/work/mysql-5.0-runtime
      
      
      8eb00d0a
    • unknown's avatar
      Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0 · a887fa9e
      unknown authored
      into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug15811
      
      
      a887fa9e
    • unknown's avatar
      A fix and a test case for Bug#15217 "Using a SP cursor on a table created · 67fd3c4a
      unknown authored
       with PREPARE fails with weird error".
      More generally, re-executing a stored procedure with a complex SP cursor query
      could lead to a crash.
      
      The cause of the problem was that SP cursor queries were not optimized 
      properly at first execution: their parse tree belongs to sp_instr_cpush,
      not sp_instr_copen, and thus the tree was tagged "EXECUTED" when the
      cursor was declared, not when it was opened. This led to loss of optimization
      transformations performed at first execution, as sp_instr_copen saw that the
      query is already "EXECUTED" and therefore either not ran first-execution 
      related blocks or wrongly rolled back the transformations caused by 
      first-execution code.
      The fix is to update the state of the parsed tree only when the tree is
      executed, as opposed to when the instruction containing the tree is executed.
      Assignment if i->state is moved to reset_lex_and_exec_core.
      
      
      mysql-test/r/sp.result:
        Test results fixed (Bug#15217)
      mysql-test/t/sp.test:
        Add a test case for Bug#15217
      sql/sp_head.cc:
        Move assignment of stmt_arena->state to reset_lex_and_exec_core
      67fd3c4a
    • unknown's avatar
      Bug#15811: extremely long time for mysql client to execute long INSERT · 15ac6406
      unknown authored
      The problem was in redundant calls to strlen() in string functions,
      where we may then return after checking only the small number of characters.
      
      No test case is provided since it's a performance fix.
      
      
      strings/ctype-mb.c:
        Do not use strlen() where arbitrary horizon of at least
        CHARSET_INFO::mbmaxlen character is sufficient.
      15ac6406
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0 · 6e8cb4d6
      unknown authored
      into moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      6e8cb4d6
  5. 21 Jun, 2006 24 commits