~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/transaction.result

Completes the work of removing the weirdness around transaction
boundaries in the storage engine API.

* Transactional storage engines are now all explicitly notified
  of the start of a new "normal" transaction in the new PSE API
  method plugin::TransactionalStorageEngine::doStartTransaction()
  This new method takes a start_transaction_option_t as one of its
  parameters, and passing this option allows the storage engine
  API to cleanly signal the start of a consistent snapshot (and in
  the future additional transaction attributes).  This meant the
  removal of the old start_consistent_snapshot() method.

* The TransactionServices component now fully manages the transaction
  boundaries, notification of transaction boundaries to participating
  resource managers (transactional storage engines)

Adds a simple test case (to be expanded with future XA work) for
transaction behaviour.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
DROP TABLE IF EXISTS t1_trx, t1_non_trx;
 
2
SET AUTOCOMMIT= 0;
 
3
CREATE TABLE t1_trx (
 
4
k VARCHAR(10) NOT NULL
 
5
, v VARCHAR(10) NOT NULL
 
6
, PRIMARY KEY (k)
 
7
) ENGINE=InnoDB;
 
8
CREATE TEMPORARY TABLE t1_non_trx (
 
9
k VARCHAR(10) NOT NULL
 
10
, v VARCHAR(10) NOT NULL
 
11
, PRIMARY KEY (k)
 
12
) ENGINE=MyISAM;
 
13
START TRANSACTION;
 
14
INSERT INTO t1_trx VALUES ('key1','value1');
 
15
INSERT INTO t1_trx VALUES ('key2','value2');
 
16
INSERT INTO t1_non_trx VALUES ('key1','value1');
 
17
INSERT INTO t1_non_trx VALUES ('key2','value2');
 
18
ROLLBACK;
 
19
Warnings:
 
20
Warning 1196    Some non-transactional changed tables couldn't be rolled back
 
21
Expected warning about non-trx data changes not being rolled back
 
22
SELECT * FROM t1_trx;
 
23
k       v
 
24
SELECT * FROM t1_non_trx;
 
25
k       v
 
26
key1    value1
 
27
key2    value2
 
28
START TRANSACTION;
 
29
INSERT INTO t1_trx VALUES ('key1','value1');
 
30
INSERT INTO t1_trx VALUES ('key2','value2');
 
31
SELECT t1_trx.k, t1_trx.v
 
32
FROM t1_trx
 
33
INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k;
 
34
k       v
 
35
key1    value1
 
36
key2    value2
 
37
ROLLBACK;
 
38
SELECT t1_trx.k, t1_trx.v
 
39
FROM t1_trx
 
40
INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k;
 
41
k       v
 
42
DROP TABLE t1_trx;
 
43
DROP TABLE t1_non_trx;