235
Truncate the binary log transaction cache.
238
binlog_trans_log_truncate()
240
session The thread to take the binlog data from
241
pos Position to truncate to
245
Truncate the binary log to the given position. Will not change
250
binlog_trans_log_truncate(Session *session, my_off_t pos)
252
assert(session_get_ha_data(session, binlog_hton) != NULL);
253
/* Only true if binlog_trans_log_savepos() wasn't called before */
254
assert(pos != ~(my_off_t) 0);
256
binlog_trx_data *const trx_data=
257
(binlog_trx_data*) session_get_ha_data(session, binlog_hton);
258
trx_data->truncate(pos);
264
235
this function is mostly a placeholder.
265
236
conceptually, binlog initialization (now mostly done in DRIZZLE_BIN_LOG::open)
266
237
should be moved here.
486
457
Otherwise, we accumulate the statement
488
460
uint64_t const in_transaction=
489
461
session->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
490
464
if ((in_transaction && (all || (!trx_data->at_least_one_stmt && session->transaction.stmt.modified_non_trans_table))) || (!in_transaction && !all))
492
466
Query_log_event qev(session, STRING_WITH_LEN("COMMIT"), true, false);
493
467
qev.error_code= 0; // see comment in DRIZZLE_LOG::write(Session, IO_CACHE)
494
468
/* TODO: Fix return type */
469
int error= binlog_end_trans(session, trx_data, &qev, all);
495
470
(void)replicator_end_transaction(session, all, true);
496
int error= binlog_end_trans(session, trx_data, &qev, all);
520
494
binlog_trx_data *const trx_data=
521
495
(binlog_trx_data*) session_get_ha_data(session, binlog_hton);
523
if (trx_data->empty()) {
497
/* TODO: Fix return type */
498
(void)replicator_end_transaction(session, all, false);
500
if (trx_data->empty())
524
502
trx_data->reset();
552
531
error= binlog_end_trans(session, trx_data, 0, all);
555
/* TODO: Fix return type */
556
(void)replicator_end_transaction(session, all, false);
585
561
static int binlog_savepoint_set(handlerton *, Session *session, void *sv)
587
(void)replicator_savepoint_set(session, sv);
588
564
binlog_trans_log_savepos(session, (my_off_t*) sv);
589
565
/* Write it to the binary log */
592
session->binlog_query(Session::STMT_QUERY_TYPE,
593
session->query, session->query_length, true, false);
567
error= replicator_statement(session, session->query, session->query_length);
597
static int binlog_savepoint_rollback(handlerton *, Session *session, void *sv)
572
static int binlog_savepoint_rollback(handlerton *, Session *session, void *)
601
Write ROLLBACK TO SAVEPOINT to the binlog cache if we have updated some
602
non-transactional table. Otherwise, truncate the binlog cache starting
603
from the SAVEPOINT command.
605
if (unlikely(session->transaction.all.modified_non_trans_table ||
606
(session->options & OPTION_KEEP_LOG)))
609
session->binlog_query(Session::STMT_QUERY_TYPE,
610
session->query, session->query_length, true, false);
613
binlog_trans_log_truncate(session, *(my_off_t*)sv);
616
error= replicator_rollback_to_savepoint(session, sv);
576
error= replicator_statement(session, session->query, session->query_length);