Two phase commit in ECPG
Hi all,
I found that ecpg has not been supporting COMMIT PREPARED and ROLLBACK
PREPARED since version 9.0.2.
For example, if the test code does,
EXEC SQL BEGIN;
EXEC SQL INSERT INTO t1 VALUES(1);
EXEC SQL PREPARE TRANSACTION 'gxid';
EXEC SQL COMMIT PREPARED 'gxid';
I got error "COMMIT PREPARED cannot run inside a transaction block".
This cause is that the "begin transaction" is issued automatically
before executing COMMIT PREPARED if we're not in auto commit. The
Commit 816b008eaf1a1ff1069f3bafff363a9a8bf04a21 fixed bug of incorrect
status calculation but at the same time it became the cause of this
behavior.
Is this a bug?
Attached 001 patch fixes this issue and add regression test for two
phase commit in ecpg.
Also, in spite of ecpg identifies these two commands as transaction
command similar to other transaction commands like commit and rollback
the documentation doesn't mentioned about these at all. Attached 002
patch add description about these to documentation.
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:
002_ecpg_commit_rollback_prepared_doc.patchapplication/octet-stream; name=002_ecpg_commit_rollback_prepared_doc.patchDownload
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index b8021cb..fed5371 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -507,6 +507,25 @@ EXEC SQL COMMIT;
</listitem>
</varlistentry>
+ <variablelist>
+ <varlistentry>
+ <term><literal>EXEC SQL COMMIT PREPARED </literal><replaceable class="PARAMETER">transaction_id</></term>
+ <listitem>
+ <para>
+ Commit a transaction that is in prepared state.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>EXEC SQL ROLLBACK PREPARED </literal><replaceable class="PARAMETER">transaction_id</></term>
+ <listitem>
+ <para>
+ Roll back a transaction that is in prepared state.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><literal>EXEC SQL SET AUTOCOMMIT TO ON</literal></term>
<listitem>
001_ecpg_commit_rollback_prepared.patchapplication/octet-stream; name=001_ecpg_commit_rollback_prepared.patchDownload
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index a13aa0a..019ebe1 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -213,9 +213,15 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
* If we got a transaction command but have no open transaction, we
* have to start one, unless we are in autocommit, where the
* developers have to take care themselves. However, if the command is
- * a begin statement, we just execute it once.
+ * a begin statement, we just execute it once. And if the command is
+ * commit or rollback prepared, we don't execute it.
*/
- if (PQtransactionStatus(con->connection) == PQTRANS_IDLE && !con->autocommit && strncmp(transaction, "begin", 5) != 0 && strncmp(transaction, "start", 5) != 0)
+ if (PQtransactionStatus(con->connection) == PQTRANS_IDLE &&
+ !con->autocommit &&
+ strncmp(transaction, "begin", 5) != 0 &&
+ strncmp(transaction, "start", 5) != 0 &&
+ strncmp(transaction, "commit prepared", 15) != 0 &&
+ strncmp(transaction, "rollback prepared", 17) != 0)
{
res = PQexec(con->connection, "begin transaction");
if (!ecpg_check_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL))
diff --git a/src/interfaces/ecpg/test/ecpg_schedule b/src/interfaces/ecpg/test/ecpg_schedule
index c3ec125..206f712 100644
--- a/src/interfaces/ecpg/test/ecpg_schedule
+++ b/src/interfaces/ecpg/test/ecpg_schedule
@@ -46,6 +46,7 @@ test: sql/indicators
test: sql/oldexec
test: sql/quote
test: sql/show
+test: sql/twophase
test: sql/insupd
test: sql/parser
test: thread/thread
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.c b/src/interfaces/ecpg/test/expected/sql-twophase.c
new file mode 100644
index 0000000..cf491fc
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-twophase.c
@@ -0,0 +1,114 @@
+/* Processed by ecpg (regression mode) */
+/* These include files are added by the preprocessor */
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+#line 1 "twophase.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#line 1 "regression.h"
+
+
+
+
+
+
+#line 5 "twophase.pgc"
+
+
+/* exec sql whenever sqlerror sqlprint ; */
+#line 7 "twophase.pgc"
+
+
+int main(void)
+{
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
+#line 16 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 16 "twophase.pgc"
+
+ { ECPGsetcommit(__LINE__, "off", NULL);
+#line 17 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 17 "twophase.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( c int )", ECPGt_EOIT, ECPGt_EORT);
+#line 20 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 20 "twophase.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+#line 23 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 23 "twophase.pgc"
+
+
+ strcpy(msg, "begin");
+ { ECPGtrans(__LINE__, NULL, "begin");
+#line 26 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 26 "twophase.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 )", ECPGt_EOIT, ECPGt_EORT);
+#line 29 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 29 "twophase.pgc"
+
+
+ strcpy(msg, "prepare transaction");
+ { ECPGtrans(__LINE__, NULL, "prepare transaction 'gxid'");
+#line 32 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 32 "twophase.pgc"
+
+
+ strcpy(msg, "commit prepared");
+ { ECPGtrans(__LINE__, NULL, "commit prepared 'gxid'");
+#line 35 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 35 "twophase.pgc"
+
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
+#line 38 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 38 "twophase.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 41 "twophase.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 41 "twophase.pgc"
+
+
+ return (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.stderr b/src/interfaces/ecpg/test/expected/sql-twophase.stderr
new file mode 100644
index 0000000..18415ff
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/sql-twophase.stderr
@@ -0,0 +1,34 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGsetcommit on line 17: action "off"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: query: create table t1 ( c int ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 20: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 20: OK: CREATE TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 23: action "commit"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 26: action "begin"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: query: insert into t1 values ( 1 ); with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 29: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 32: action "prepare transaction 'gxid'"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGtrans on line 35: action "commit prepared 'gxid'"; connection "ecpg1_regression"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: query: drop table t1; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 38: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 38: OK: DROP TABLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: connection ecpg1_regression closed
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.stdout b/src/interfaces/ecpg/test/expected/sql-twophase.stdout
new file mode 100644
index 0000000..e69de29
diff --git a/src/interfaces/ecpg/test/sql/Makefile b/src/interfaces/ecpg/test/sql/Makefile
index 6bc67e9..b7bc034 100644
--- a/src/interfaces/ecpg/test/sql/Makefile
+++ b/src/interfaces/ecpg/test/sql/Makefile
@@ -22,6 +22,7 @@ TESTS = array array.c \
parser parser.c \
quote quote.c \
show show.c \
+ twophase twophase.c \
insupd insupd.c
all: $(TESTS)
diff --git a/src/interfaces/ecpg/test/sql/twophase.pgc b/src/interfaces/ecpg/test/sql/twophase.pgc
new file mode 100644
index 0000000..867a28e
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/twophase.pgc
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+exec sql include ../regression;
+
+exec sql whenever sqlerror sqlprint;
+
+int main(void)
+{
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ exec sql connect to REGRESSDB1;
+ exec sql set autocommit to off;
+
+ strcpy(msg, "create");
+ exec sql create table t1(c int);
+
+ strcpy(msg, "commit");
+ exec sql commit;
+
+ strcpy(msg, "begin");
+ exec sql begin;
+
+ strcpy(msg, "insert");
+ exec sql insert into t1 values(1);
+
+ strcpy(msg, "prepare transaction");
+ exec sql prepare transaction 'gxid';
+
+ strcpy(msg, "commit prepared");
+ exec sql commit prepared 'gxid';
+
+ strcpy(msg, "drop");
+ exec sql drop table t1;
+
+ strcpy(msg, "disconnect");
+ exec sql disconnect current;
+
+ return (0);
+}
Dear Sawada-san,
This cause is that the "begin transaction" is issued automatically
before executing COMMIT PREPARED if we're not in auto commit. The
Commit 816b008eaf1a1ff1069f3bafff363a9a8bf04a21 fixed bug of
incorrect
status calculation but at the same time it became the cause of this
behavior.
Is this a bug?
I'd say so, yes.
As soon as I find time I'll get to it including back porting your
patch.
Thank you very much for spotting and fixing.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Sat, Mar 4, 2017 at 4:11 AM, Michael Meskes <meskes@postgresql.org> wrote:
Dear Sawada-san,
This cause is that the "begin transaction" is issued automatically
before executing COMMIT PREPARED if we're not in auto commit. The
Commit 816b008eaf1a1ff1069f3bafff363a9a8bf04a21 fixed bug of
incorrect
status calculation but at the same time it became the cause of this
behavior.
Is this a bug?I'd say so, yes.
As soon as I find time I'll get to it including back porting your
patch.
Thanks
Previous 002 patch lacked to add describing PREPARE TRANSACTION.
Attached updated 002 patch.
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:
002_ecpg_commit_rollback_prepared_doc_v2.patchapplication/octet-stream; name=002_ecpg_commit_rollback_prepared_doc_v2.patchDownload
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index b8021cb..bc4dd68 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -507,6 +507,35 @@ EXEC SQL COMMIT;
</listitem>
</varlistentry>
+ <variablelist>
+ <varlistentry>
+ <term><literal>EXEC SQL PREPARE TRANSACTION </literal><replaceable class="PARAMETER">transaction_id</></term>
+ <listitem>
+ <para>
+ Prepare the current transaction for two-phase commit.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <variablelist>
+ <varlistentry>
+ <term><literal>EXEC SQL COMMIT PREPARED </literal><replaceable class="PARAMETER">transaction_id</></term>
+ <listitem>
+ <para>
+ Commit a transaction that is in prepared state.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>EXEC SQL ROLLBACK PREPARED </literal><replaceable class="PARAMETER">transaction_id</></term>
+ <listitem>
+ <para>
+ Roll back a transaction that is in prepared state.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><literal>EXEC SQL SET AUTOCOMMIT TO ON</literal></term>
<listitem>
Previous 002 patch lacked to add describing PREPARE TRANSACTION.
Attached updated 002 patch.
I just committed both patches and a backport of the bug fix itself.
Thanks again for finding and fixing.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Tue, Mar 14, 2017 at 1:35 AM, Michael Meskes <meskes@postgresql.org> wrote:
Previous 002 patch lacked to add describing PREPARE TRANSACTION.
Attached updated 002 patch.I just committed both patches and a backport of the bug fix itself.
Thanks again for finding and fixing.
Regression tests for sql/twophase is failing while performing the test
with make installcheck.
+ [NO_PID]: ecpg_check_PQresult on line 32: bad response - ERROR:
prepared transactions are disabled
+ HINT: Set max_prepared_transactions to a nonzero value.
Setting max_prepared_transactions accordingly fixes the issue. But,
I'm not sure whether this test should be performed by installcheck by
default or should only be performed by make
installcheck-prepared-txns.
--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Fri, Mar 17, 2017 at 12:17 PM, Kuntal Ghosh
<kuntalghosh.2007@gmail.com> wrote:
On Tue, Mar 14, 2017 at 1:35 AM, Michael Meskes <meskes@postgresql.org> wrote:
Previous 002 patch lacked to add describing PREPARE TRANSACTION.
Attached updated 002 patch.I just committed both patches and a backport of the bug fix itself.
Thanks again for finding and fixing.Regression tests for sql/twophase is failing while performing the test with make installcheck. + [NO_PID]: ecpg_check_PQresult on line 32: bad response - ERROR: prepared transactions are disabled + HINT: Set max_prepared_transactions to a nonzero value.Setting max_prepared_transactions accordingly fixes the issue. But,
I'm not sure whether this test should be performed by installcheck by
default or should only be performed by make
installcheck-prepared-txns.
Thank you for pointing out.
Yeah, I agree that the twophase regression test should not be
performed by default as long as the default value of
max_prepared_transactions is 0. Similar to this, the isolation check
regression test does same thing. Attached patch removes sql/twophase
from schedule file and add new type of regression test.
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:
ecpg_prepared_txns_test.patchapplication/octet-stream; name=ecpg_prepared_txns_test.patchDownload
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index 28f02fe..ea7de34 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -86,3 +86,14 @@ checktcp: all
installcheck: all
./pg_regress $(REGRESS_OPTS) --bindir='$(bindir)' $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule
+
+# Versions of the check tests that include the twophase commit test.
+# It only makes sense to run these if set up to use prepared transactions,
+# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
+# installcheck case.
+
+installcheck-prepared-txns: all
+ ./pg_regress $(REGRESS_OPTS) --bindir='$(bindir)' $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule sql/twophase
+
+check-prepared-txns: all
+ $(with_temp_install) ./pg_regress $(REGRESS_OPTS) --temp-instance=./tmp_check $(TEMP_CONF) --bindir= $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule sql/twophase
diff --git a/src/interfaces/ecpg/test/ecpg_schedule b/src/interfaces/ecpg/test/ecpg_schedule
index 206f712..c3ec125 100644
--- a/src/interfaces/ecpg/test/ecpg_schedule
+++ b/src/interfaces/ecpg/test/ecpg_schedule
@@ -46,7 +46,6 @@ test: sql/indicators
test: sql/oldexec
test: sql/quote
test: sql/show
-test: sql/twophase
test: sql/insupd
test: sql/parser
test: thread/thread
On Fri, Mar 17, 2017 at 4:34 PM, Masahiko Sawada <sawada.mshk@gmail.com> wrote:
On Fri, Mar 17, 2017 at 12:17 PM, Kuntal Ghosh
<kuntalghosh.2007@gmail.com> wrote:On Tue, Mar 14, 2017 at 1:35 AM, Michael Meskes <meskes@postgresql.org> wrote:
Previous 002 patch lacked to add describing PREPARE TRANSACTION.
Attached updated 002 patch.I just committed both patches and a backport of the bug fix itself.
Thanks again for finding and fixing.Regression tests for sql/twophase is failing while performing the test with make installcheck. + [NO_PID]: ecpg_check_PQresult on line 32: bad response - ERROR: prepared transactions are disabled + HINT: Set max_prepared_transactions to a nonzero value.Setting max_prepared_transactions accordingly fixes the issue. But,
I'm not sure whether this test should be performed by installcheck by
default or should only be performed by make
installcheck-prepared-txns.Thank you for pointing out.
Yeah, I agree that the twophase regression test should not be
performed by default as long as the default value of
max_prepared_transactions is 0. Similar to this, the isolation check
regression test does same thing. Attached patch removes sql/twophase
from schedule file and add new type of regression test.
The patch looks good. I've performed installcheck and
installcheck-prepared-txns. It's working as it should be.
--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Thank you for pointing out.
Yeah, I agree that the twophase regression test should not be
performed by default as long as the default value of
max_prepared_transactions is 0. Similar to this, the isolation check
regression test does same thing. Attached patch removes sql/twophase
from schedule file and add new type of regression test.
Would it be possible to include it in "make check"? Any check that
needs manual interaction will not be executed nearly is often as the
others and become much less useful imo.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Mar 17, 2017 at 5:50 PM, Michael Meskes <meskes@postgresql.org> wrote:
Thank you for pointing out.
Yeah, I agree that the twophase regression test should not be
performed by default as long as the default value of
max_prepared_transactions is 0. Similar to this, the isolation check
regression test does same thing. Attached patch removes sql/twophase
from schedule file and add new type of regression test.Would it be possible to include it in "make check"? Any check that
needs manual interaction will not be executed nearly is often as the
others and become much less useful imo.
Yes. I added two-phase commit test to "make check" test schedule while
adding new two type of test.
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:
ecpg_prepared_txns_test_v2.patchapplication/octet-stream; name=ecpg_prepared_txns_test_v2.patchDownload
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index 28f02fe..73ac9e2 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -78,7 +78,7 @@ endif
REGRESS_OPTS = --dbname=ecpg1_regression,ecpg2_regression --create-role=regress_ecpg_user1,regress_ecpg_user2 $(EXTRA_REGRESS_OPTS)
check: all
- $(with_temp_install) ./pg_regress $(REGRESS_OPTS) --temp-instance=./tmp_check $(TEMP_CONF) --bindir= $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule
+ $(with_temp_install) ./pg_regress $(REGRESS_OPTS) --temp-instance=./tmp_check $(TEMP_CONF) --bindir= $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule sql/twophase
# the same options, but with --listen-on-tcp
checktcp: all
@@ -86,3 +86,14 @@ checktcp: all
installcheck: all
./pg_regress $(REGRESS_OPTS) --bindir='$(bindir)' $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule
+
+# Versions of the check tests that include the twophase commit test.
+# It only makes sense to run these if set up to use prepared transactions,
+# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
+# installcheck case.
+
+installcheck-prepared-txns: all
+ ./pg_regress $(REGRESS_OPTS) --bindir='$(bindir)' $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule sql/twophase
+
+check-prepared-txns: all
+ $(with_temp_install) ./pg_regress $(REGRESS_OPTS) --temp-instance=./tmp_check $(TEMP_CONF) --bindir= $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule sql/twophase
diff --git a/src/interfaces/ecpg/test/ecpg_schedule b/src/interfaces/ecpg/test/ecpg_schedule
index 206f712..c3ec125 100644
--- a/src/interfaces/ecpg/test/ecpg_schedule
+++ b/src/interfaces/ecpg/test/ecpg_schedule
@@ -46,7 +46,6 @@ test: sql/indicators
test: sql/oldexec
test: sql/quote
test: sql/show
-test: sql/twophase
test: sql/insupd
test: sql/parser
test: thread/thread
Yes. I added two-phase commit test to "make check" test schedule
while
adding new two type of test.
Thank you, committed.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers