Merge lp:~stewart/drizzle/bug701468-rollback-all-not-true into lp:drizzle/7.0

Proposed by Stewart Smith
Status: Merged
Approved by: Lee Bieber
Approved revision: 2075
Merged at revision: 2101
Proposed branch: lp:~stewart/drizzle/bug701468-rollback-all-not-true
Merge into: lp:drizzle/7.0
Prerequisite: lp:~stewart/drizzle/bug682563-commit-all-not-true
Diff against target: 138 lines (+37/-12)
7 files modified
drizzled/transaction_services.cc (+4/-3)
plugin/haildb/haildb_engine.cc (+1/-1)
plugin/innobase/handler/ha_innodb.cc (+2/-3)
plugin/pbxt/src/ha_pbxt.cc (+1/-3)
plugin/storage_engine_api_tester/storage_engine_api_tester.cc (+1/-2)
tests/suite/regression/r/701468.result (+14/-0)
tests/suite/regression/t/701468.test (+14/-0)
To merge this branch: bzr merge lp:~stewart/drizzle/bug701468-rollback-all-not-true
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+46096@code.launchpad.net

Description of the change

rollbackTransaction's all parameter was also a lie.

https://code.launchpad.net/~stewart/drizzle/seapitester-state-history/+merge/46092 is a merge req for an improvement to storage_engine_api_tester that means we can reasonably test this a bit easier than "hey, the test suite still passes"

To post a comment you must log in.
Revision history for this message
Patrick Crews (patrick-crews) wrote :

Running the test suite and checking lcov numbers shows that the affected lines of code are exercised by the test suite. Did not check changes to pbxt or haildb code as this is supposed to be a cursory check.

Test cases appear satisfactory.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/transaction_services.cc'
2--- drizzled/transaction_services.cc 2011-01-17 01:31:33 +0000
3+++ drizzled/transaction_services.cc 2011-01-17 01:31:34 +0000
4@@ -642,6 +642,7 @@
5 TransactionContext::ResourceContexts &resource_contexts= trans->getResourceContexts();
6
7 bool is_real_trans= normal_transaction || session->transaction.all.getResourceContexts().empty();
8+ bool all = normal_transaction || !session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
9
10 /*
11 We must not rollback the normal transaction if a statement
12@@ -663,7 +664,7 @@
13
14 if (resource->participatesInXaTransaction())
15 {
16- if ((err= resource_context->getXaResourceManager()->xaRollback(session, normal_transaction)))
17+ if ((err= resource_context->getXaResourceManager()->xaRollback(session, all)))
18 {
19 my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
20 error= 1;
21@@ -675,7 +676,7 @@
22 }
23 else if (resource->participatesInSqlTransaction())
24 {
25- if ((err= resource_context->getTransactionalStorageEngine()->rollback(session, normal_transaction)))
26+ if ((err= resource_context->getTransactionalStorageEngine()->rollback(session, all)))
27 {
28 my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
29 error= 1;
30@@ -695,7 +696,7 @@
31 * a rollback statement with the corresponding transaction ID
32 * to rollback.
33 */
34- if (normal_transaction)
35+ if (all)
36 rollbackTransactionMessage(session);
37 else
38 rollbackStatementMessage(session);
39
40=== modified file 'plugin/haildb/haildb_engine.cc'
41--- plugin/haildb/haildb_engine.cc 2011-01-17 01:31:33 +0000
42+++ plugin/haildb/haildb_engine.cc 2011-01-17 01:31:34 +0000
43@@ -427,7 +427,7 @@
44 ib_err_t err;
45 ib_trx_t *transaction= get_trx(session);
46
47- if (all || !session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
48+ if (all)
49 {
50 err= ib_trx_rollback(*transaction);
51
52
53=== modified file 'plugin/innobase/handler/ha_innodb.cc'
54--- plugin/innobase/handler/ha_innodb.cc 2011-01-17 01:31:33 +0000
55+++ plugin/innobase/handler/ha_innodb.cc 2011-01-17 01:31:34 +0000
56@@ -2695,9 +2695,8 @@
57
58 row_unlock_table_autoinc_for_mysql(trx);
59
60- if (all
61- || !session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
62-
63+ if (all)
64+ {
65 error = trx_rollback_for_mysql(trx);
66 } else {
67 error = trx_rollback_last_sql_stat_for_mysql(trx);
68
69=== modified file 'plugin/pbxt/src/ha_pbxt.cc'
70--- plugin/pbxt/src/ha_pbxt.cc 2011-01-17 01:31:33 +0000
71+++ plugin/pbxt/src/ha_pbxt.cc 2011-01-17 01:31:34 +0000
72@@ -5738,13 +5738,11 @@
73 return err;
74 }
75
76-int PBXTStorageEngine::doRollback(drizzled::Session* thd, bool)
77+int PBXTStorageEngine::doRollback(drizzled::Session* thd, bool real_commit)
78 {
79 int err = 0;
80 XTThreadPtr self = (XTThreadPtr) *thd->getEngineData(pbxt_hton);
81
82- bool real_commit = !session_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
83-
84 XT_PRINT1(self, "PBXTStorageEngine::doRollback(real_commit = %s)\n", real_commit ? "true" : "false");
85
86 if (real_commit && self) {
87
88=== modified file 'plugin/storage_engine_api_tester/storage_engine_api_tester.cc'
89--- plugin/storage_engine_api_tester/storage_engine_api_tester.cc 2011-01-17 01:31:33 +0000
90+++ plugin/storage_engine_api_tester/storage_engine_api_tester.cc 2011-01-17 01:31:34 +0000
91@@ -505,8 +505,7 @@
92
93 int SEAPITester::doRollback(Session *session, bool all)
94 {
95- if (all
96- || !session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
97+ if (all)
98 {
99 ENGINE_NEW_STATE("ROLLBACK");
100 ENGINE_NEW_STATE("::SEAPITester()");
101
102=== added file 'tests/suite/regression/r/701468.result'
103--- tests/suite/regression/r/701468.result 1970-01-01 00:00:00 +0000
104+++ tests/suite/regression/r/701468.result 2011-01-17 01:31:34 +0000
105@@ -0,0 +1,14 @@
106+create table t1 (a int not null);
107+insert into t1 values (1), (NULL), (2);
108+ERROR 23000: Column 'a' cannot be null
109+begin;
110+insert into t1 values (42);
111+insert into t1 values (1), (NULL), (2);
112+ERROR 23000: Column 'a' cannot be null
113+select * from t1;
114+a
115+42
116+rollback;
117+select * from t1;
118+a
119+drop table t1;
120
121=== added file 'tests/suite/regression/t/701468.test'
122--- tests/suite/regression/t/701468.test 1970-01-01 00:00:00 +0000
123+++ tests/suite/regression/t/701468.test 2011-01-17 01:31:34 +0000
124@@ -0,0 +1,14 @@
125+create table t1 (a int not null);
126+--error 1048
127+insert into t1 values (1), (NULL), (2);
128+
129+begin;
130+insert into t1 values (42);
131+--error 1048
132+insert into t1 values (1), (NULL), (2);
133+select * from t1;
134+rollback;
135+select * from t1;
136+
137+drop table t1;
138+

Subscribers

People subscribed via source and target branches