Code review comment: I think this is not compatible with the old image.

Code before review:
public static void write(File imageFile, Catalog catalog) throws IOException {
LOG.info("start save image to {}. is ckpt: {}", imageFile.getAbsolutePath(), Catalog.isCheckpointThread());
long checksum = 0;
long saveImageStartTime = System.currentTimeMillis();
long startPosition = MetaHeader.write(imageFile);
List<MetaIndex> metaIndices = Lists.newArrayList();
try (CountingDataOutputStream dos = new CountingDataOutputStream(new BufferedOutputStream(
new FileOutputStream(imageFile, true)), startPosition)) {
long replayedJournalId = catalog.getReplayedJournalId();
metaIndices.add(new MetaIndex("header", dos.getCount()));
checksum = catalog.saveHeader(dos, replayedJournalId, checksum);
metaIndices.add(new MetaIndex("masterInfo", dos.getCount()));
checksum = catalog.saveMasterInfo(dos, checksum);
metaIndices.add(new MetaIndex("frontends", dos.getCount()));
checksum = catalog.saveFrontends(dos, checksum);
metaIndices.add(new MetaIndex("backends", dos.getCount()));
checksum = Catalog.getCurrentSystemInfo().saveBackends(dos, checksum);
metaIndices.add(new MetaIndex("db", dos.getCount()));
checksum = catalog.saveDb(dos, checksum);
metaIndices.add(new MetaIndex("loadJob", dos.getCount()));
checksum = catalog.saveLoadJob(dos, checksum);
metaIndices.add(new MetaIndex("alterJob", dos.getCount()));
checksum = catalog.saveAlterJob(dos, checksum);
metaIndices.add(new MetaIndex("recycleBin", dos.getCount()));
checksum = catalog.saveRecycleBin(dos, checksum);
metaIndices.add(new MetaIndex("globalVariable", dos.getCount()));
checksum = catalog.saveGlobalVariable(dos, checksum);
metaIndices.add(new MetaIndex("cluster", dos.getCount()));
checksum = catalog.saveCluster(dos, checksum);
metaIndices.add(new MetaIndex("broker", dos.getCount()));
checksum = catalog.saveBrokers(dos, checksum);
metaIndices.add(new MetaIndex("resources", dos.getCount()));
checksum = catalog.saveResources(dos, checksum);
metaIndices.add(new MetaIndex("exportJob", dos.getCount()));
checksum = catalog.saveExportJob(dos, checksum);
metaIndices.add(new MetaIndex("backupHandler", dos.getCount()));
checksum = catalog.saveBackupHandler(dos, checksum);
metaIndices.add(new MetaIndex("paloAuth", dos.getCount()));
checksum = catalog.savePaloAuth(dos, checksum);
metaIndices.add(new MetaIndex("transactionState", dos.getCount()));
checksum = catalog.saveTransactionState(dos, checksum);
metaIndices.add(new MetaIndex("colocateTableIndex", dos.getCount()));
checksum = catalog.saveColocateTableIndex(dos, checksum);
metaIndices.add(new MetaIndex("routineLoadJobs", dos.getCount()));
checksum = catalog.saveRoutineLoadJobs(dos, checksum);
metaIndices.add(new MetaIndex("loadJobV2", dos.getCount()));
checksum = catalog.saveLoadJobsV2(dos, checksum);
metaIndices.add(new MetaIndex("smallFiles", dos.getCount()));
checksum = catalog.saveSmallFiles(dos, checksum);
metaIndices.add(new MetaIndex("plugins", dos.getCount()));
checksum = catalog.savePlugins(dos, checksum);
metaIndices.add(new MetaIndex("deleteHandler", dos.getCount()));
checksum = catalog.saveDeleteHandler(dos, checksum);
dos.writeLong(checksum);
}
MetaFooter.write(imageFile, metaIndices);
long saveImageEndTime = System.currentTimeMillis();
LOG.info("finished save image {} in {} ms. checksum is {}",
imageFile.getAbsolutePath(), (saveImageEndTime - saveImageStartTime), checksum);
}

