You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by sz...@apache.org on 2012/05/08 19:57:07 UTC
svn commit: r1335662 - in
/hadoop/common/branches/branch-2/hadoop-mapreduce-project: ./ src/contrib/
src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/blockmanagement/
src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/blockmanagement/
src/c...
Author: szetszwo
Date: Tue May 8 17:57:07 2012
New Revision: 1335662
URL: http://svn.apache.org/viewvc?rev=1335662&view=rev
Log:
svn merge -c 1335661 from trunk for MAPREDUCE-4231.
Modified:
hadoop/common/branches/branch-2/hadoop-mapreduce-project/ (props changed)
hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt (contents, props changed)
hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/ (props changed)
hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyRaid.java
hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockPlacementPolicyRaid.java
hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/namenode/NameNodeRaidTestUtil.java
Propchange: hadoop/common/branches/branch-2/hadoop-mapreduce-project/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-mapreduce-project:r1335661
Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt?rev=1335662&r1=1335661&r2=1335662&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt Tue May 8 17:57:07 2012
@@ -175,6 +175,9 @@ Release 2.0.0 - UNRELEASED
MAPREDUCE-3958. RM: Remove RMNodeState and replace it with NodeState
(Bikas Saha via bobby)
+ MAPREDUCE-4231. Update RAID to use the new BlockCollection interface.
+ (szetszwo)
+
Release 0.23.3 - UNRELEASED
INCOMPATIBLE CHANGES
Propchange: hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt:r1335661
Propchange: hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-mapreduce-project/src/contrib:r1335661
Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyRaid.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyRaid.java?rev=1335662&r1=1335661&r2=1335662&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyRaid.java (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyRaid.java Tue May 8 17:57:07 2012
@@ -144,7 +144,7 @@ public class BlockPlacementPolicyRaid ex
/** {@inheritDoc} */
@Override
- public DatanodeDescriptor chooseReplicaToDelete(FSInodeInfo inode,
+ public DatanodeDescriptor chooseReplicaToDelete(BlockCollection inode,
Block block, short replicationFactor,
Collection<DatanodeDescriptor> first,
Collection<DatanodeDescriptor> second) {
@@ -425,7 +425,7 @@ public class BlockPlacementPolicyRaid ex
}
/**
- * Cache results for FSInodeInfo.getFullPathName()
+ * Cache results for getFullPathName()
*/
static class CachedFullPathNames {
FSNamesystem namesystem;
@@ -446,8 +446,8 @@ public class BlockPlacementPolicyRaid ex
};
static private class INodeWithHashCode {
- FSInodeInfo inode;
- INodeWithHashCode(FSInodeInfo inode) {
+ BlockCollection inode;
+ INodeWithHashCode(BlockCollection inode) {
this.inode = inode;
}
@Override
@@ -459,11 +459,11 @@ public class BlockPlacementPolicyRaid ex
return System.identityHashCode(inode);
}
String getFullPathName() {
- return inode.getFullPathName();
+ return inode.getName();
}
}
- public String get(FSInodeInfo inode) throws IOException {
+ public String get(BlockCollection inode) throws IOException {
return cacheInternal.get(new INodeWithHashCode(inode));
}
}
Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockPlacementPolicyRaid.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockPlacementPolicyRaid.java?rev=1335662&r1=1335661&r2=1335662&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockPlacementPolicyRaid.java (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockPlacementPolicyRaid.java Tue May 8 17:57:07 2012
@@ -41,7 +41,6 @@ import org.apache.hadoop.hdfs.protocol.L
import org.apache.hadoop.hdfs.server.blockmanagement.BlockPlacementPolicyRaid.CachedFullPathNames;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockPlacementPolicyRaid.CachedLocatedBlocks;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockPlacementPolicyRaid.FileType;
-import org.apache.hadoop.hdfs.server.namenode.FSInodeInfo;
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
import org.apache.hadoop.hdfs.server.namenode.INodeFile;
import org.apache.hadoop.hdfs.server.namenode.NameNodeRaidTestUtil;
@@ -241,7 +240,7 @@ public class TestBlockPlacementPolicyRai
// test full path cache
CachedFullPathNames cachedFullPathNames =
new CachedFullPathNames(namesystem);
- final FSInodeInfo[] inodes = NameNodeRaidTestUtil.getFSInodeInfo(
+ final BlockCollection[] inodes = NameNodeRaidTestUtil.getBlockCollections(
namesystem, file1, file2);
verifyCachedFullPathNameResult(cachedFullPathNames, inodes[0]);
@@ -477,14 +476,14 @@ public class TestBlockPlacementPolicyRai
}
private void verifyCachedFullPathNameResult(
- CachedFullPathNames cachedFullPathNames, FSInodeInfo inode)
+ CachedFullPathNames cachedFullPathNames, BlockCollection inode)
throws IOException {
- String res1 = inode.getFullPathName();
+ String res1 = inode.getName();
String res2 = cachedFullPathNames.get(inode);
LOG.info("Actual path name: " + res1);
LOG.info("Cached path name: " + res2);
Assert.assertEquals(cachedFullPathNames.get(inode),
- inode.getFullPathName());
+ inode.getName());
}
private void verifyCachedBlocksResult(CachedLocatedBlocks cachedBlocks,
@@ -503,7 +502,7 @@ public class TestBlockPlacementPolicyRai
private Collection<LocatedBlock> getCompanionBlocks(
FSNamesystem namesystem, BlockPlacementPolicyRaid policy,
ExtendedBlock block) throws IOException {
- INodeFile inode = blockManager.blocksMap.getINode(block
+ INodeFile inode = (INodeFile)blockManager.blocksMap.getINode(block
.getLocalBlock());
FileType type = policy.getFileType(inode.getFullPathName());
return policy.getCompanionBlocks(inode.getFullPathName(), type,
Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/namenode/NameNodeRaidTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/namenode/NameNodeRaidTestUtil.java?rev=1335662&r1=1335661&r2=1335662&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/namenode/NameNodeRaidTestUtil.java (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/src/contrib/raid/src/test/org/apache/hadoop/hdfs/server/namenode/NameNodeRaidTestUtil.java Tue May 8 17:57:07 2012
@@ -18,16 +18,17 @@
package org.apache.hadoop.hdfs.server.namenode;
import org.apache.hadoop.fs.UnresolvedLinkException;
+import org.apache.hadoop.hdfs.server.blockmanagement.BlockCollection;
public class NameNodeRaidTestUtil {
- public static FSInodeInfo[] getFSInodeInfo(final FSNamesystem namesystem,
+ public static BlockCollection[] getBlockCollections(final FSNamesystem namesystem,
final String... files) throws UnresolvedLinkException {
- final FSInodeInfo[] inodes = new FSInodeInfo[files.length];
+ final BlockCollection[] inodes = new BlockCollection[files.length];
final FSDirectory dir = namesystem.dir;
dir.readLock();
try {
for(int i = 0; i < files.length; i++) {
- inodes[i] = dir.rootDir.getNode(files[i], true);
+ inodes[i] = (BlockCollection)dir.rootDir.getNode(files[i], true);
}
return inodes;
} finally {