Merge lp:~skinny.moey/drizzle/transaction_log_674588 into lp:drizzle/7.0

Proposed by Joe Daly
Status: Merged
Approved by: Brian Aker
Approved revision: 1929
Merged at revision: 1936
Proposed branch: lp:~skinny.moey/drizzle/transaction_log_674588
Merge into: lp:drizzle/7.0
Diff against target: 61 lines (+12/-4)
3 files modified
drizzled/statement/alter_table.cc (+2/-0)
drizzled/transaction_services.cc (+2/-1)
plugin/innobase/handler/ha_innodb.cc (+8/-3)
To merge this branch: bzr merge lp:~skinny.moey/drizzle/transaction_log_674588
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+41031@code.launchpad.net

Description of the change

This fixes part of 674588. Duplicate trx ids were being assigned for enable/disable of keys, this change adds a specific call to allocate a new trx for this call.

It also reworks doGetNewTransactionId() there needs to be a call to innobase_trx_init() this will allow a call to session_to_trx() to not return null at a later time. This also will allow cleanup to happen properly in the ~Session destructor.

There are still duplicate trx ids showing up for update/delete/insert I will file a new bug for that.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/statement/alter_table.cc'
2--- drizzled/statement/alter_table.cc 2010-11-15 05:43:10 +0000
3+++ drizzled/statement/alter_table.cc 2010-11-17 03:54:58 +0000
4@@ -1035,6 +1035,8 @@
5
6 if (error == 0)
7 {
8+ TransactionServices &transaction_services= TransactionServices::singleton();
9+ transaction_services.allocateNewTransactionId();
10 write_bin_log(session, *session->getQueryString());
11 session->my_ok();
12 }
13
14=== modified file 'drizzled/transaction_services.cc'
15--- drizzled/transaction_services.cc 2010-11-08 20:00:45 +0000
16+++ drizzled/transaction_services.cc 2010-11-17 03:54:58 +0000
17@@ -1038,6 +1038,7 @@
18 delete in_transaction;
19 in_session->setStatementMessage(NULL);
20 in_session->setTransactionMessage(NULL);
21+ in_session->setXaId(0);
22 }
23
24 int TransactionServices::commitTransactionMessage(Session *in_session)
25@@ -2162,7 +2163,7 @@
26 ReplicationServices &replication_services= ReplicationServices::singleton();
27 if (! replication_services.isActive())
28 return;
29-
30+
31 message::Transaction *transaction= getActiveTransactionMessage(in_session);
32 message::Statement *statement= transaction->add_statement();
33
34
35=== modified file 'plugin/innobase/handler/ha_innodb.cc'
36--- plugin/innobase/handler/ha_innodb.cc 2010-11-15 05:43:10 +0000
37+++ plugin/innobase/handler/ha_innodb.cc 2010-11-17 03:54:58 +0000
38@@ -8865,7 +8865,14 @@
39
40 uint64_t InnobaseEngine::doGetNewTransactionId(Session *session)
41 {
42- trx_t *trx= innobase_trx_allocate(session);
43+ trx_t*& trx = session_to_trx(session);
44+
45+ if (trx == NULL)
46+ {
47+ trx = innobase_trx_allocate(session);
48+
49+ innobase_trx_init(session, trx);
50+ }
51
52 mutex_enter(&kernel_mutex);
53 trx->id= trx_sys_get_new_trx_id();
54@@ -8873,8 +8880,6 @@
55
56 uint64_t transaction_id= (ib_uint64_t) ut_conv_dulint_to_longlong(trx->id);
57
58- trx_free_for_mysql(trx);
59-
60 return transaction_id;
61 }
62

Subscribers

People subscribed via source and target branches