2651
Member function that will log query, either row-based or
2652
statement-based depending on the value of the 'current_stmt_binlog_row_based'
2653
the value of the 'qtype' flag.
2655
This function should be called after the all calls to ha_*_row()
2656
functions have been issued, but before tables are unlocked and
2660
There shall be no writes to any system table after calling
2661
binlog_query(), so these writes has to be moved to before the call
2662
of binlog_query() for correct functioning.
2664
This is necessesary not only for RBR, but the master might crash
2665
after binlogging the query but before changing the system tables.
2666
This means that the slave and the master are not in the same state
2667
(after the master has restarted), so therefore we have to
2668
eliminate this problem.
2671
Error code, or 0 if no error.
2673
int Session::binlog_query(Session::enum_binlog_query_type qtype, char const *query_arg,
2674
ulong query_len, bool is_trans, bool suppress_use,
2675
Session::killed_state killed_status_arg)
2677
assert(query_arg && drizzle_bin_log.is_open());
2679
if (int error= binlog_flush_pending_rows_event(true))
2683
case Session::ROW_QUERY_TYPE:
2685
case Session::DRIZZLE_QUERY_TYPE:
2687
Using this query type is a conveniece hack, since we have been
2688
moving back and forth between using RBR for replication of
2689
system tables and not using it.
2691
Make sure to change in check_table_binlog_row_based() according
2692
to how you treat this.
2694
case Session::STMT_QUERY_TYPE:
2696
The DRIZZLE_LOG::write() function will set the STMT_END_F flag and
2697
flush the pending rows event if necessary.
2700
Query_log_event qinfo(this, query_arg, query_len, is_trans, suppress_use,
2702
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
2704
Binlog table maps will be irrelevant after a Query_log_event
2705
(they are just removed on the slave side) so after the query
2706
log event is written to the binary log, we pretend that no
2707
table maps were written.
2709
int error= drizzle_bin_log.write(&qinfo);
2710
binlog_table_maps= 0;
2715
case Session::QUERY_TYPE_COUNT:
2717
assert(0 <= qtype && qtype < QUERY_TYPE_COUNT);
2722
2649
bool Discrete_intervals_list::append(uint64_t start, uint64_t val,