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)
{
logger.warn("crc mismatch for archive {}/{}", index.getId(), this.getArchiveId());
this.setCrc(res.crc);
}
if (this.getWhirlpool() != null && !Arrays.equals(this.getWhirlpool(), res.whirlpool))
{
logger.warn("whirlpool mismatch for archive {}", this.getArchiveId());
this.setWhirlpool(res.whirlpool);
}
if (res.revision != -1 && this.getRevision() != res.revision)
@@ -162,6 +164,11 @@ public class Archive
logger.warn("revision mismatch for archive {}/{}, expected {} was {}",
index.getId(), this.getArchiveId(),
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);