You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/src/sgml/atx.sgml
+42-42Lines changed: 42 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -1,102 +1,102 @@
1
1
<!-- doc/src/sgml/atx.sgml -->
2
2
3
3
<chapter id="atx">
4
-
<title>Autonomoustransactions</title>
4
+
<title>AutonomousTransactions</title>
5
5
6
6
<sect1 id="atx-overview">
7
-
<title>Overview of autonomous transactions</title>
7
+
<title>Overview</title>
8
8
9
9
<para>
10
10
&productname; supports nested transactions: they are rarely explicitly used by programmer and mostly used for error handling and stored
11
-
procedures. It is possible to rollback subtransaction without affecting parent transaction. But commit of subtraction is delayed until
11
+
procedures. It is possible to rollbackasubtransaction without affectingtheparent transaction. But commit of a subtraction is delayed until
12
12
commit of parent transaction.
13
13
</para>
14
14
<para>
15
-
But in some cases application needs to run several independent transactions in one session.
16
-
<quote>Autonomous Subtransactions</quote> (in short <acronym>AST</acronym>) denotes the capability of a single session
17
-
to run multiple independent transactions, as if multiple different sessions were executing each transaction.
18
-
</para>
19
-
<para>
20
-
Autonomous transactions are needed mostly for implementing audits, when the fact of performing audit should be reported regardless
21
-
status of audit itself: whether it was successfully completed or not.
22
-
Autonomous transactions are widely used in Oracle PL-SQL, so porting such procedures to &productname; is problematic without autonomous transaction support.
15
+
However, in some cases applications need to run several independent transactions inside a single transaction — <quote>autonomous transactions</quote>. Autonomous transactions are needed mostly for implementing audits, when the fact of performing an audit should be reported regardless of the
16
+
status of the audit itself: whether it was successfully completed or not.
23
17
</para>
24
18
25
19
</sect1>
26
20
27
21
<sect1><title>Behavior</title>
28
22
<para>
29
-
An<acronym>AST</acronym> can happen only inside another transaction.
30
-
Inside an existing transaction (call it T0), the user can decide to starta subtransaction. Then T0 is paused and pushed in an<acronym>AST</acronym> stack, and a new transaction (call it T1) is started.
23
+
Anautonomous transaction can happen only inside another transaction.
24
+
Inside an existing transaction (call it T0), the user can decide to startan autonomous transaction. Then T0 is paused and pushed in anautonomous transaction stack, and a new transaction (call it T1) is started.
31
25
</para>
32
26
<para>
33
-
At some point in the future the user can commit thesubtransaction; after T1 is committed then T0 is popped from the<acronym>AST</acronym> stack and resumed.
34
-
The user can also decide to <command>COMMIT</command> the parent transaction T0, in which case T1 is committed, then T0 is popped from the<acronym>AST</acronym> stack and then committed.
27
+
At some point in the future the user can commit theautonomous transaction; after T1 is committed then T0 is popped from theautonomous transaction stack and resumed.
28
+
The user can also decide to <command>COMMIT</command> the parent transaction T0, in which case T1 is committed, then T0 is popped from theautonomous transaction stack and then committed.
35
29
</para>
36
30
<para>
37
31
All the transactions happen synchronously; at any time only one transaction can be active, while in the stack there are zero (or more) paused transactions in the stack.
38
32
All the possible combinations of <command>COMMIT</command> / <command>ROLLBACK</command> for T0 and T1 can happen;
39
33
for instance, it is possible to COMMIT T1 and ROLLBACK T0.
40
-
It is possible to nestsubtransactions, up to a global resource limit (e.g. the<acronym>AST</acronym> stack size) which can be set on the server.
34
+
It is possible to nestautonomous transactions, up to a global resource limit (e.g. theautonomous transaction stack size) which can be set on the server.
41
35
</para>
42
36
43
37
</sect1>
44
38
45
-
<sect1><title>Example</title>
39
+
<sect1><title>Examples</title>
46
40
47
41
<para>
48
-
The following figure describes anexample where atransactionexecutes a subtransaction. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in the<acronym>AST</acronym> stack. Time flows downwards.
42
+
This example illustrates how anautonomoustransactionis executed. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in theautonomous transaction stack. Time flows downwards.
49
43
</para>
50
44
51
45
<programlisting>
52
-
BEGIN; --start ordinarytx T0
46
+
BEGIN; --starts ordinarytransaction T0
53
47
|
54
48
INSERT INTO t VALUES (1);
55
49
:\
56
-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
50
+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
Visibility rules work as in the case of independent transactions executed via <literal>dblink</literal>.
108
108
T1 does not see the effects of T0, because the latter has not been committed yet. T0 might see the effects of T1, depending on its own transaction isolation mode.
109
-
In case of Read Committed isolation level the parent transaction will see changes made by autonomoussubtransaction.
110
-
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomoussubtransaction.
109
+
In case of Read Committed isolation level the parent transaction will see changes made by autonomoustransactions.
110
+
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomoustransactions.
111
111
</para>
112
112
113
113
<para>
114
-
Now single-session deadlocks become possible, because an<acronym>AST</acronym>can become entangled with one of the paused transactions init's session.
114
+
Now single-session deadlocks become possible, because anautonomous transactioncan become entangled with one of the paused transactions inits session.
115
115
Autonomous transaction T1 is assumed to depend on parent transaction T0 and if it attempts to obtain any resource locked by T0, then