Merge lp:~vkolesnikov/pbxt/pbxt-bug-509968 into lp:pbxt

Proposed by Vladimir Kolesnikov
Status: Merged
Merged at revision: not available
Proposed branch: lp:~vkolesnikov/pbxt/pbxt-bug-509968
Merge into: lp:pbxt
Diff against target: 150 lines (+60/-22)
4 files modified
ChangeLog (+2/-0)
src/ha_pbxt.cc (+37/-22)
test/mysql-test/r/pbxt_snapshot.result (+9/-0)
test/mysql-test/t/pbxt_snapshot.test (+12/-0)
To merge this branch: bzr merge lp:~vkolesnikov/pbxt/pbxt-bug-509968
Reviewer Review Type Date Requested Status
PBXT Core Pending
Review via email: mp+17809@code.launchpad.net
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
=== modified file 'ChangeLog'
--- ChangeLog 2010-01-20 15:18:02 +0000
+++ ChangeLog 2010-01-21 11:41:12 +0000
@@ -3,6 +3,8 @@
33
4------- 1.0.10e RC4 - Not yet released4------- 1.0.10e RC4 - Not yet released
55
6RN300: Fixed bug #509968: START TRANSACTION WITH CONSISTENT SNAPSHOT breaks transactional flow.
7
6RN299: Fixed bug #509218: Server asserts with Assertion `mutex->__data.__owner == 0' failed on high concurrency OLTP test.8RN299: Fixed bug #509218: Server asserts with Assertion `mutex->__data.__owner == 0' failed on high concurrency OLTP test.
79
8------- 1.0.10d RC4 - 2010-01-1110------- 1.0.10d RC4 - 2010-01-11
911
=== modified file 'src/ha_pbxt.cc'
--- src/ha_pbxt.cc 2010-01-11 12:55:59 +0000
+++ src/ha_pbxt.cc 2010-01-21 11:41:12 +0000
@@ -477,6 +477,25 @@
477 return removed;477 return removed;
478}478}
479479
480static inline void thd_init_xact(THD *thd, XTThreadPtr self, bool set_table_trans)
481{
482 self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ;
483 self->st_ignore_fkeys = (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) != 0;
484 self->st_auto_commit = (thd_test_options(thd,(OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0;
485 if (set_table_trans) {
486#ifdef DRIZZLED
487 self->st_table_trans = FALSE;
488#else
489 self->st_table_trans = thd_sql_command(thd) == SQLCOM_LOCK_TABLES;
490#endif
491 }
492 self->st_abort_trans = FALSE;
493 self->st_stat_ended = FALSE;
494 self->st_stat_trans = FALSE;
495 XT_PRINT0(self, "xt_xn_begin\n");
496 xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
497}
498
480/*499/*
481 * -----------------------------------------------------------------------500 * -----------------------------------------------------------------------
482 * PUBLIC FUNCTIONS501 * PUBLIC FUNCTIONS
@@ -1424,6 +1443,17 @@
1424 * 1443 *
1425 * 3. If in BEGIN/END we must call ha_rollback() if we abort the transaction1444 * 3. If in BEGIN/END we must call ha_rollback() if we abort the transaction
1426 * internally.1445 * internally.
1446 *
1447 * NOTE ON CONSISTENT SNAPSHOTS:
1448 *
1449 * PBXT itself doesn't need this functiona as its transaction mechanism provides
1450 * consistent snapshots for all transactions by default. This function is needed
1451 * only for multi-engine cases like this:
1452 *
1453 * CREATE TABLE t1 ... ENGINE=INNODB
1454 * CREATE TABLE t2 ... ENGINE=PBXT
1455 * START TRANSACTION WITH CONSISTENT SNAPSHOT
1456 * SELECT * FROM t1 <-- at this point we need to know about the snapshot
1427 */1457 */
14281458
1429static int pbxt_start_consistent_snapshot(handlerton *hton, THD *thd)1459static int pbxt_start_consistent_snapshot(handlerton *hton, THD *thd)
@@ -1435,6 +1465,8 @@
1435 xt_ha_open_database_of_table(self, (XTPathStrPtr) NULL);1465 xt_ha_open_database_of_table(self, (XTPathStrPtr) NULL);
1436 }1466 }
14371467
1468 thd_init_xact(thd, self, true);
1469
1438 if (xt_xn_begin(self)) {1470 if (xt_xn_begin(self)) {
1439 trans_register_ha(thd, TRUE, hton); 1471 trans_register_ha(thd, TRUE, hton);
1440 } else {1472 } else {
@@ -4631,19 +4663,8 @@
4631 (void) ASSERT_NS(ISO_READ_UNCOMMITTED == XT_XACT_UNCOMMITTED_READ);4663 (void) ASSERT_NS(ISO_READ_UNCOMMITTED == XT_XACT_UNCOMMITTED_READ);
4632 (void) ASSERT_NS(ISO_SERIALIZABLE == XT_XACT_SERIALIZABLE);4664 (void) ASSERT_NS(ISO_SERIALIZABLE == XT_XACT_SERIALIZABLE);
46334665
4634 self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ;4666 thd_init_xact(thd, self, true);
4635 self->st_ignore_fkeys = (thd_test_options(thd,OPTION_NO_FOREIGN_KEY_CHECKS)) != 0;4667
4636 self->st_auto_commit = (thd_test_options(thd, (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0;
4637#ifdef DRIZZLED
4638 self->st_table_trans = FALSE;
4639#else
4640 self->st_table_trans = thd_sql_command(thd) == SQLCOM_LOCK_TABLES;
4641#endif
4642 self->st_abort_trans = FALSE;
4643 self->st_stat_ended = FALSE;
4644 self->st_stat_trans = FALSE;
4645 XT_PRINT0(self, "xt_xn_begin\n");
4646 xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
4647 if (!xt_xn_begin(self)) {4668 if (!xt_xn_begin(self)) {
4648 err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);4669 err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
4649 pb_ex_in_use = 0;4670 pb_ex_in_use = 0;
@@ -4870,15 +4891,9 @@
48704891
4871 /* See comment {START-TRANS} */4892 /* See comment {START-TRANS} */
4872 if (!self->st_xact_data) {4893 if (!self->st_xact_data) {
4873 self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ;4894
4874 self->st_ignore_fkeys = (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) != 0;4895 thd_init_xact(thd, self, false);
4875 self->st_auto_commit = (thd_test_options(thd,(OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0;4896
4876 /* self->st_table_trans = not set here! */
4877 self->st_abort_trans = FALSE;
4878 self->st_stat_ended = FALSE;
4879 self->st_stat_trans = FALSE;
4880 XT_PRINT0(self, "xt_xn_begin\n");
4881 xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
4882 if (!xt_xn_begin(self)) {4897 if (!xt_xn_begin(self)) {
4883 err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);4898 err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
4884 goto complete;4899 goto complete;
48854900
=== modified file 'test/mysql-test/r/pbxt_snapshot.result'
--- test/mysql-test/r/pbxt_snapshot.result 2009-12-21 19:11:35 +0000
+++ test/mysql-test/r/pbxt_snapshot.result 2010-01-21 11:41:12 +0000
@@ -74,3 +74,12 @@
74COMMIT;74COMMIT;
75DROP TABLE t1;75DROP TABLE t1;
76DROP TABLE t2;76DROP TABLE t2;
77CREATE TABLE t1 (i INT) ENGINE=PBXT;
78SELECT * FROM t1;
79i
80START TRANSACTION WITH CONSISTENT SNAPSHOT;
81INSERT INTO t1 VALUES (1);
82ROLLBACK;
83SELECT * FROM t1;
84i
85DROP TABLE t1;
7786
=== modified file 'test/mysql-test/t/pbxt_snapshot.test'
--- test/mysql-test/t/pbxt_snapshot.test 2009-12-21 19:11:35 +0000
+++ test/mysql-test/t/pbxt_snapshot.test 2010-01-21 11:41:12 +0000
@@ -99,6 +99,18 @@
99DROP TABLE t1;99DROP TABLE t1;
100DROP TABLE t2;100DROP TABLE t2;
101101
102# bug 509968: START TRANSACTION WITH CONSISTENT SNAPSHOT breaks transactional flow
103# happened because XTThread data was not inited properly and auto-commit flag
104# (raised by the SELECT precedding the transaction) was not reset
105
106CREATE TABLE t1 (i INT) ENGINE=PBXT;
107SELECT * FROM t1;
108START TRANSACTION WITH CONSISTENT SNAPSHOT;
109INSERT INTO t1 VALUES (1);
110ROLLBACK;
111SELECT * FROM t1;
112DROP TABLE t1;
113
102--disable_query_log114--disable_query_log
103drop database pbxt;115drop database pbxt;
104--enable_query_log116--enable_query_log

Subscribers

People subscribed via source and target branches