hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul...@apache.org
Subject incubator-hawq git commit: HAWQ-1379. Do not send options multiple times in build_startup_packet()
Date Wed, 15 Mar 2017 05:13:08 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 8b13c4bae -> 0631d0568


HAWQ-1379. Do not send options multiple times in build_startup_packet()

This patch also tweak the related code a bit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/0631d056
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/0631d056
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/0631d056

Branch: refs/heads/master
Commit: 0631d056865cabba3affcbba341e4243049faf6f
Parents: 8b13c4b
Author: Paul Guo <paulguo@gmail.com>
Authored: Tue Mar 7 15:14:14 2017 +0800
Committer: Paul Guo <paulguo@gmail.com>
Committed: Wed Mar 15 13:12:50 2017 +0800

----------------------------------------------------------------------
 src/backend/gp_libpq_fe/fe-protocol3.c | 61 ++++-------------------------
 1 file changed, 7 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0631d056/src/backend/gp_libpq_fe/fe-protocol3.c
----------------------------------------------------------------------
diff --git a/src/backend/gp_libpq_fe/fe-protocol3.c b/src/backend/gp_libpq_fe/fe-protocol3.c
index 4143d49..284ff33 100644
--- a/src/backend/gp_libpq_fe/fe-protocol3.c
+++ b/src/backend/gp_libpq_fe/fe-protocol3.c
@@ -2238,55 +2238,20 @@ build_startup_packet(const PGconn *conn, char *packet,
 
 	/* GPSQL: */
 	if (conn->dboid && conn->dboid[0])
-	{
-		if (packet)
-			strcpy(packet + packet_len, "dboid");
-		packet_len += strlen("dboid") + 1;
-		if (packet)
-			strcpy(packet + packet_len, conn->dboid);
-		packet_len += strlen(conn->dboid) + 1;
-	}
+		ADD_STARTUP_OPTION("dboid", conn->dboid);
 
 	if (conn->dbdtsoid && conn->dbdtsoid[0])
-	{
-		if (packet)
-			strcpy(packet + packet_len, "dbdtsoid");
-		packet_len += strlen("dbdtsoid") + 1;
-		if (packet)
-			strcpy(packet + packet_len, conn->dbdtsoid);
-		packet_len += strlen(conn->dbdtsoid) + 1;
-	}
+		ADD_STARTUP_OPTION("dbdtsoid", conn->dbdtsoid);
 
 	if (conn->bootstrap_user && conn->bootstrap_user[0])
-	{
-		if (packet)
-			strcpy(packet + packet_len, "bootstrap_user");
-		packet_len += strlen("bootstrap_user") + 1;
-		if (packet)
-			strcpy(packet + packet_len, conn->bootstrap_user);
-		packet_len += strlen(conn->bootstrap_user) + 1;
-	}
+		ADD_STARTUP_OPTION("bootstrap_user", conn->bootstrap_user);
 
 	if (conn->encoding && conn->encoding[0])
-	{
-		if (packet)
-			strcpy(packet + packet_len, "encoding");
-		packet_len += strlen("encoding") + 1;
-		if (packet)
-			strcpy(packet + packet_len, conn->encoding);
-		packet_len += strlen(conn->encoding) + 1;
-	}
+		ADD_STARTUP_OPTION("encoding", conn->encoding);
 
 	/* CDB: Add qExec startup data */
 	if (conn->gpqeid && conn->gpqeid[0])
-	{
-		if (packet)
-			strcpy(packet + packet_len, "gpqeid");
-		packet_len += strlen("gpqeid") + 1;
-		if (packet)
-			strcpy(packet + packet_len, conn->gpqeid);
-		packet_len += strlen(conn->gpqeid) + 1;
-	}
+		ADD_STARTUP_OPTION("gpqeid", conn->gpqeid);
 
 	/* Add any environment-driven GUC settings needed */
 	for (next_eo = options; next_eo->envName; next_eo++)
@@ -2296,20 +2261,8 @@ build_startup_packet(const PGconn *conn, char *packet,
 		if ((val = getenv(next_eo->envName)) != NULL)
 		{
 			if (pg_strcasecmp(val, "default") != 0)
-			{
-				if (packet)
-					strcpy(packet + packet_len, next_eo->pgName);
-				packet_len += strlen(next_eo->pgName) + 1;
-				if (packet)
-					strcpy(packet + packet_len, val);
-				packet_len += strlen(val) + 1;
-			}
-		}		if (packet)
-			strcpy(packet + packet_len, "options");
-		packet_len += strlen("options") + 1;
-		if (packet)
-			strcpy(packet + packet_len, conn->pgoptions);
-		packet_len += strlen(conn->pgoptions) + 1;
+				ADD_STARTUP_OPTION(next_eo->pgName, val);
+		}
 	}
 
 	/* Add trailing terminator */


Mime
View raw message