|
@@ -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(
|