Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd0a8968

Browse files
committed
Two-phase commit. Original patch by Heikki Linnakangas, with additional
hacking by Alvaro Herrera and Tom Lane.
1 parent5495575 commitd0a8968

File tree

61 files changed

+4449
-434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4449
-434
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
Documentation of the system catalogs, directed toward PostgreSQL developers
3-
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.103 2005/06/13 23:14:47 tgl Exp $
3+
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.104 2005/06/17 22:32:41 tgl Exp $
44
-->
55

66
<chapter id="catalogs">
@@ -3932,6 +3932,11 @@
39323932
<entry>currently held locks</entry>
39333933
</row>
39343934

3935+
<row>
3936+
<entry><link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link></entry>
3937+
<entry>currently prepared transactions</entry>
3938+
</row>
3939+
39353940
<row>
39363941
<entry><link linkend="view-pg-rules"><structname>pg_rules</structname></link></entry>
39373942
<entry>rules</entry>
@@ -4167,8 +4172,10 @@
41674172
<entry><structfield>pid</structfield></entry>
41684173
<entry><type>integer</type></entry>
41694174
<entry></entry>
4170-
<entry>process ID of the server process holding or awaiting this
4171-
lock</entry>
4175+
<entry>
4176+
Process ID of the server process holding or awaiting this
4177+
lock. Zero if the lock is held by a prepared transaction.
4178+
</entry>
41724179
</row>
41734180
<row>
41744181
<entry><structfield>mode</structfield></entry>
@@ -4250,6 +4257,87 @@
42504257

42514258
</sect1>
42524259

4260+
<sect1 id="view-pg-prepared-xacts">
4261+
<title><structname>pg_prepared_xacts</structname></title>
4262+
4263+
<indexterm zone="view-pg-prepared-xacts">
4264+
<primary>pg_prepared_xacts</primary>
4265+
</indexterm>
4266+
4267+
<para>
4268+
The view <structname>pg_prepared_xacts</structname> displays
4269+
information about transactions that are currently prepared for two-phase
4270+
commit (see <xref linkend="sql-prepare-transaction"
4271+
endterm="sql-prepare-transaction-title"> for details).
4272+
</para>
4273+
4274+
<para>
4275+
<structname>pg_prepared_xacts</structname> contains one row per prepared
4276+
transaction. An entry is removed when the transaction is committed or
4277+
rolled back.
4278+
</para>
4279+
4280+
<table>
4281+
<title><structname>pg_prepared_xacts</> Columns</title>
4282+
4283+
<tgroup cols=4>
4284+
<thead>
4285+
<row>
4286+
<entry>Name</entry>
4287+
<entry>Type</entry>
4288+
<entry>References</entry>
4289+
<entry>Description</entry>
4290+
</row>
4291+
</thead>
4292+
<tbody>
4293+
<row>
4294+
<entry><structfield>transaction</structfield></entry>
4295+
<entry><type>xid</type></entry>
4296+
<entry></entry>
4297+
<entry>
4298+
Numeric transaction identifier of the prepared transaction
4299+
</entry>
4300+
</row>
4301+
<row>
4302+
<entry><structfield>gid</structfield></entry>
4303+
<entry><type>text</type></entry>
4304+
<entry></entry>
4305+
<entry>
4306+
Global transaction identifier that was assigned to the transaction
4307+
</entry>
4308+
</row>
4309+
<row>
4310+
<entry><structfield>owner</structfield></entry>
4311+
<entry><type>name</type></entry>
4312+
<entry><literal><link linkend="catalog-pg-shadow"><structname>pg_shadow</structname></link>.usename</literal></entry>
4313+
<entry>
4314+
Name of the user that executed the transaction
4315+
</entry>
4316+
</row>
4317+
<row>
4318+
<entry><structfield>database</structfield></entry>
4319+
<entry><type>name</type></entry>
4320+
<entry><literal><link linkend="catalog-pg-database"><structname>pg_database</structname></link>.datname</literal></entry>
4321+
<entry>
4322+
Name of the database in which the transaction was executed
4323+
</entry>
4324+
</row>
4325+
</tbody>
4326+
</tgroup>
4327+
</table>
4328+
4329+
<para>
4330+
When the <structname>pg_prepared_xacts</structname> view is accessed, the
4331+
internal transaction manager data structures are momentarily locked, and
4332+
a copy is made for the view to display. This ensures that the
4333+
view produces a consistent set of results, while not blocking
4334+
normal operations longer than necessary. Nonetheless
4335+
there could be some impact on database performance if this view is
4336+
read often.
4337+
</para>
4338+
4339+
</sect1>
4340+
42534341
<sect1 id="view-pg-rules">
42544342
<title><structname>pg_rules</structname></title>
42554343

