← Back to team overview

maria-developers team mailing list archive

Re: MDEV-225: Replace with dummy events an event that is not understood by a slave to which it should be sent

 

Hi!

>>>>> "Kristian" == Kristian Nielsen <knielsen@xxxxxxxxxxxxxxx> writes:

Kristian> Michael Widenius <monty@xxxxxxxxxxxx> writes:
Kristian> And STRING_WITH_LEN(...) expands to two expressions with a comma between them
Kristian> UUU, VVV - so I also cannot put DBUG_EVALUATE_IF() around STRING_WITH_LEN().
>> 
Kristian> I rewrote it to use strlen() instead of STRING_WITH_LEN - this code is not
Kristian> performance critical:
>> 
>> I prefer to get rid of strlen() at all.
>> Jani has a long going task to go trough the server and remove all
>> strlen() adding a strlen() will cause more work for him sooner or
>> later...

Kristian> This is the code:

Kristian>     const char *q=
Kristian>       DBUG_EVALUATE_IF("simulate_slave_capability_old_53",
Kristian>                        "SET @mariadb_slave_capability="
Kristian>                            STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_ANNOTATE),
Kristian>                        "SET @mariadb_slave_capability="
Kristian>                            STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE));
Kristian>     if (mysql_real_query(mysql, q, strlen(q)))

Kristian> So what do you suggest? Go back to the original code that Serg did not like?

Kristian>     int rc= DBUG_EVALUATE_IF("simulate_slave_capability_old_53",
Kristian>         mysql_real_query(mysql, STRING_WITH_LEN("SET @mariadb_slave_capability="
Kristian>                                 STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_ANNOTATE))),
Kristian>         mysql_real_query(mysql, STRING_WITH_LEN("SET @mariadb_slave_capability="
Kristian>                                 STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE))));
Kristian>     if (rc)

For me, both of the above are of similar complexity.

Another way is.

#ifndef DBUG_OFF
 LEX_STRING query1= STRING_WITH_LEN("SET @mariadb_slave_capability="
                    STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_ANNOTATE));
 LEX_STRING query2= STRING_WITH_LEN("SET @mariadb_slave_capability="
                    STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE));
 LEX_STRING *query= DBUG_EVALUATE_IF("simulate_slave_capability_old_53",
                    &query1,&query);
 if (mysql_real_query(mysql, query->str,query->length))
....

It's a bit more code, but at least it's reasonable easy to read.

Regards,
Monty


References