cache: overwrite archive crc/revision with stored version on mismatch

This commit is contained in:
Adam
2017-09-03 19:46:42 -04:00
parent 69b85e41b2
commit bee7bcec37

View File

@@ -149,11 +149,13 @@ public class Archive
if (this.crc != res.crc) if (this.crc != res.crc)
{ {
logger.warn("crc mismatch for archive {}/{}", index.getId(), this.getArchiveId()); logger.warn("crc mismatch for archive {}/{}", index.getId(), this.getArchiveId());
this.setCrc(res.crc);
} }
if (this.getWhirlpool() != null && !Arrays.equals(this.getWhirlpool(), res.whirlpool)) if (this.getWhirlpool() != null && !Arrays.equals(this.getWhirlpool(), res.whirlpool))
{ {
logger.warn("whirlpool mismatch for archive {}", this.getArchiveId()); logger.warn("whirlpool mismatch for archive {}", this.getArchiveId());
this.setWhirlpool(res.whirlpool);
} }
if (res.revision != -1 && this.getRevision() != res.revision) if (res.revision != -1 && this.getRevision() != res.revision)
@@ -162,6 +164,11 @@ public class Archive
logger.warn("revision mismatch for archive {}/{}, expected {} was {}", logger.warn("revision mismatch for archive {}/{}, expected {} was {}",
index.getId(), this.getArchiveId(), index.getId(), this.getArchiveId(),
this.getRevision(), res.revision); this.getRevision(), res.revision);
// I've seen this happen with vanilla caches where the
// revision in the index data differs from the revision
// stored for the archive data on disk... I assume this
// is more correct
this.setRevision(res.revision);
} }
setCompression(res.compression); setCompression(res.compression);