‎doc/src/sgml/ref/allfiles.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.62 2004/08/21 16:16:04 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.63 2005/06/17 22:32:42 tgl Exp $
33
PostgreSQL documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -30,6 +30,7 @@ Complete list of usable sgml source files in this directory.
3030
<!entity cluster system "cluster.sgml">
3131
<!entity commentOn system "comment.sgml">
3232
<!entity commit system "commit.sgml">
33+
<!entity commitPrepared system "commit_prepared.sgml">
3334
<!entity copyTable system "copy.sgml">
3435
<!entity createAggregate system "create_aggregate.sgml">
3536
<!entity createCast system "create_cast.sgml">
@@ -88,11 +89,13 @@ Complete list of usable sgml source files in this directory.
8889
<!entity move system "move.sgml">
8990
<!entity notify system "notify.sgml">
9091
<!entity prepare system "prepare.sgml">
92+
<!entity prepareTransaction system "prepare_transaction.sgml">
9193
<!entity reindex system "reindex.sgml">
9294
<!entity releaseSavepoint system "release_savepoint.sgml">
9395
<!entity reset system "reset.sgml">
9496
<!entity revoke system "revoke.sgml">
9597
<!entity rollback system "rollback.sgml">
98+
<!entity rollbackPrepared system "rollback_prepared.sgml">
9699
<!entity rollbackTo system "rollback_to.sgml">
97100
<!entity savepoint system "savepoint.sgml">
98101
<!entity select system "select.sgml">

‎doc/src/sgml/ref/commit_prepared.sgml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<!--
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/commit_prepared.sgml,v 1.1 2005/06/17 22:32:42 tgl Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-COMMIT-PREPARED">
7+
<refmeta>
8+
<refentrytitle id="sql-commit-prepared-title">COMMIT PREPARED</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>COMMIT PREPARED</refname>
14+
<refpurpose>commit a transaction that was earlier prepared for two-phase commit</refpurpose>
15+
</refnamediv>
16+
17+
<indexterm zone="sql-commit-prepared">
18+
<primary>COMMIT PREPARED</primary>
19+
</indexterm>
20+
21+
<refsynopsisdiv>
22+
<synopsis>
23+
COMMIT PREPARED <replaceable class="PARAMETER">transaction_id</replaceable>
24+
</synopsis>
25+
</refsynopsisdiv>
26+
27+
<refsect1>
28+
<title>Description</title>
29+
30+
<para>
31+
<command>COMMIT PREPARED</command> commits a transaction that is in
32+
prepared state.
33+
</para>
34+
</refsect1>
35+
36+
<refsect1>
37+
<title>Parameters</title>
38+
39+
<variablelist>
40+
<varlistentry>
41+
<term><replaceable class="PARAMETER">transaction_id</replaceable></term>
42+
<listitem>
43+
<para>
44+
The transaction identifier of the transaction that is to be
45+
committed.
46+
</para>
47+
</listitem>
48+
</varlistentry>
49+
</variablelist>
50+
</refsect1>
51+
52+
<refsect1>
53+
<title>Notes</title>
54+
55+
<para>
56+
To commit a prepared transaction, you must be either the same user that
57+
executed the transaction originally, or a superuser. But you do not
58+
have to be in the same session that executed the transaction.
59+
</para>
60+
61+
<para>
62+
This command cannot be executed inside a transaction block. The prepared
63+
transaction is committed immediately.
64+
</para>
65+
66+
<para>
67+
All currently available prepared transactions are listed in the
68+
<structname>pg_prepared_xacts</> system view.
69+
</para>
70+
</refsect1>
71+
72+
<refsect1 id="sql-commit-prepared-examples">
73+
<title id="sql-commit-prepared-examples-title">Examples</title>
74+
<para>
75+
Commit the transaction identified by the transaction
76+
identifier <literal>foobar</>:
77+
78+
<programlisting>
79+
COMMIT PREPARED 'foobar';
80+
</programlisting>
81+
</para>
82+
83+
</refsect1>
84+
85+
<refsect1>
86+
<title>See Also</title>
87+
88+
<simplelist type="inline">
89+
<member><xref linkend="sql-prepare-transaction" endterm="sql-prepare-transaction-title"></member>
90+
<member><xref linkend="sql-rollback-prepared" endterm="sql-rollback-prepared-title"></member>
91+
</simplelist>
92+
</refsect1>
93+
94+
</refentry>
95+
96+
<!-- Keep this comment at the end of the file
97+
Local variables:
98+
mode: sgml
99+
sgml-omittag:nil
100+
sgml-shorttag:t
101+
sgml-minimize-attributes:nil
102+
sgml-always-quote-attributes:t
103+
sgml-indent-step:1
104+
sgml-indent-data:t
105+
sgml-parent-document:nil
106+
sgml-default-dtd-file:"../reference.ced"
107+
sgml-exposed-tags:nil
108+
sgml-local-catalogs:"/usr/lib/sgml/catalog"
109+
sgml-local-ecat-files:nil
110+
End:
111+
-->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp