HDFS-1217. Change some NameNode methods from public to package private. Constributed by Laxman
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1163081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c2b851b0f2
commit
aba0e225fc
@ -687,6 +687,9 @@ Release 0.23.0 - Unreleased
|
|||||||
HDFS-2266. Add Namesystem and SafeMode interfaces to avoid directly
|
HDFS-2266. Add Namesystem and SafeMode interfaces to avoid directly
|
||||||
referring to FSNamesystem in BlockManager. (szetszwo)
|
referring to FSNamesystem in BlockManager. (szetszwo)
|
||||||
|
|
||||||
|
HDFS-1217. Change some NameNode methods from public to package private.
|
||||||
|
(Laxman via szetszwo)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-1458. Improve checkpoint performance by avoiding unnecessary image
|
HDFS-1458. Improve checkpoint performance by avoiding unnecessary image
|
||||||
|
@ -301,7 +301,7 @@ public static InetSocketAddress getAddress(Configuration conf) {
|
|||||||
* @param filesystemURI
|
* @param filesystemURI
|
||||||
* @return address of file system
|
* @return address of file system
|
||||||
*/
|
*/
|
||||||
public static InetSocketAddress getAddress(URI filesystemURI) {
|
static InetSocketAddress getAddress(URI filesystemURI) {
|
||||||
String authority = filesystemURI.getAuthority();
|
String authority = filesystemURI.getAuthority();
|
||||||
if (authority == null) {
|
if (authority == null) {
|
||||||
throw new IllegalArgumentException(String.format(
|
throw new IllegalArgumentException(String.format(
|
||||||
@ -1262,7 +1262,7 @@ public UpgradeCommand processUpgradeCommand(UpgradeCommand comm) throws IOExcept
|
|||||||
* @param nodeReg data node registration
|
* @param nodeReg data node registration
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void verifyRequest(NodeRegistration nodeReg) throws IOException {
|
void verifyRequest(NodeRegistration nodeReg) throws IOException {
|
||||||
verifyVersion(nodeReg.getVersion());
|
verifyVersion(nodeReg.getVersion());
|
||||||
if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID())) {
|
if (!namesystem.getRegistrationID().equals(nodeReg.getRegistrationID())) {
|
||||||
LOG.warn("Invalid registrationID - expected: "
|
LOG.warn("Invalid registrationID - expected: "
|
||||||
@ -1278,12 +1278,13 @@ public void verifyRequest(NodeRegistration nodeReg) throws IOException {
|
|||||||
* @param version
|
* @param version
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void verifyVersion(int version) throws IOException {
|
void verifyVersion(int version) throws IOException {
|
||||||
if (version != FSConstants.LAYOUT_VERSION)
|
if (version != FSConstants.LAYOUT_VERSION)
|
||||||
throw new IncorrectVersionException(version, "data node");
|
throw new IncorrectVersionException(version, "data node");
|
||||||
}
|
}
|
||||||
|
|
||||||
public FSImage getFSImage() {
|
/** get FSImage */
|
||||||
|
FSImage getFSImage() {
|
||||||
return namesystem.dir.fsImage;
|
return namesystem.dir.fsImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption;
|
import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption;
|
||||||
import org.apache.hadoop.hdfs.server.datanode.DataNode.BPOfferService;
|
import org.apache.hadoop.hdfs.server.datanode.DataNode.BPOfferService;
|
||||||
import org.apache.hadoop.hdfs.server.datanode.FSDataset.VolumeInfo;
|
import org.apache.hadoop.hdfs.server.datanode.FSDataset.VolumeInfo;
|
||||||
|
import org.apache.hadoop.hdfs.server.namenode.FSImageTestUtil;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -65,14 +66,14 @@ public void test2NNRegistration() throws IOException {
|
|||||||
assertNotNull("cannot create nn1", nn1);
|
assertNotNull("cannot create nn1", nn1);
|
||||||
assertNotNull("cannot create nn2", nn2);
|
assertNotNull("cannot create nn2", nn2);
|
||||||
|
|
||||||
String bpid1 = nn1.getFSImage().getBlockPoolID();
|
String bpid1 = FSImageTestUtil.getFSImage(nn1).getBlockPoolID();
|
||||||
String bpid2 = nn2.getFSImage().getBlockPoolID();
|
String bpid2 = FSImageTestUtil.getFSImage(nn2).getBlockPoolID();
|
||||||
String cid1 = nn1.getFSImage().getClusterID();
|
String cid1 = FSImageTestUtil.getFSImage(nn1).getClusterID();
|
||||||
String cid2 = nn2.getFSImage().getClusterID();
|
String cid2 = FSImageTestUtil.getFSImage(nn2).getClusterID();
|
||||||
int lv1 = nn1.getFSImage().getLayoutVersion();
|
int lv1 =FSImageTestUtil.getFSImage(nn1).getLayoutVersion();
|
||||||
int lv2 = nn2.getFSImage().getLayoutVersion();
|
int lv2 = FSImageTestUtil.getFSImage(nn2).getLayoutVersion();
|
||||||
int ns1 = nn1.getFSImage().getNamespaceID();
|
int ns1 = FSImageTestUtil.getFSImage(nn1).getNamespaceID();
|
||||||
int ns2 = nn2.getFSImage().getNamespaceID();
|
int ns2 = FSImageTestUtil.getFSImage(nn2).getNamespaceID();
|
||||||
assertNotSame("namespace ids should be different", ns1, ns2);
|
assertNotSame("namespace ids should be different", ns1, ns2);
|
||||||
LOG.info("nn1: lv=" + lv1 + ";cid=" + cid1 + ";bpid=" + bpid1 + ";uri="
|
LOG.info("nn1: lv=" + lv1 + ";cid=" + cid1 + ";bpid=" + bpid1 + ";uri="
|
||||||
+ nn1.getNameNodeAddress());
|
+ nn1.getNameNodeAddress());
|
||||||
@ -135,9 +136,9 @@ public void testFedSingleNN() throws IOException {
|
|||||||
NameNode nn1 = cluster.getNameNode();
|
NameNode nn1 = cluster.getNameNode();
|
||||||
assertNotNull("cannot create nn1", nn1);
|
assertNotNull("cannot create nn1", nn1);
|
||||||
|
|
||||||
String bpid1 = nn1.getFSImage().getBlockPoolID();
|
String bpid1 = FSImageTestUtil.getFSImage(nn1).getBlockPoolID();
|
||||||
String cid1 = nn1.getFSImage().getClusterID();
|
String cid1 = FSImageTestUtil.getFSImage(nn1).getClusterID();
|
||||||
int lv1 = nn1.getFSImage().getLayoutVersion();
|
int lv1 = FSImageTestUtil.getFSImage(nn1).getLayoutVersion();
|
||||||
LOG.info("nn1: lv=" + lv1 + ";cid=" + cid1 + ";bpid=" + bpid1 + ";uri="
|
LOG.info("nn1: lv=" + lv1 + ";cid=" + cid1 + ";bpid=" + bpid1 + ";uri="
|
||||||
+ nn1.getNameNodeAddress());
|
+ nn1.getNameNodeAddress());
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -411,4 +410,9 @@ public static void logStorageContents(Log LOG, NNStorage storage) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** get the fsImage*/
|
||||||
|
public static FSImage getFSImage(NameNode node) {
|
||||||
|
return node.getFSImage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,8 @@ private File initFsimage() throws IOException {
|
|||||||
|
|
||||||
// Determine location of fsimage file
|
// Determine location of fsimage file
|
||||||
orig = FSImageTestUtil.findLatestImageFile(
|
orig = FSImageTestUtil.findLatestImageFile(
|
||||||
cluster.getNameNode().getFSImage().getStorage().getStorageDir(0));
|
FSImageTestUtil.getFSImage(
|
||||||
|
cluster.getNameNode()).getStorage().getStorageDir(0));
|
||||||
if (orig == null) {
|
if (orig == null) {
|
||||||
fail("Didn't generate or can't find fsimage");
|
fail("Didn't generate or can't find fsimage");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user