add adler to checksum, faster and is good enough with length check for our use case

This commit is contained in:
kimchy 2011-03-29 21:27:18 +02:00
parent a1be2bbf20
commit 0069d5a75d
1 changed files with 5 additions and 2 deletions

View File

@ -38,7 +38,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.zip.CRC32; import java.util.zip.Adler32;
import java.util.zip.Checksum; 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 // and since we, in any case, always recover the segments files
this.digest = null; this.digest = null;
} else { } 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 { } else {
this.digest = null; this.digest = null;