• unknown's avatar
    After merge fixes for patch solving bug#18437 "Wrong values inserted with a · 0e47753f
    unknown authored
    before update trigger on NDB table".
    
    Two main changes:
    - We use TABLE::read_set/write_set bitmaps for marking fields used by
      statement instead of Field::query_id in 5.1.
    - Now when we mark columns used by statement we take into account columns 
      used by table's triggers instead of marking all columns as used if table
      has triggers.
    
    
    mysql-test/r/federated.result:
      Changed test in order to make it work with RBR.
      RBR changes the way in which we execute "DELETE FROM t1" statement - we don't
      use handler::delete_all_rows() method if RBR is enabled (see bug#19066).
      As result federated engine produces different sequences of statements for
      remote server in non-RBR and in RBR cases. And this changes order of the
      rows inserted by following INSERT statements.
    mysql-test/t/federated.test:
      Changed test in order to make it work with RBR.
      RBR changes the way in which we execute "DELETE FROM t1" statement - we don't
      use handler::delete_all_rows() method if RBR is enabled (see bug#19066).
      As result federated engine produces different sequences of statements for
      remote server in non-RBR and in RBR cases. And this changes order of the
      rows inserted by following INSERT statements.
    sql/ha_partition.cc:
      Added handling of HA_EXTRA_WRITE_CAN_REPLACE/HA_EXTRA_WRITE_CANNOT_REPLACE
      to ha_partition::extra().
    sql/item.cc:
      Adjusted comment after merge. In 5.1 we use TABLE::read_set/write_set
      bitmaps instead of Field::query_id for marking columns used.
    sql/log_event.cc:
      Write_rows_log_event::do_before_row_operations():
        Now we explicitly inform handler that we want to replace rows so it can
        promote operation done by write_row() to replace.
    sql/mysql_priv.h:
      Removed declaration of mark_fields_used_by_triggers_for_insert_stmt() which
      is no longer used (we have TABLE::mark_columns_needed_for_insert() instead).
    sql/sql_insert.cc:
      Adjusted code after merge. Get rid of mark_fields_used_by_triggers_for_insert_stmt()
      as now we use TABLE::mark_columns_needed_for_insert() for the same purprose.
      Aligned places where we call this method with places where we call
      mark_fields_used_by_triggers_for_insert() in 5.0.
      Finally we no longer need to call handler::extra(HA_EXTRA_WRITE_CAN_REPLACE)
      in case of REPLACE statement since in 5.1 write_record() marks all columns
      as used before doing actual row replacement.
    sql/sql_load.cc:
      Adjusted code after merge. In 5.1 we use TABLE::mark_columns_needed_for_insert() instead of
      mark_fields_used_by_triggers_for_insert_stmt() routine. We also no longer
      need to call handler::extra(HA_EXTRA_RETRIEVE_ALL_COLS) if we execute LOAD
      DATA REPLACE since in 5.1 write_record() will mark all columns as used before
      doing actual row replacement.
    sql/sql_trigger.cc:
      Table_triggers_list::mark_fields_used():
        We use TABLE::read_set/write_set bitmaps for marking fields used instead
        of Field::query_id in 5.1.
    sql/sql_trigger.h:
      TABLE::mark_columns_needed_for_* methods no longer need to be friends of
      Table_triggers_list class as intead of dirrectly accessing its private
      members they can use public Table_triggers_list::mark_fields_used() method.
      Also Table_triggers)list::mark_fields_used() no longer needs THD argument.
    sql/table.cc:
      TABLE::mark_columns_needed_for_*():
        Now we mark columns which are really used by table's triggers instead of
        marking all columns as used if table has triggers.
    0e47753f
sql_trigger.cc 50 KB