Return-Path: X-Original-To: apmail-incubator-ambari-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ambari-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE1AAD162 for ; Thu, 16 Aug 2012 21:57:50 +0000 (UTC) Received: (qmail 93988 invoked by uid 500); 16 Aug 2012 21:57:50 -0000 Delivered-To: apmail-incubator-ambari-commits-archive@incubator.apache.org Received: (qmail 93963 invoked by uid 500); 16 Aug 2012 21:57:50 -0000 Mailing-List: contact ambari-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@incubator.apache.org Delivered-To: mailing list ambari-commits@incubator.apache.org Received: (qmail 93955 invoked by uid 99); 16 Aug 2012 21:57:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Aug 2012 21:57:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Aug 2012 21:57:47 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 387E123888E4; Thu, 16 Aug 2012 21:57:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1374078 - in /incubator/ambari/branches/branch-0.9: 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:57:02 -0000 To: ambari-commits@incubator.apache.org From: hitesh@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120816215703.387E123888E4@eris.apache.org> Author: hitesh Date: Thu Aug 16 21:57:02 2012 New Revision: 1374078 URL: http://svn.apache.org/viewvc?rev=1374078&view=rev Log: AMBARI-667. After reboots, namenode start fails as it thinks dfs is not formatted. (Contributed by hitesh) Modified: incubator/ambari/branches/branch-0.9/CHANGES.txt incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/params.pp Modified: incubator/ambari/branches/branch-0.9/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/CHANGES.txt?rev=1374078&r1=1374077&r2=1374078&view=diff ============================================================================== --- incubator/ambari/branches/branch-0.9/CHANGES.txt (original) +++ incubator/ambari/branches/branch-0.9/CHANGES.txt Thu Aug 16 21:57:02 2012 @@ -6,6 +6,8 @@ characters wide. Release 0.9.0 - unreleased + 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/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh?rev=1374078&r1=1374077&r2=1374078&view=diff ============================================================================== --- incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh (original) +++ incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/files/checkForFormat.sh Thu Aug 16 21:57:02 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/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp?rev=1374078&r1=1374077&r2=1374078&view=diff ============================================================================== --- incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp (original) +++ incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/namenode/format.pp Thu Aug 16 21:57:02 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 @@ -40,8 +40,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", @@ -50,7 +50,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/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/params.pp URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/params.pp?rev=1374078&r1=1374077&r2=1374078&view=diff ============================================================================== --- incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/params.pp (original) +++ incubator/ambari/branches/branch-0.9/hmc/puppet/modules/hdp-hadoop/manifests/params.pp Thu Aug 16 21:57:02 2012 @@ -41,9 +41,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")