Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 39aa78c

Browse files
author
Liudmila Mantrova
committed
Doc fix for autonomous transactions - PGPRO-511
1 parent ed95071 commit 39aa78c

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

doc/src/sgml/atx.sgml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,102 @@
11
<!-- doc/src/sgml/atx.sgml -->
22

33
<chapter id="atx">
4-
<title>Autonomous transactions</title>
4+
<title>Autonomous Transactions</title>
55

66
<sect1 id="atx-overview">
7-
<title>Overview of autonomous transactions</title>
7+
<title>Overview</title>
88

99
<para>
1010
&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 rollback a subtransaction without affecting the parent transaction. But commit of a subtraction is delayed until
1212
commit of parent transaction.
1313
</para>
1414
<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 &mdash; <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.
2317
</para>
2418

2519
</sect1>
2620

2721
<sect1><title>Behavior</title>
2822
<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 start a subtransaction. Then T0 is paused and pushed in an <acronym>AST</acronym> stack, and a new transaction (call it T1) is started.
23+
An autonomous transaction can happen only inside another transaction.
24+
Inside an existing transaction (call it T0), the user can decide to start an autonomous transaction. Then T0 is paused and pushed in an autonomous transaction stack, and a new transaction (call it T1) is started.
3125
</para>
3226
<para>
33-
At some point in the future the user can commit the subtransaction; 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 the autonomous transaction; after T1 is committed then T0 is popped from the autonomous 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 the autonomous transaction stack and then committed.
3529
</para>
3630
<para>
3731
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.
3832
All the possible combinations of <command>COMMIT</command> / <command>ROLLBACK</command> for T0 and T1 can happen;
3933
for instance, it is possible to COMMIT T1 and ROLLBACK T0.
40-
It is possible to nest subtransactions, 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 nest autonomous transactions, up to a global resource limit (e.g. the autonomous transaction stack size) which can be set on the server.
4135
</para>
4236

4337
</sect1>
4438

45-
<sect1><title>Example</title>
39+
<sect1><title>Examples</title>
4640

4741
<para>
48-
The following figure describes an example where a transaction executes 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 an autonomous transaction is executed. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in the autonomous transaction stack. Time flows downwards.
4943
</para>
5044

5145
<programlisting>
52-
BEGIN; -- start ordinary tx T0
46+
BEGIN; -- starts ordinary transaction T0
5347
|
5448
INSERT INTO t VALUES (1);
5549
:\
56-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
50+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
51+
: | -- T1, pushes T0 into stack
5752
: |
5853
: INSERT INTO t VALUES (2);
5954
: |
60-
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION; -- ends tx T1, pops tx T0 from stack
55+
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION;
56+
: | -- ends autonomous transaction
57+
: | -- T1, pops transaction T0 from stack
6158
:/
62-
COMMIT / ROLLBACK; -- ends tx T0
59+
COMMIT / ROLLBACK; -- ends transaction T0
6360
</programlisting>
6461

6562
<para>
66-
Depending on the two choices between <command>COMMIT</command> and <command>ROLLBACK</command> we can get 4 different outputs from:
63+
Depending on the two choices between <command>COMMIT</command> and <command>ROLLBACK</command>, we can get four different outputs from:
6764

6865
<programlisting>
6966
SELECT sum(x) from t;
7067
</programlisting>
7168
</para>
7269

73-
</sect1>
74-
<sect1><title>Example 2 (more than one subtransaction)</title>
75-
7670
<para>
77-
The parent transaction can have more than one subtransaction, just by repeating the application of the push/pop cycle.
71+
The parent transaction can have more than one autonomous transaction if the push/pop cycle is repeated.
7872
</para>
7973

