2678
Member function that will log query, either row-based or
2679
statement-based depending on the value of the 'current_stmt_binlog_row_based'
2680
the value of the 'qtype' flag.
2682
This function should be called after the all calls to ha_*_row()
2683
functions have been issued, but before tables are unlocked and
2687
There shall be no writes to any system table after calling
2688
binlog_query(), so these writes has to be moved to before the call
2689
of binlog_query() for correct functioning.
2691
This is necessesary not only for RBR, but the master might crash
2692
after binlogging the query but before changing the system tables.
2693
This means that the slave and the master are not in the same state
2694
(after the master has restarted), so therefore we have to
2695
eliminate this problem.
2698
Error code, or 0 if no error.
2700
int Session::binlog_query(Session::enum_binlog_query_type qtype, char const *query_arg,
2701
ulong query_len, bool is_trans, bool suppress_use,
2702
Session::killed_state killed_status_arg)
2704
assert(query_arg && drizzle_bin_log.is_open());
2706
if (int error= binlog_flush_pending_rows_event(true))
2710
case Session::ROW_QUERY_TYPE:
2712
case Session::DRIZZLE_QUERY_TYPE:
2714
Using this query type is a conveniece hack, since we have been
2715
moving back and forth between using RBR for replication of
2716
system tables and not using it.
2718
Make sure to change in check_table_binlog_row_based() according
2719
to how you treat this.
2721
case Session::STMT_QUERY_TYPE:
2723
The DRIZZLE_LOG::write() function will set the STMT_END_F flag and
2724
flush the pending rows event if necessary.
2727
Query_log_event qinfo(this, query_arg, query_len, is_trans, suppress_use,
2729
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
2731
Binlog table maps will be irrelevant after a Query_log_event
2732
(they are just removed on the slave side) so after the query
2733
log event is written to the binary log, we pretend that no
2734
table maps were written.
2736
int error= drizzle_bin_log.write(&qinfo);
2737
binlog_table_maps= 0;
2742
case Session::QUERY_TYPE_COUNT:
2744
assert(0 <= qtype && qtype < QUERY_TYPE_COUNT);
2749
2676
bool Discrete_intervals_list::append(uint64_t start, uint64_t val,