~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/transaction_services.cc

  • Committer: Joseph Daly
  • Date: 2010-10-18 03:10:56 UTC
  • mto: (1856.2.16 transaction_id_innodb)
  • mto: This revision was merged to the branch mainline in revision 1900.
  • Revision ID: skinny.moey@gmail.com-20101018031056-nfbsjmibqovhedez
use transaction_id in innodb for transaction log

Show diffs side-by-side

added added

removed removed

Lines of Context:
426
426
    registerResourceForStatement(session, monitored, engine, resource_manager);
427
427
}
428
428
 
 
429
uint64_t TransactionServices::getCurrentTransactionId(Session *session)
 
430
{
 
431
  TransactionContext *trans= &session->transaction.stmt;
 
432
  TransactionContext::ResourceContexts &resource_contexts= trans->getResourceContexts();
 
433
 
 
434
  if (resource_contexts.empty() == false)
 
435
  {
 
436
    for (TransactionContext::ResourceContexts::iterator it= resource_contexts.begin();
 
437
         it != resource_contexts.end();
 
438
         ++it)
 
439
    {
 
440
      ResourceContext *resource_context= *it;
 
441
 
 
442
      plugin::MonitoredInTransaction *resource= resource_context->getMonitored();
 
443
      if (resource->participatesInXaTransaction())
 
444
      {
 
445
        return resource_context->getXaResourceManager()->getTransactionId(session);
 
446
      }
 
447
    }
 
448
  }
 
449
  return 0;
 
450
}
 
451
 
429
452
/**
430
453
  @retval
431
454
    0   ok
964
987
  trx->set_server_id(in_session->getServerId());
965
988
 
966
989
  if (should_inc_trx_id)
967
 
    trx->set_transaction_id(getNextTransactionId());
 
990
    trx->set_transaction_id(getCurrentTransactionId(in_session));
968
991
 
969
992
  trx->set_start_timestamp(in_session->getCurrentTimestamp());
970
993
}