From 0069d5a75da6c1680519832e17f1b0db281437bb Mon Sep 17 00:00:00 2001 From: kimchy Date: Tue, 29 Mar 2011 21:27:18 +0200 Subject: [PATCH] add adler to checksum, faster and is good enough with length check for our use case --- .../elasticsearch/index/store/support/AbstractStore.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java index a516379bcc3..18aea9f5636 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java @@ -38,7 +38,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.util.zip.CRC32; +import java.util.zip.Adler32; import java.util.zip.Checksum; /** @@ -391,7 +391,10 @@ public abstract class AbstractStore extends AbstractIndexShardComponent implemen // and since we, in any case, always recover the segments files this.digest = null; } else { - this.digest = new CRC32(); +// this.digest = new CRC32(); + // adler is faster, and we compare on length as well, should be enough to check for difference + // between files + this.digest = new Adler32(); } } else { this.digest = null;