Line under review: dos.writeLong(checksum);

Code after addressing the review:
public static void write(File imageFile, Catalog catalog) throws IOException {
LOG.info("start save image to {}. is ckpt: {}", imageFile.getAbsolutePath(), Catalog.isCheckpointThread());
long checksum = 0;
long saveImageStartTime = System.currentTimeMillis();
long startPosition = MetaHeader.write(imageFile);
List<MetaIndex> metaIndices = Lists.newArrayList();
try (CountingDataOutputStream dos = new CountingDataOutputStream(new BufferedOutputStream(
new FileOutputStream(imageFile, true)), startPosition)) {
long replayedJournalId = catalog.getReplayedJournalId();
metaIndices.add(new MetaIndex("header", dos.getCount()));
checksum = catalog.saveHeader(dos, replayedJournalId, checksum);
metaIndices.add(new MetaIndex("masterInfo", dos.getCount()));
checksum = catalog.saveMasterInfo(dos, checksum);
metaIndices.add(new MetaIndex("frontends", dos.getCount()));
checksum = catalog.saveFrontends(dos, checksum);
metaIndices.add(new MetaIndex("backends", dos.getCount()));
checksum = Catalog.getCurrentSystemInfo().saveBackends(dos, checksum);
metaIndices.add(new MetaIndex("db", dos.getCount()));
checksum = catalog.saveDb(dos, checksum);
metaIndices.add(new MetaIndex("loadJob", dos.getCount()));
checksum = catalog.saveLoadJob(dos, checksum);
metaIndices.add(new MetaIndex("alterJob", dos.getCount()));
checksum = catalog.saveAlterJob(dos, checksum);
metaIndices.add(new MetaIndex("recycleBin", dos.getCount()));
checksum = catalog.saveRecycleBin(dos, checksum);
metaIndices.add(new MetaIndex("globalVariable", dos.getCount()));
checksum = catalog.saveGlobalVariable(dos, checksum);
metaIndices.add(new MetaIndex("cluster", dos.getCount()));
checksum = catalog.saveCluster(dos, checksum);
metaIndices.add(new MetaIndex("broker", dos.getCount()));
checksum = catalog.saveBrokers(dos, checksum);
metaIndices.add(new MetaIndex("resources", dos.getCount()));
checksum = catalog.saveResources(dos, checksum);
metaIndices.add(new MetaIndex("exportJob", dos.getCount()));
checksum = catalog.saveExportJob(dos, checksum);
metaIndices.add(new MetaIndex("backupHandler", dos.getCount()));
checksum = catalog.saveBackupHandler(dos, checksum);
metaIndices.add(new MetaIndex("paloAuth", dos.getCount()));
checksum = catalog.savePaloAuth(dos, checksum);
metaIndices.add(new MetaIndex("transactionState", dos.getCount()));
checksum = catalog.saveTransactionState(dos, checksum);
metaIndices.add(new MetaIndex("colocateTableIndex", dos.getCount()));
checksum = catalog.saveColocateTableIndex(dos, checksum);
metaIndices.add(new MetaIndex("routineLoadJobs", dos.getCount()));
checksum = catalog.saveRoutineLoadJobs(dos, checksum);
metaIndices.add(new MetaIndex("loadJobV2", dos.getCount()));
checksum = catalog.saveLoadJobsV2(dos, checksum);
metaIndices.add(new MetaIndex("smallFiles", dos.getCount()));
checksum = catalog.saveSmallFiles(dos, checksum);
metaIndices.add(new MetaIndex("plugins", dos.getCount()));
checksum = catalog.savePlugins(dos, checksum);
metaIndices.add(new MetaIndex("deleteHandler", dos.getCount()));
checksum = catalog.saveDeleteHandler(dos, checksum);
}
MetaFooter.write(imageFile, metaIndices, checksum);
long saveImageEndTime = System.currentTimeMillis();
LOG.info("finished save image {} in {} ms. checksum is {}",
imageFile.getAbsolutePath(), (saveImageEndTime - saveImageStartTime), checksum);
}