8074
<programlisting>
81-
BEGIN; -- start ordinary tx T0
75+
BEGIN; -- starts ordinary transaction T0
8276
|
8377
INSERT INTO t VALUES (1);
8478
:\
85-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
79+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
80+
: | -- T1, pushes T0 into stack
8681
: |
8782
: INSERT INTO t VALUES (2);
8883
: |
89-
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION; -- ends tx T1, pops tx T0 from stack
84+
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION;
85+
: | -- ends autonomous transaction
86+
: | -- T1, pops T0 from stack
9087
:/
9188
|
9289
:\
93-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T2, pushes T0 into stack
90+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
91+
: | -- T2, pushes T0 into stack
9492
: |
9593
: INSERT INTO t VALUES (4);
9694
: |
97-
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION; -- ends tx T2, pops tx T0 from stack
95+
: COMMIT AUTONOMOUS TRANSACTION / ROLLBACK AUTONOMOUS TRANSACTION;
96+
: | -- ends autonomous transaction
97+
: | -- T2, pops T0 from stack
9898
:/
99-
COMMIT / ROLLBACK; -- ends tx T0
99+
COMMIT / ROLLBACK; -- ends transaction T0
100100
</programlisting>
101101

102102
</sect1>
@@ -106,19 +106,19 @@ COMMIT / ROLLBACK; -- ends tx T0
106106
<para>
107107
Visibility rules work as in the case of independent transactions executed via <literal>dblink</literal>.
108108
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 autonomous subtransaction.
110-
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomous subtransaction.
109+
In case of Read Committed isolation level the parent transaction will see changes made by autonomous transactions.
110+
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomous transactions.
111111
</para>
112112

113113
<para>
114-
Now single-session deadlocks become possible, because an <acronym>AST</acronym> can become entangled with one of the paused transactions in it's session.
114+
Now single-session deadlocks become possible, because an autonomous transaction can become entangled with one of the paused transactions in its session.
115115
Autonomous transaction T1 is assumed to depend on parent transaction T0 and if it attempts to obtain any resource locked by T0, then
116116
deadlock is reported.
117117
</para>
118118

119119
</sect1>
120120

121-
<sect1><title>SQL grammar extension for autonomous transactions</title>
121+
<sect1><title>SQL Grammar Extension for Autonomous Transactions</title>
122122

123123
<para>
124124
&productname; <literal>BEGIN</literal>/<literal>END</literal> transaction statements are extended by optional keyword <literal>AUTONOMOUS</literal>:
@@ -131,16 +131,16 @@ deadlock is reported.
131131

132132
<para>
133133
Specifying <literal>AUTONOMOUS</literal> keyword in <literal>END TRANSACTION</literal> clause is optional.
134-
It is possible to have several nesting levels of autonomous transactions, but top level transaction can not be autonomous.
134+
It is possible to have several nesting levels of autonomous transactions, but top level transaction cannot be autonomous.
135135
</para>
136136

137137
</sect1>
138138

139-
<sect1><title>PL/pgSQL grammar extension for autonomous transactions</title>
139+
<sect1><title>PL/pgSQL Grammar Extension for Autonomous Transactions</title>
140140

141141
<para>
142142
Block construction in PL/pgSQL is extended by optional <literal>autonomous</literal> keyword.
143-
It is possible to treat all function body as autonomous transaction:
143+
It is possible to treat the whole function body as an autonomous transaction:
144144
</para>
145145

146146
<programlisting>
@@ -178,11 +178,11 @@ When an error is caught by an <literal>EXCEPTION</literal> clause, the local var
178178

179179
</sect1>
180180

181-
<sect1><title>PL/Python extension for autonomous transactions</title>
181+
<sect1><title>PL/Python Extension for Autonomous Transactions</title>
182182

183183
<para>
184184
In addition to <varname>subtransaction</varname> method, PL/Python module provides new <varname>autonomous</varname> method
185-
which can be used in <varname>WITH</varname> clause to start autonomous transaction:
185+
which can be used in <varname>WITH</varname> clause to start an autonomous transaction:
186186
</para>
187187

188188
<programlisting>

0 commit comments

Comments
 (0)