hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shiv...@apache.org
Subject [24/50] incubator-hawq git commit: HAWQ-549. Ignore empty 'pg_log' folder while doing standby data directory check
Date Mon, 21 Mar 2016 22:01:53 GMT
HAWQ-549. Ignore empty 'pg_log' folder while doing standby data directory check


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

Branch: refs/heads/HAWQ-459
Commit: aef7bd2f3465684d84b7b9ee515aee39f4346780
Parents: fd20227
Author: rlei <rlei@pivotal.io>
Authored: Wed Mar 16 16:53:12 2016 +0800
Committer: rlei <rlei@pivotal.io>
Committed: Thu Mar 17 10:36:09 2016 +0800

----------------------------------------------------------------------
 tools/bin/lib/hawqinit.sh | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/aef7bd2f/tools/bin/lib/hawqinit.sh
----------------------------------------------------------------------
diff --git a/tools/bin/lib/hawqinit.sh b/tools/bin/lib/hawqinit.sh
index dab0b34..43ffdef 100755
--- a/tools/bin/lib/hawqinit.sh
+++ b/tools/bin/lib/hawqinit.sh
@@ -473,8 +473,13 @@ check_data_directorytory() {
         ${MKDIR} -p ${default_sdd}
     fi
     # Check if data directory already exist and clean.
+    if [ "${hawq_data_directory}" = "" ]; then
+        LOG_MSG "[ERROR]:-Data directory path is not valid value on ${host_name}" verbose
+        exit 1
+    fi
+
     if [ -d ${hawq_data_directory} ]; then
-        if [ "$(ls -A ${hawq_data_directory})" ] && [ "${hawq_data_directory}" !=
"" ]; then
+        if [ "$(ls -A ${hawq_data_directory})" ]; then
              LOG_MSG "[ERROR]:-Data directory ${hawq_data_directory} is not empty on ${host_name}"
verbose
              exit 1
         fi
@@ -484,6 +489,37 @@ check_data_directorytory() {
     fi
 }
 
+check_standby_data_directorytory() {
+    # If it's default directory, create it if not exist.
+    default_mdd=~/hawq-data-directory/masterdd
+    default_sdd=~/hawq-data-directory/segmentdd
+    if [ "${hawq_data_directory}" = "${default_mdd}" ]; then
+        ${MKDIR} -p ${default_mdd}
+    elif [ "${hawq_data_directory}" = "${default_sdd}" ]; then
+        ${MKDIR} -p ${default_sdd}
+    fi
+    # Check if data directory already exist and clean.
+    if [ "${hawq_data_directory}" = "" ]; then
+        LOG_MSG "[ERROR]:-Data directory path is not valid value on ${host_name}" verbose
+        exit 1
+    fi
+
+    if [ -d "${hawq_data_directory}" ]; then
+        if [ "$(ls -A ${hawq_data_directory}| ${GREP} -v pg_log)" ]; then
+            LOG_MSG "[ERROR]:-Data directory ${hawq_data_directory} is not empty on ${host_name}"
verbose
+            exit 1
+        else
+            if [ -d ${hawq_data_directory}/pg_log ] && [ "$(ls -A ${hawq_data_directory}/pg_log)"
]; then
+                 LOG_MSG "[ERROR]:-Data directory ${hawq_data_directory} is not empty on
${host_name}" verbose
+                 exit 1
+            fi
+        fi
+    else
+        LOG_MSG "[ERROR]:-Data directory ${hawq_data_directory} does not exist on ${host_name},
please create it" verbose
+        exit 1
+    fi
+}
+
 check_temp_directory() {
     # Check if temp directory exist.
     for tmp_dir in ${tmp_dir_list}; do
@@ -504,7 +540,7 @@ if [ ${object_type} == "master" ]; then
     check_temp_directory
     master_init
 elif [ ${object_type} == "standby" ]; then
-    check_data_directorytory
+    check_standby_data_directorytory
     standby_init
 elif [ ${object_type} == "segment" ]; then
     check_data_directorytory


Mime
View raw message