Thanks Wang for the patch. At a glance, it looks nice. Please let me take a closer look before commit.
Regards;
---
Koichi Suzuki
2014/04/23 22:17、Wang Diancheng <dia...@gm...> のメール:
> Hi,
>
> patch attached.
>
>
> diff --git a/src/backend/access/transam/gtm.c b/src/backend/access/transam/gtm.c
> index 943ce57..087313e 100644
> --- a/src/backend/access/transam/gtm.c
> +++ b/src/backend/access/transam/gtm.c
> @@ -170,12 +170,13 @@ BeginTranAutovacuumGTM(void)
> int
> CommitTranGTM(GlobalTransactionId gxid)
> {
> - int ret;
> + int ret = -1;
>
> if (!GlobalTransactionIdIsValid(gxid))
> return 0;
> CheckConnection();
> - ret = commit_transaction(conn, gxid);
> + if (conn)
> + ret = commit_transaction(conn, gxid);
>
> /*
> * If something went wrong (timeout), try and reset GTM connection.
> @@ -203,12 +204,13 @@ CommitTranGTM(GlobalTransactionId gxid)
> int
> CommitPreparedTranGTM(GlobalTransactionId gxid, GlobalTransactionId prepared_gxid)
> {
> - int ret = 0;
> + int ret = -1;
>
> if (!GlobalTransactionIdIsValid(gxid) || !GlobalTransactionIdIsValid(prepared_gxid))
> - return ret;
> + return 0;
> CheckConnection();
> - ret = commit_prepared_transaction(conn, gxid, prepared_gxid);
> + if (conn)
> + ret = commit_prepared_transaction(conn, gxid, prepared_gxid);
>
> /*
> * If something went wrong (timeout), try and reset GTM connection.
> @@ -257,13 +259,13 @@ StartPreparedTranGTM(GlobalTransactionId gxid,
> char *gid,
> char *nodestring)
> {
> - int ret = 0;
> + int ret = -1;
>
> if (!GlobalTransactionIdIsValid(gxid))
> return 0;
> CheckConnection();
> -
> - ret = start_prepared_transaction(conn, gxid, gid, nodestring);
> + if (conn)
> + ret = start_prepared_transaction(conn, gxid, gid, nodestring);
>
> /*
> * If something went wrong (timeout), try and reset GTM connection.
> @@ -282,12 +284,13 @@ StartPreparedTranGTM(GlobalTransactionId gxid,
> int
> PrepareTranGTM(GlobalTransactionId gxid)
> {
> - int ret;
> + int ret = -1;
>
> if (!GlobalTransactionIdIsValid(gxid))
> return 0;
> CheckConnection();
> - ret = prepare_transaction(conn, gxid);
> + if (conn)
> + ret = prepare_transaction(conn, gxid);
>
> /*
> * If something went wrong (timeout), try and reset GTM connection.
> @@ -310,11 +313,12 @@ GetGIDDataGTM(char *gid,
> GlobalTransactionId *prepared_gxid,
> char **nodestring)
> {
> - int ret = 0;
> + int ret = -1;
>
> CheckConnection();
> - ret = get_gid_data(conn, GTM_ISOLATION_RC, gid, gxid,
> - prepared_gxid, nodestring);
> + if (conn)
> + ret = get_gid_data(conn, GTM_ISOLATION_RC, gid, gxid,
> + prepared_gxid, nodestring);
>
> /*
> * If something went wrong (timeout), try and reset GTM connection.
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform_______________________________________________
> Postgres-xc-developers mailing list
> Pos...@li...
> https://lists.sourceforge.net/lists/listinfo/postgres-xc-developers
|