HDFS-15826. Solve the problem of incorrect progress of delegation tokens when loading FsImage. (#2686)
Co-authored-by: zhujianghua <zhujianghua@zhujianghuadeMacBook-Pro.local> (cherry picked from commit98ffd65d8b
) (cherry picked from commitee0e32abdc
)
This commit is contained in:
parent
5abf19a773
commit
efb796f45f
|
@ -191,7 +191,7 @@ public class DelegationTokenSecretManager
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void loadSecretManagerState(SecretManagerState state)
|
||||
public synchronized void loadSecretManagerState(SecretManagerState state, Counter counter)
|
||||
throws IOException {
|
||||
Preconditions.checkState(!running,
|
||||
"Can't load state from image in a running SecretManager.");
|
||||
|
@ -211,6 +211,7 @@ public class DelegationTokenSecretManager
|
|||
id.setSequenceNumber(t.getSequenceNumber());
|
||||
id.setMasterKeyId(t.getMasterKeyId());
|
||||
addPersistedDelegationToken(id, t.getExpiryDate());
|
||||
counter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -408,10 +408,9 @@ public final class FSImageFormatProtobuf {
|
|||
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);
|
||||
fsn.loadSecretManagerState(s, keys, tokens, counter);
|
||||
}
|
||||
|
||||
private void loadCacheManagerSection(InputStream in, StartupProgress prog,
|
||||
|
|
|
@ -5853,8 +5853,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
|
||||
void loadSecretManagerState(SecretManagerSection s,
|
||||
List<SecretManagerSection.DelegationKey> keys,
|
||||
List<SecretManagerSection.PersistToken> tokens) throws IOException {
|
||||
dtSecretManager.loadSecretManagerState(new SecretManagerState(s, keys, tokens));
|
||||
List<SecretManagerSection.PersistToken> tokens,
|
||||
StartupProgress.Counter counter) throws IOException {
|
||||
dtSecretManager.loadSecretManagerState(new SecretManagerState(s, keys, tokens),
|
||||
counter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue