HDFS-5383. fix broken caching unit tests (Andrew Wang)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-4949@1533253 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da1f4419e3
commit
dcb0b85333
|
@ -99,3 +99,5 @@ HDFS-4949 (Unreleased)
|
|||
|
||||
HDFS-5373. hdfs cacheadmin -addDirective short usage does not mention
|
||||
-replication parameter. (cnauroth)
|
||||
|
||||
HDFS-5383. fix broken caching unit tests. (Andrew Wang)
|
||||
|
|
|
@ -662,7 +662,6 @@ public final class CacheManager {
|
|||
* @throws IOException
|
||||
*/
|
||||
public void loadState(DataInput in) throws IOException {
|
||||
assert namesystem.hasWriteLock();
|
||||
nextEntryId = in.readLong();
|
||||
// pools need to be loaded first since entries point to their parent pool
|
||||
loadPools(in);
|
||||
|
|
|
@ -41,6 +41,7 @@ public class TestClientNamenodeProtocolServerSideTranslatorPB {
|
|||
setDirective(PathBasedCacheDirectiveProto.newBuilder().
|
||||
setPath("").
|
||||
setPool("pool").
|
||||
setReplication(1).
|
||||
build()).
|
||||
build();
|
||||
ClientNamenodeProtocolServerSideTranslatorPB translator =
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
package org.apache.hadoop.hdfs.server.datanode;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
@ -41,7 +42,7 @@ import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB;
|
|||
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi;
|
||||
import org.apache.hadoop.hdfs.server.namenode.FSImage;
|
||||
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
||||
import org.apache.hadoop.hdfs.server.protocol.BlockCommand;
|
||||
import org.apache.hadoop.hdfs.server.protocol.BlockIdCommand;
|
||||
import org.apache.hadoop.hdfs.server.protocol.CacheReport;
|
||||
import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand;
|
||||
import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol;
|
||||
|
@ -139,11 +140,11 @@ public class TestFsDatasetCache {
|
|||
private static DatanodeCommand getResponse(HdfsBlockLocation[] locs,
|
||||
int action) {
|
||||
String bpid = locs[0].getLocatedBlock().getBlock().getBlockPoolId();
|
||||
Block[] blocks = new Block[locs.length];
|
||||
long[] blocks = new long[locs.length];
|
||||
for (int i=0; i<locs.length; i++) {
|
||||
blocks[i] = locs[i].getLocatedBlock().getBlock().getLocalBlock();
|
||||
blocks[i] = locs[i].getLocatedBlock().getBlock().getBlockId();
|
||||
}
|
||||
return new BlockCommand(action, bpid, blocks);
|
||||
return new BlockIdCommand(action, bpid, blocks);
|
||||
}
|
||||
|
||||
private static long[] getBlockSizes(HdfsBlockLocation[] locs)
|
||||
|
|
Loading…
Reference in New Issue