You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by wl...@apache.org on 2016/01/29 06:07:01 UTC

incubator-hawq git commit: HAWQ-274. Make function CheckTmpDirAvailable more simple

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 226a55c38 -> 122df07f2


HAWQ-274. Make function CheckTmpDirAvailable more simple


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

Branch: refs/heads/master
Commit: 122df07f21a44f772dd2edb42e20a3b8f3edc8db
Parents: 226a55c
Author: Wen Lin <wl...@pivotal.io>
Authored: Fri Jan 29 13:05:54 2016 +0800
Committer: Wen Lin <wl...@pivotal.io>
Committed: Fri Jan 29 13:05:54 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbtmpdir.c                     |  2 +-
 .../resourcemanager/resourcemanager_RMSEG.c     | 22 ++++----------------
 2 files changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/122df07f/src/backend/cdb/cdbtmpdir.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbtmpdir.c b/src/backend/cdb/cdbtmpdir.c
index aef015f..b0e50d9 100644
--- a/src/backend/cdb/cdbtmpdir.c
+++ b/src/backend/cdb/cdbtmpdir.c
@@ -45,7 +45,7 @@ List *initTmpDirList(List *list, char *szTmpDir)
                 tmpdir = (char *)palloc0(i-idx);
                 strncpy(tmpdir, szTmpDir+idx+1, i-idx-1);
                 tmpDirNum++;
-                elog(LOG, "Get a temporary directory:%s", tmpdir);
+                elog(DEBUG5, "Get a temporary directory:%s", tmpdir);
                 list = lappend(list, tmpdir);
             }
             idx = i;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/122df07f/src/backend/resourcemanager/resourcemanager_RMSEG.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcemanager_RMSEG.c b/src/backend/resourcemanager/resourcemanager_RMSEG.c
index 9a89199..afc7c49 100644
--- a/src/backend/resourcemanager/resourcemanager_RMSEG.c
+++ b/src/backend/resourcemanager/resourcemanager_RMSEG.c
@@ -247,7 +247,7 @@ bool CheckTmpDirAvailable(char *path)
 	char* fname = NULL;
 	char* testfile = "/checktmpdir.log";
 
-	/* write some bytes to a file to check if
+	/* open a file to check if
 	 * this temporary directory is OK.
 	 */
 	fname = palloc0(strlen(path) + strlen(testfile) + 1);
@@ -256,26 +256,12 @@ bool CheckTmpDirAvailable(char *path)
 	tmp = fopen(fname, "w");
 	if (tmp == NULL)
 	{
-		elog(LOG, "Can't open file:%s when check temporary directory", fname);
+		elog(LOG, "Can't open file:%s when check temporary directory: %s",
+				  fname,
+				  strerror(errno));
 		ret = false;
-		goto _exit;
 	}
 
-	if (fseek(tmp, 0, SEEK_SET) != 0)
-	{
-		elog(LOG, "Can't seek file:%s when check temporary directory", fname);
-		ret = false;
-		goto _exit;
-	}
-
-	if (strlen("test") != fwrite("test", 1, strlen("test"), tmp))
-	{
-		elog(LOG, "Can't write file:%s when check temporary directory", fname);
-		ret = false;
-		goto _exit;
-	}
-
-	_exit:
 	pfree(fname);
 	if (tmp != NULL)
 		fclose(tmp);