~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log.cc

  • Committer: Brian Aker
  • Date: 2008-12-07 01:52:46 UTC
  • Revision ID: brian@tangent.org-20081207015246-debwl881w1y1s6zb
Updating new replication positions in code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
 
233
233
 
234
234
/*
235
 
  Truncate the binary log transaction cache.
236
 
 
237
 
  SYNPOSIS
238
 
    binlog_trans_log_truncate()
239
 
 
240
 
    session      The thread to take the binlog data from
241
 
    pos      Position to truncate to
242
 
 
243
 
  DESCRIPTION
244
 
 
245
 
    Truncate the binary log to the given position. Will not change
246
 
    anything else.
247
 
 
248
 
 */
249
 
static void
250
 
binlog_trans_log_truncate(Session *session, my_off_t pos)
251
 
{
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);
255
 
 
256
 
  binlog_trx_data *const trx_data=
257
 
    (binlog_trx_data*) session_get_ha_data(session, binlog_hton);
258
 
  trx_data->truncate(pos);
259
 
  return;
260
 
}
261
 
 
262
 
 
263
 
/*
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.
584
555
 
585
556
static int binlog_savepoint_set(handlerton *, Session *session, void *sv)
586
557
{
587
 
  (void)replicator_savepoint_set(session, sv);
 
558
  bool error;
588
559
  binlog_trans_log_savepos(session, (my_off_t*) sv);
589
560
  /* Write it to the binary log */
590
561
 
591
 
  int const error=
592
 
    session->binlog_query(Session::STMT_QUERY_TYPE,
593
 
                      session->query, session->query_length, true, false);
 
562
  error= replicator_statement(session, session->query, session->query_length);
 
563
 
594
564
  return(error);
595
565
}
596
566
 
597
 
static int binlog_savepoint_rollback(handlerton *, Session *session, void *sv)
 
567
static int binlog_savepoint_rollback(handlerton *, Session *session, void *)
598
568
{
599
569
  bool error;
600
 
  /*
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.
604
 
  */
605
 
  if (unlikely(session->transaction.all.modified_non_trans_table ||
606
 
               (session->options & OPTION_KEEP_LOG)))
607
 
  {
608
 
    int error=
609
 
      session->binlog_query(Session::STMT_QUERY_TYPE,
610
 
                            session->query, session->query_length, true, false);
611
 
    return(error);
612
 
  }
613
 
  binlog_trans_log_truncate(session, *(my_off_t*)sv);
614
 
 
615
 
 
616
 
  error= replicator_rollback_to_savepoint(session, sv);
617
 
 
618
 
  return(0);
 
570
 
 
571
  error= replicator_statement(session, session->query, session->query_length);
 
572
 
 
573
  return error;
619
574
}
620
575
 
621
576