[Commits] review: Rev 3917: MDEV-9095: Executing triggers on slave in row-based replication in file:///home/bell/maria/bzr/work-maria-10.0-MDEV-5095/

Michael Widenius monty at askmonty.org
Thu Dec 19 17:24:33 EET 2013


Hi!

> === modified file 'sql/log_event.cc'

> === modified file 'sql/sql_delete.cc'
> --- a/sql/sql_delete.cc	2013-10-16 09:38:42 +0000
> +++ b/sql/sql_delete.cc	2013-12-19 08:10:00 +0000
> @@ -525,12 +525,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *
>        table->triggers->has_triggers(TRG_EVENT_DELETE,
>                                      TRG_ACTION_AFTER))
>    {
> -    /*
> -      The table has AFTER DELETE triggers that might access to subject table
> -      and therefore might need delete to be done immediately. So we turn-off
> -      the batching.
> -    */
> -    (void) table->file->extra(HA_EXTRA_DELETE_CANNOT_BATCH);
> +    table->prepare_triggers_for_delete_stmt_or_event();
>      will_batch= FALSE;
>    }

In the above code, you check for this twice:

       table->triggers->has_triggers(TRG_EVENT_DELETE,
                                     TRG_ACTION_AFTER))

Would be better to have prepare_triggers_for_delete_stmt_or_event()
return 1 if we have delete triggers and do:

    if (table->prepare_triggers_for_delete_stmt_or_event())
      will_batch= FALSE;
    else
      will_batch= ...

<cut>

> === modified file 'sql/sql_update.cc'
> --- a/sql/sql_update.cc	2013-10-16 09:38:42 +0000
> +++ b/sql/sql_update.cc	2013-12-19 08:10:00 +0000
> @@ -707,12 +707,7 @@ int mysql_update(THD *thd,
>        table->triggers->has_triggers(TRG_EVENT_UPDATE,
>                                      TRG_ACTION_AFTER))
>    {
> -    /*
> -      The table has AFTER UPDATE triggers that might access to subject 
> -      table and therefore might need update to be done immediately. 
> -      So we turn-off the batching.
> -    */ 
> -    (void) table->file->extra(HA_EXTRA_UPDATE_CANNOT_BATCH);
> +    table->prepare_triggers_for_update_stmt_or_event();
>      will_batch= FALSE;
>    }

Same here.

Regards,
Monty


More information about the commits mailing list