You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by yj...@apache.org on 2015/11/03 06:13:48 UTC
incubator-hawq git commit: HAWQ-118. HAWQ treats commented lines as
hosts in slaves file
Repository: incubator-hawq
Updated Branches:
refs/heads/master f053e0537 -> 1d73a4792
HAWQ-118. HAWQ treats commented lines as hosts in slaves file
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/1d73a479
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/1d73a479
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/1d73a479
Branch: refs/heads/master
Commit: 1d73a4792e612c90232498e982d89b38d2f6fd4b
Parents: f053e05
Author: Yi Jin <yj...@pivotal.io>
Authored: Tue Nov 3 13:13:28 2015 +0800
Committer: Yi Jin <yj...@pivotal.io>
Committed: Tue Nov 3 13:13:28 2015 +0800
----------------------------------------------------------------------
src/backend/resourcemanager/resourcepool.c | 15 +++++++++++----
tools/bin/hawqpylib/hawqlib.py | 5 +++--
2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1d73a479/src/backend/resourcemanager/resourcepool.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcepool.c b/src/backend/resourcemanager/resourcepool.c
index f3d891f..f88ddc7 100644
--- a/src/backend/resourcemanager/resourcepool.c
+++ b/src/backend/resourcemanager/resourcepool.c
@@ -3610,9 +3610,10 @@ void checkSlavesFile(void)
void refreshSlavesFileHostSize(FILE *fp)
{
- static char zero[1] = "";
- int newcnt = 0;
- bool haserror = false;
+ static char zero[1] = "";
+ int newcnt = 0;
+ bool haserror = false;
+ bool incomment = false;
SelfMaintainBufferData smb;
elog(DEBUG3, "Refresh slaves file host size now.");
@@ -3648,8 +3649,14 @@ void refreshSlavesFileHostSize(FILE *fp)
resetSelfMaintainBuffer(&smb);
newcnt++;
}
+ incomment = false;
}
- else
+ /* '#' is treated as a start symbol of a comment string in the line. */
+ else if ( c == '#' )
+ {
+ incomment = true;
+ }
+ else if ( !incomment )
{
/* Add this character into the buffer. */
char cval = c;
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1d73a479/tools/bin/hawqpylib/hawqlib.py
----------------------------------------------------------------------
diff --git a/tools/bin/hawqpylib/hawqlib.py b/tools/bin/hawqpylib/hawqlib.py
index 9d7e25f..0549e25 100755
--- a/tools/bin/hawqpylib/hawqlib.py
+++ b/tools/bin/hawqpylib/hawqlib.py
@@ -114,8 +114,9 @@ def parse_hosts_file(GPHOME):
with open(host_file) as f:
hosts = f.readlines()
for host in hosts:
- host = host.strip()
- host_list.append(host)
+ host = host.split("#",1)[0].strip()
+ if host:
+ host_list.append(host)
return host_list