You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2013/04/20 22:11:25 UTC
svn commit: r1470223 - in /hadoop/common/branches/branch-1-win: ./
src/packages/win/scripts/ src/packages/win/template/conf/
Author: suresh
Date: Sat Apr 20 20:11:25 2013
New Revision: 1470223
URL: http://svn.apache.org/r1470223
Log:
HADOOP-9452. Windows install scripts bugfixes. Contributed by Ivan Mitic.
Modified:
hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
hadoop/common/branches/branch-1-win/src/packages/win/scripts/InstallApi.psm1
hadoop/common/branches/branch-1-win/src/packages/win/scripts/TestInstallApi.ps1
hadoop/common/branches/branch-1-win/src/packages/win/scripts/install.ps1
hadoop/common/branches/branch-1-win/src/packages/win/template/conf/mapred-site.xml
Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt?rev=1470223&r1=1470222&r2=1470223&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt Sat Apr 20 20:11:25 2013
@@ -258,6 +258,11 @@ Branch-hadoop-1-win (branched from branc
HADOOP-8731. Fixed TrackerDistributedCacheManager to address failure in the
test TestTrackerDistributedCacheManager on Windows. (Ivan Mitic via vinodkv)
+ HADOOP-9480. Windows installer should pick the config from
+ src\packages\win\template\conf. (Ivan Mitic via suresh)
+
+ HADOOP-9452. Windows install scripts bugfixes. (Ivan Mitic via suresh)
+
Merged from branch-1
HDFS-385. Backport: Add support for an experimental API that allows a
Modified: hadoop/common/branches/branch-1-win/src/packages/win/scripts/InstallApi.psm1
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/packages/win/scripts/InstallApi.psm1?rev=1470223&r1=1470222&r2=1470223&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/packages/win/scripts/InstallApi.psm1 (original)
+++ hadoop/common/branches/branch-1-win/src/packages/win/scripts/InstallApi.psm1 Sat Apr 20 20:11:25 2013
@@ -632,7 +632,9 @@ function UpdateXmlConfig(
[parameter( Position=1 )]
$config = @{} )
{
- $xml = [xml] (Get-Content $fileName)
+ $xml = New-Object System.Xml.XmlDocument
+ $xml.PreserveWhitespace = $true
+ $xml.Load($fileName)
foreach( $key in empty-null $config.Keys )
{
@@ -641,12 +643,17 @@ function UpdateXmlConfig(
$xml.SelectNodes('/configuration/property') | ? { $_.name -eq $key } | % { $_.value = $value; $found = $True }
if ( -not $found )
{
+ $xml["configuration"].AppendChild($xml.CreateWhitespace("`r`n ")) | Out-Null
$newItem = $xml.CreateElement("property")
+ $newItem.AppendChild($xml.CreateWhitespace("`r`n ")) | Out-Null
$newItem.AppendChild($xml.CreateElement("name")) | Out-Null
+ $newItem.AppendChild($xml.CreateWhitespace("`r`n ")) | Out-Null
$newItem.AppendChild($xml.CreateElement("value")) | Out-Null
+ $newItem.AppendChild($xml.CreateWhitespace("`r`n ")) | Out-Null
$newItem.name = $key
$newItem.value = $value
$xml["configuration"].AppendChild($newItem) | Out-Null
+ $xml["configuration"].AppendChild($xml.CreateWhitespace("`r`n")) | Out-Null
}
}
@@ -682,17 +689,24 @@ function AclFoldersForUser(
throw "AclFoldersForUser: Trying to ACLs the folder $key which is not defined in $xmlFileName"
}
- ### TODO: Support for JBOD and NN Replication
- $folderParent = Split-Path $folderName -parent
-
- if( -not (Test-Path $folderParent))
+ try
{
- Write-Log "AclFoldersForUser: Creating Directory `"$folderParent`" for ACLing"
- mkdir $folderParent
+ ### TODO: Support for JBOD and NN Replication
+ $folderParent = Split-Path $folderName -parent
+
+ if( -not (Test-Path $folderParent))
+ {
+ Write-Log "AclFoldersForUser: Creating Directory `"$folderParent`" for ACLing"
+ mkdir $folderParent
- ### TODO: ACL only if the folder does not exist. Otherwise, assume that
- ### it is ACLed properly.
- GiveFullPermissions $folderParent $username
+ ### TODO: ACL only if the folder does not exist. Otherwise, assume that
+ ### it is ACLed properly.
+ GiveFullPermissions $folderParent $username
+ }
+ }
+ catch
+ {
+ Write-Log "AclFoldersForUser: Skipped folder `"$folderName`", with exception: $_.Exception.ToString()"
}
}
Modified: hadoop/common/branches/branch-1-win/src/packages/win/scripts/TestInstallApi.ps1
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/packages/win/scripts/TestInstallApi.ps1?rev=1470223&r1=1470222&r2=1470223&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/packages/win/scripts/TestInstallApi.ps1 (original)
+++ hadoop/common/branches/branch-1-win/src/packages/win/scripts/TestInstallApi.ps1 Sat Apr 20 20:11:25 2013
@@ -282,8 +282,8 @@ function ValidateXmlConfigValue($xmlFile
function TestUpdateXmlConfig()
{
$xmlTemplate = "<?xml version=`"1.0`"?>`
- <configuration>`
- </configuration>"
+<configuration>`
+</configuration>"
$testFile = Join-Path $ScriptDir "testFile.xml"
write-output $xmlTemplate | out-file -encoding ascii $testFile
@@ -306,6 +306,27 @@ function TestUpdateXmlConfig()
ValidateXmlConfigValue $testFile "key3" "value3"
}
+function TestUpdateXmlConfigPreserveSpace()
+{
+ $xmlTemplate = "<?xml version=`"1.0`"?>`
+<configuration>`
+ <property>`
+ <name>test</name>`
+ <value> </value>`
+ </property>`
+</configuration>"
+ $testFile = Join-Path $ScriptDir "testFile.xml"
+ write-output $xmlTemplate | out-file -encoding ascii $testFile
+ [string]$original = Get-Content $testFile
+
+ ### Run xml thru UpdateXmlConfig
+ UpdateXmlConfig $testFile
+
+ ### Verify that the spaces are preserved
+ [string]$new = Get-Content $testFile
+ Assert "TestUpdateXmlConfigPreserveSpace: Spaces should be preserved" ( $original -eq $new )
+}
+
function CoreConfigureTestBasic()
{
Install "Core" $NodeInstallRoot $ServiceCredential ""
@@ -318,12 +339,12 @@ function CoreConfigureTestBasic()
### Change Hadoop core configuration
Configure "Core" $NodeInstallRoot $ServiceCredential @{
- "fs.checkpoint.dir" = "$NodeInstallRoot\hdfs\2nn";
+ "fs.checkpoint.dir" = "x:\hdfs\2nn"; ### should pass for a drive that does not exist
"fs.checkpoint.edits.dir" = "$NodeInstallRoot\hdfs\2nn";
"fs.default.name" = "asv://host:8000"}
### Verify that the update took place
- ValidateXmlConfigValue $coreSiteXml "fs.checkpoint.dir" "$NodeInstallRoot\hdfs\2nn"
+ ValidateXmlConfigValue $coreSiteXml "fs.checkpoint.dir" "x:\hdfs\2nn"
ValidateXmlConfigValue $coreSiteXml "fs.checkpoint.edits.dir" "$NodeInstallRoot\hdfs\2nn"
ValidateXmlConfigValue $coreSiteXml "fs.default.name" "asv://host:8000"
@@ -536,6 +557,7 @@ try
###
### Test methods
###
+
CoreInstallTestBasic
CoreInstallTestIdempotent
HdfsInstallTestBasic
@@ -549,6 +571,7 @@ try
InstallAllTestBasic
InstallAllTestIdempotent
TestUpdateXmlConfig
+ TestUpdateXmlConfigPreserveSpace
CoreConfigureTestBasic
CoreConfigureWithFileTestBasic
InstallAndConfigAllTestBasic
Modified: hadoop/common/branches/branch-1-win/src/packages/win/scripts/install.ps1
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/packages/win/scripts/install.ps1?rev=1470223&r1=1470222&r2=1470223&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/packages/win/scripts/install.ps1 (original)
+++ hadoop/common/branches/branch-1-win/src/packages/win/scripts/install.ps1 Sat Apr 20 20:11:25 2013
@@ -146,7 +146,8 @@ function Main( $scriptDir )
###
Install "MapReduce" $NodeInstallRoot $serviceCredential $mapRedRoles
Configure "MapReduce" $NodeInstallRoot $serviceCredential @{
- "mapred.local.dir" = "$ENV:HDFS_DATA_DIR\mapred\local"}
+ "mapred.local.dir" = "$ENV:HDFS_DATA_DIR\mapred\local";
+ "mapred.job.tracker.history.completed.location" = "/mapred/history/done"}
Write-Log "Install of Hadoop Core, HDFS, MapRed completed successfully"
}
Modified: hadoop/common/branches/branch-1-win/src/packages/win/template/conf/mapred-site.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/packages/win/template/conf/mapred-site.xml?rev=1470223&r1=1470222&r2=1470223&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/packages/win/template/conf/mapred-site.xml (original)
+++ hadoop/common/branches/branch-1-win/src/packages/win/template/conf/mapred-site.xml Sat Apr 20 20:11:25 2013
@@ -39,12 +39,6 @@
</property>
<property>
- <name>mapred.job.tracker.history.completed.location</name>
- <value>/mapred/history/done</value>
- <description>No description</description>
- </property>
-
- <property>
<name>mapreduce.history.server.embedded</name>
<value>false</value>
<description>Should job history server be embedded within Job tracker process</description>