HDFS-8470. fsimage loading progress should update inode, delegation token and cache pool count. (Contributed by surendra singh lilhore)
(cherry picked from commit e965dcec37
)
This commit is contained in:
parent
066e45bcb6
commit
4bb725b4dd
|
@ -503,6 +503,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HDFS-8256. "-storagepolicies , -blockId ,-replicaDetails " options are missed
|
||||
out in usage and from documentation (J.Andreina via vinayakumarb)
|
||||
|
||||
HDFS-8470. fsimage loading progress should update inode, delegation token and
|
||||
cache pool count. (surendra singh lilhore via vinayakumarb)
|
||||
|
||||
Release 2.7.1 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -58,6 +58,10 @@ import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.XAttrFea
|
|||
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.QuotaByStorageTypeEntryProto;
|
||||
import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.QuotaByStorageTypeFeatureProto;
|
||||
import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress.Counter;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.Step;
|
||||
import org.apache.hadoop.hdfs.util.EnumCounters;
|
||||
import org.apache.hadoop.hdfs.util.ReadOnlyList;
|
||||
|
||||
|
@ -250,11 +254,15 @@ public final class FSImageFormatPBINode {
|
|||
}
|
||||
}
|
||||
|
||||
void loadINodeSection(InputStream in) throws IOException {
|
||||
void loadINodeSection(InputStream in, StartupProgress prog,
|
||||
Step currentStep) throws IOException {
|
||||
INodeSection s = INodeSection.parseDelimitedFrom(in);
|
||||
fsn.dir.resetLastInodeId(s.getLastInodeId());
|
||||
LOG.info("Loading " + s.getNumInodes() + " INodes.");
|
||||
for (int i = 0; i < s.getNumInodes(); ++i) {
|
||||
long numInodes = s.getNumInodes();
|
||||
LOG.info("Loading " + numInodes + " INodes.");
|
||||
prog.setTotal(Phase.LOADING_FSIMAGE, currentStep, numInodes);
|
||||
Counter counter = prog.getCounter(Phase.LOADING_FSIMAGE, currentStep);
|
||||
for (int i = 0; i < numInodes; ++i) {
|
||||
INodeSection.INode p = INodeSection.INode.parseDelimitedFrom(in);
|
||||
if (p.getId() == INodeId.ROOT_INODE_ID) {
|
||||
loadRootINode(p);
|
||||
|
@ -262,6 +270,7 @@ public final class FSImageFormatPBINode {
|
|||
INode n = loadINode(p);
|
||||
dir.addToInodeMap(n);
|
||||
}
|
||||
counter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.hadoop.hdfs.server.namenode.FsImageProto.StringTableSection;
|
|||
import org.apache.hadoop.hdfs.server.namenode.snapshot.FSImageFormatPBSnapshot;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress.Counter;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.Step;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StepType;
|
||||
import org.apache.hadoop.hdfs.util.MD5FileUtils;
|
||||
|
@ -250,7 +251,7 @@ public final class FSImageFormatProtobuf {
|
|||
case INODE: {
|
||||
currentStep = new Step(StepType.INODES);
|
||||
prog.beginStep(Phase.LOADING_FSIMAGE, currentStep);
|
||||
inodeLoader.loadINodeSection(in);
|
||||
inodeLoader.loadINodeSection(in, prog, currentStep);
|
||||
}
|
||||
break;
|
||||
case INODE_REFERENCE:
|
||||
|
@ -272,14 +273,14 @@ public final class FSImageFormatProtobuf {
|
|||
prog.endStep(Phase.LOADING_FSIMAGE, currentStep);
|
||||
Step step = new Step(StepType.DELEGATION_TOKENS);
|
||||
prog.beginStep(Phase.LOADING_FSIMAGE, step);
|
||||
loadSecretManagerSection(in);
|
||||
loadSecretManagerSection(in, prog, step);
|
||||
prog.endStep(Phase.LOADING_FSIMAGE, step);
|
||||
}
|
||||
break;
|
||||
case CACHE_MANAGER: {
|
||||
Step step = new Step(StepType.CACHE_POOLS);
|
||||
prog.beginStep(Phase.LOADING_FSIMAGE, step);
|
||||
loadCacheManagerSection(in);
|
||||
loadCacheManagerSection(in, prog, step);
|
||||
prog.endStep(Phase.LOADING_FSIMAGE, step);
|
||||
}
|
||||
break;
|
||||
|
@ -316,7 +317,8 @@ public final class FSImageFormatProtobuf {
|
|||
}
|
||||
}
|
||||
|
||||
private void loadSecretManagerSection(InputStream in) throws IOException {
|
||||
private void loadSecretManagerSection(InputStream in, StartupProgress prog,
|
||||
Step currentStep) throws IOException {
|
||||
SecretManagerSection s = SecretManagerSection.parseDelimitedFrom(in);
|
||||
int numKeys = s.getNumKeys(), numTokens = s.getNumTokens();
|
||||
ArrayList<SecretManagerSection.DelegationKey> keys = Lists
|
||||
|
@ -327,20 +329,30 @@ public final class FSImageFormatProtobuf {
|
|||
for (int i = 0; i < numKeys; ++i)
|
||||
keys.add(SecretManagerSection.DelegationKey.parseDelimitedFrom(in));
|
||||
|
||||
for (int i = 0; i < numTokens; ++i)
|
||||
prog.setTotal(Phase.LOADING_FSIMAGE, currentStep, numTokens);
|
||||
Counter counter = prog.getCounter(Phase.LOADING_FSIMAGE, currentStep);
|
||||
for (int i = 0; i < numTokens; ++i) {
|
||||
tokens.add(SecretManagerSection.PersistToken.parseDelimitedFrom(in));
|
||||
counter.increment();
|
||||
}
|
||||
|
||||
fsn.loadSecretManagerState(s, keys, tokens);
|
||||
}
|
||||
|
||||
private void loadCacheManagerSection(InputStream in) throws IOException {
|
||||
private void loadCacheManagerSection(InputStream in, StartupProgress prog,
|
||||
Step currentStep) throws IOException {
|
||||
CacheManagerSection s = CacheManagerSection.parseDelimitedFrom(in);
|
||||
ArrayList<CachePoolInfoProto> pools = Lists.newArrayListWithCapacity(s
|
||||
.getNumPools());
|
||||
int numPools = s.getNumPools();
|
||||
ArrayList<CachePoolInfoProto> pools = Lists
|
||||
.newArrayListWithCapacity(numPools);
|
||||
ArrayList<CacheDirectiveInfoProto> directives = Lists
|
||||
.newArrayListWithCapacity(s.getNumDirectives());
|
||||
for (int i = 0; i < s.getNumPools(); ++i)
|
||||
prog.setTotal(Phase.LOADING_FSIMAGE, currentStep, numPools);
|
||||
Counter counter = prog.getCounter(Phase.LOADING_FSIMAGE, currentStep);
|
||||
for (int i = 0; i < numPools; ++i) {
|
||||
pools.add(CachePoolInfoProto.parseDelimitedFrom(in));
|
||||
counter.increment();
|
||||
}
|
||||
for (int i = 0; i < s.getNumDirectives(); ++i)
|
||||
directives.add(CacheDirectiveInfoProto.parseDelimitedFrom(in));
|
||||
fsn.getCacheManager().loadState(
|
||||
|
|
Loading…
Reference in New Issue