Hi Sven,
Sven Sandberg, 30.07.2008 17:38:
>
>
> Ingo Strüwing wrote:
...
>> Note that this is a difference against fixing the logic of
>> Query_log_event::write(). I still think that the latter is more risky.
>
> How do you mean? I don't think we need to change the logic of
> Query_log_event::write() in any other way than replace the long
> computation by a macro that expands to the same computation. It just
> needs double-checking that the macro expands to the same thing as the
> original computation. It would me more risky to try to maintain two
> copies of the same computation, IMHO.
>
In your first review you wrote: "Query_log_event::write() should use
MAX_LOG_EVENT_HEADER".
MAX_LOG_EVENT_HEADER contains LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + MAX_SIZE_LOG_EVENT_STATUS +
NAME_LEN + 1. That is the space required to do in one write what
Query_log_event::write() does in a bunch of writes:
return (write_header(file, event_length) ||
my_b_safe_write(file, (uchar*) buf, QUERY_HEADER_LEN) ||
write_post_header_for_derived(file) ||
my_b_safe_write(file, (uchar*) start_of_status,
(uint) (start-start_of_status)) ||
my_b_safe_write(file, (db) ? (uchar*) db : (uchar*)"", db_len
+ 1) ||
my_b_safe_write(file, (uchar*) query, q_len)) ? 1 : 0;
I misunderstood your comment so that this should be refactored into a
single write.
Regards
Ingo
--
Ingo Strüwing, Database Group
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Dr. Roland Bömer
Vorsitzender des Aufsichtsrates: Martin Häring HRB München 161028