Commit b9673a64 authored by Will DeVries's avatar Will DeVries Committed by Sergei Petrunia

Always mark committed and rolled back transactions closed.

parent bdaffefd
......@@ -6,18 +6,18 @@ Note 1051 Unknown table 'db1.t1'
CREATE TABLE `t1`(i BIGINT, t TEXT)ENGINE=clustrixdb;
INSERT INTO `t1` (i, t) VALUES (42, 'один');
INSERT INTO `t1` (i, t) VALUES (42, 'ноль');
SELECT * FROM `t1` ORDER BY `i`;
SELECT * FROM `t1` ORDER BY `i` DESC, `t` DESC;
i t
42 один
42 ноль
UPDATE `t1` SET i=i+1,t='два' WHERE t='один';
SELECT * FROM `t1` ORDER BY `i`;
SELECT * FROM `t1` ORDER BY `i` DESC, `t` DESC;
i t
42 один
42 ноль
USE test;
UPDATE `db1`.`t1` SET i=i+1,t='три' WHERE t='два';
SELECT * FROM `db1`.`t1` ORDER BY `i`;
SELECT * FROM `db1`.`t1` ORDER BY `i` DESC, `t` DESC;
i t
42 один
42 ноль
......
......@@ -4,14 +4,14 @@ DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1`(i BIGINT, t TEXT)ENGINE=clustrixdb;
INSERT INTO `t1` (i, t) VALUES (42, 'один');
INSERT INTO `t1` (i, t) VALUES (42, 'ноль');
SELECT * FROM `t1` ORDER BY `i`;
SELECT * FROM `t1` ORDER BY `i` DESC, `t` DESC;
UPDATE `t1` SET i=i+1,t='два' WHERE t='один';
SELECT * FROM `t1` ORDER BY `i`;
SELECT * FROM `t1` ORDER BY `i` DESC, `t` DESC;
USE test;
UPDATE `db1`.`t1` SET i=i+1,t='три' WHERE t='два';
SELECT * FROM `db1`.`t1` ORDER BY `i`;
SELECT * FROM `db1`.`t1` ORDER BY `i` DESC, `t` DESC;
DROP TABLE `db1`.`t1`;
......
......@@ -228,14 +228,14 @@ bool clustrix_connection::commit_transaction()
DBUG_ENTER("clustrix_connection::commit_transaction");
assert(has_transaction);
has_transaction = FALSE;
has_anonymous_savepoint = FALSE;
if (commit_flag_next & CLUSTRIX_TRANS_BEGIN) {
commit_flag_next &= ~CLUSTRIX_TRANS_BEGIN;
DBUG_RETURN(FALSE);
}
commit_flag_next |= CLUSTRIX_TRANS_COMMIT;
has_transaction = FALSE;
has_anonymous_savepoint = FALSE;
DBUG_RETURN(TRUE);
}
......@@ -244,14 +244,14 @@ bool clustrix_connection::rollback_transaction()
DBUG_ENTER("clustrix_connection::rollback_transaction");
assert(has_transaction);
has_transaction = FALSE;
has_anonymous_savepoint = FALSE;
if (commit_flag_next & CLUSTRIX_TRANS_BEGIN) {
commit_flag_next &= ~CLUSTRIX_TRANS_BEGIN;
DBUG_RETURN(FALSE);
}
commit_flag_next |= CLUSTRIX_TRANS_ROLLBACK;
has_transaction = FALSE;
has_anonymous_savepoint = FALSE;
DBUG_RETURN(TRUE);
}
......@@ -287,12 +287,12 @@ bool clustrix_connection::release_anonymous_savepoint()
assert(has_transaction);
assert(has_anonymous_savepoint);
has_anonymous_savepoint = FALSE;
if (commit_flag_next & CLUSTRIX_STMT_NEW) {
commit_flag_next &= ~CLUSTRIX_STMT_NEW;
DBUG_RETURN(FALSE);
}
has_anonymous_savepoint = FALSE;
DBUG_RETURN(TRUE);
}
......@@ -302,13 +302,13 @@ bool clustrix_connection::rollback_to_anonymous_savepoint()
assert(has_transaction);
assert(has_anonymous_savepoint);
has_anonymous_savepoint = FALSE;
if (commit_flag_next & CLUSTRIX_STMT_NEW) {
commit_flag_next &= ~CLUSTRIX_STMT_NEW;
DBUG_RETURN(FALSE);
}
commit_flag_next |= CLUSTRIX_STMT_ROLLBACK;
has_anonymous_savepoint = FALSE;
DBUG_RETURN(TRUE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment