Calculate Alder32 Checksums for legacy files in Store#checkIntegrity #8407

Merged
merged 1 commit into from Nov 9, 2014

Projects

None yet

3 participants

@s1monw
Contributor
s1monw commented Nov 9, 2014

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

@rmuir rmuir commented on an outdated diff Nov 9, 2014
src/main/java/org/elasticsearch/index/store/Store.java
@@ -431,14 +432,39 @@ public static void verify(IndexInput input) throws IOException {
}
public boolean checkIntegrity(StoreFileMetaData md) {
- if (md.writtenBy() != null && md.writtenBy().onOrAfter(Version.LUCENE_4_8_0)) {
- try (IndexInput input = directory().openInput(md.name(), IOContext.READONCE)) {
- CodecUtil.checksumEntireFile(input);
- } catch (IOException e) {
- return false;
+ return checkIntegrity(md, directory());
+ }
+
+ public static boolean checkIntegrity(final StoreFileMetaData md, final Directory directory) {
+ try (IndexInput input = directory.openInput(md.name(), IOContext.READONCE)) {
+ if (md.writtenBy() != null && md.writtenBy().onOrAfter(Version.LUCENE_4_8_0)) {
+ if (input.length() != md.length()) {
@rmuir
rmuir Nov 9, 2014 Contributor

Can this be moved up above the if, so its always checked?

@s1monw
Contributor
s1monw commented Nov 9, 2014

@rmuir pushed an update

@rmuir
Contributor
rmuir commented Nov 9, 2014

+1

@s1monw s1monw [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIn…
…tegrity

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

Closes #8407
2eccbf5
@s1monw s1monw added a commit to s1monw/elasticsearch that referenced this pull request Nov 9, 2014
@s1monw s1monw [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIn…
…tegrity

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

Closes #8407
b2621c9
@s1monw s1monw added a commit to s1monw/elasticsearch that referenced this pull request Nov 9, 2014
@s1monw s1monw [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIn…
…tegrity

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

Closes #8407
5526d1c
@s1monw s1monw added a commit that referenced this pull request Nov 9, 2014
@s1monw s1monw [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIn…
…tegrity

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

Closes #8407
e8f988c
@s1monw s1monw merged commit 2eccbf5 into elastic:master Nov 9, 2014
@s1monw s1monw deleted the s1monw:integrity_check_legacy branch Nov 9, 2014
@clintongormley clintongormley changed the title from [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIntegrity to Store: Calculate Alder32 Checksums for legacy files in Store#checkIntegrity Nov 25, 2014
@clintongormley clintongormley added :Store and removed review labels Mar 19, 2015
@clintongormley clintongormley changed the title from Store: Calculate Alder32 Checksums for legacy files in Store#checkIntegrity to Calculate Alder32 Checksums for legacy files in Store#checkIntegrity Jun 8, 2015
@mute mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
@s1monw s1monw [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIn…
…tegrity

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

Closes #8407
fb0001f
@mute mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
@s1monw s1monw [STORE] Calculate Alder32 Checksums for legacy files in Store#checkIn…
…tegrity

Previously we didn't calculate this checksums even though we have a checksum
to compare. Since we now also verify checksums for legacy files #checkIntegrity
should also calculate the legacy checksums.

Closes #8407
4c5e2f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment