HDFS-14396. Failed to load image from FSImageFile when downgrade from 3.x to 2.x. Contributed by Fei Hui.
(cherry picked from commit bd7baea5a5
)
This commit is contained in:
parent
d3e5898712
commit
e8b93d04c4
|
@ -568,6 +568,8 @@ public final class FSImageFormatProtobuf {
|
||||||
FSImageCompression compression, String filePath) throws IOException {
|
FSImageCompression compression, String filePath) throws IOException {
|
||||||
StartupProgress prog = NameNode.getStartupProgress();
|
StartupProgress prog = NameNode.getStartupProgress();
|
||||||
MessageDigest digester = MD5Hash.getDigester();
|
MessageDigest digester = MD5Hash.getDigester();
|
||||||
|
int layoutVersion =
|
||||||
|
context.getSourceNamesystem().getEffectiveLayoutVersion();
|
||||||
|
|
||||||
underlyingOutputStream = new DigestOutputStream(new BufferedOutputStream(
|
underlyingOutputStream = new DigestOutputStream(new BufferedOutputStream(
|
||||||
fout), digester);
|
fout), digester);
|
||||||
|
@ -594,11 +596,16 @@ public final class FSImageFormatProtobuf {
|
||||||
// depends on this behavior.
|
// depends on this behavior.
|
||||||
context.checkCancelled();
|
context.checkCancelled();
|
||||||
|
|
||||||
|
Step step;
|
||||||
|
|
||||||
// Erasure coding policies should be saved before inodes
|
// Erasure coding policies should be saved before inodes
|
||||||
Step step = new Step(StepType.ERASURE_CODING_POLICIES, filePath);
|
if (NameNodeLayoutVersion.supports(
|
||||||
prog.beginStep(Phase.SAVING_CHECKPOINT, step);
|
NameNodeLayoutVersion.Feature.ERASURE_CODING, layoutVersion)) {
|
||||||
saveErasureCodingSection(b);
|
step = new Step(StepType.ERASURE_CODING_POLICIES, filePath);
|
||||||
prog.endStep(Phase.SAVING_CHECKPOINT, step);
|
prog.beginStep(Phase.SAVING_CHECKPOINT, step);
|
||||||
|
saveErasureCodingSection(b);
|
||||||
|
prog.endStep(Phase.SAVING_CHECKPOINT, step);
|
||||||
|
}
|
||||||
|
|
||||||
step = new Step(StepType.INODES, filePath);
|
step = new Step(StepType.INODES, filePath);
|
||||||
prog.beginStep(Phase.SAVING_CHECKPOINT, step);
|
prog.beginStep(Phase.SAVING_CHECKPOINT, step);
|
||||||
|
|
Loading…
Reference in New Issue