incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hit...@apache.org
Subject svn commit: r1374077 - in /incubator/ambari/trunk: CHANGES.txt hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp hmc/puppet/modules/hdp-hadoop/manifests/params.pp
Date Thu, 16 Aug 2012 21:54:44 GMT
Author: hitesh
Date: Thu Aug 16 21:54:44 2012
New Revision: 1374077

URL: http://svn.apache.org/viewvc?rev=1374077&view=rev
Log:
AMBARI-667. After reboots, namenode start fails as it thinks dfs is not formatted. (Contributed
by hitesh)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh
    incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp
    incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/params.pp

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1374077&r1=1374076&r2=1374077&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Aug 16 21:54:44 2012
@@ -147,6 +147,8 @@ Trunk (unreleased changes)
 
 Release 0.9.0
 
+  AMBARI-667. After reboots, namenode start fails as it thinks dfs is not formatted (hitesh)
+
   AMBARI-668. Ambari should install yum priorities plugin on all nodes to ensure repo
   priorities are adhered to. (hitesh)
 

Modified: incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh?rev=1374077&r1=1374076&r2=1374077&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh (original)
+++ incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh Thu Aug 16
21:54:44 2012
@@ -24,7 +24,7 @@ export hdfs_user=$1
 shift
 export conf_dir=$1
 shift
-export mark_file=$1
+export mark_dir=$1
 shift
 export name_dirs=$*
 
@@ -32,9 +32,15 @@ export EXIT_CODE=0
 export command="namenode -format"
 export list_of_non_empty_dirs=""
 
-if [[ ! -f $mark_file ]] ; then 
+mark_file=/var/run/hadoop/hdfs/namenode-formatted
+if [[ -f ${mark_file} ]] ; then
+  rm -f ${mark_file}
+  mkdir -p ${mark_dir}
+fi
+
+if [[ ! -d $mark_dir ]] ; then
   for dir in `echo $name_dirs | tr ',' ' '` ; do
-    echo "DIrname = $dir"
+    echo "NameNode Dirname = $dir"
     cmd="ls $dir | wc -l  | grep -q ^0$"
     eval $cmd
     if [[ $? -ne 0 ]] ; then
@@ -43,11 +49,13 @@ if [[ ! -f $mark_file ]] ; then 
     fi
   done
 
-  if [[ $EXIT_CODE == 0 ]] ; then 
+  if [[ $EXIT_CODE == 0 ]] ; then
     su - ${hdfs_user} -c "yes Y | hadoop --config ${conf_dir} ${command}"
   else
     echo "ERROR: Namenode directory(s) is non empty. Will not format the namenode. List of
non-empty namenode dirs ${list_of_non_empty_dirs}"
   fi
+else
+  echo "${mark_dir} exists. Namenode DFS already formatted"
 fi
 
 exit $EXIT_CODE

Modified: incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp?rev=1374077&r1=1374076&r2=1374077&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp (original)
+++ incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp Thu
Aug 16 21:54:44 2012
@@ -22,7 +22,7 @@ class hdp-hadoop::namenode::format(
   $force = false
 )
 {
-  $mark_file = $hdp-hadoop::params::namenode_formatted_mark_file
+  $mark_dir = $hdp-hadoop::params::namenode_formatted_mark_dir
   $dfs_name_dir = $hdp-hadoop::params::dfs_name_dir
   $hdfs_user = $hdp::params::hdfs_user
   $hadoop_conf_dir = $hdp-hadoop::params::conf_dir
@@ -41,8 +41,8 @@ class hdp-hadoop::namenode::format(
     }
 
     exec { '/tmp/checkForFormat.sh':
-      command   => "sh /tmp/checkForFormat.sh ${hdfs_user} ${hadoop_conf_dir} ${mark_file}
${dfs_name_dir} ",
-      unless   => "test -f ${mark_file}",
+      command   => "sh /tmp/checkForFormat.sh ${hdfs_user} ${hadoop_conf_dir} ${mark_dir}
${dfs_name_dir} ",
+      unless   => "test -d ${mark_dir}",
       require   => File['/tmp/checkForFormat.sh'],
       path      => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
       logoutput => "true",
@@ -51,7 +51,7 @@ class hdp-hadoop::namenode::format(
   }
 
   hdp::exec { 'set namenode mark' :
-    command     => "touch ${mark_file}",
+    command     => "mkdir -p ${mark_dir}",
     refreshonly => true
   }
 }

Modified: incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/params.pp?rev=1374077&r1=1374076&r2=1374077&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/params.pp (original)
+++ incubator/ambari/trunk/hmc/puppet/modules/hdp-hadoop/manifests/params.pp Thu Aug 16 21:54:44
2012
@@ -59,9 +59,9 @@ class hdp-hadoop::params(
   $hadoop_logdirprefix = hdp_default("hadoop/hadoop-env/hadoop_logdirprefix","/var/log/hadoop")
 
   $hadoop_piddirprefix = hdp_default("hadoop/hadoop-env/hadoop_piddirprefix","/var/run/hadoop")
-  $run_dir = $hadoop_piddirprefix 
-  $namenode_formatted_mark_file = "${run_dir}/hdfs/namenode-formatted"
+  $run_dir = $hadoop_piddirprefix
 
+  $namenode_formatted_mark_dir = "${run_dir}/hdfs/namenode/formatted/"
 
   $jtnode_heapsize = hdp_default("hadoop/hadoop-env/jtnode_heapsize","1024m")
 



Mime
View raw message