Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add checksum check in ManagedDirectory #605

Merged
merged 12 commits into from
Sep 18, 2019

Conversation

trinity-1686a
Copy link
Contributor

.managed.json is not checksummed as it does not write itself through ManagedDirectory, but meta.json does (which but an little bit of binary at the end of an otherwise ascii file).

fix #400

@codecov
Copy link

codecov bot commented Jul 26, 2019

Codecov Report

Merging #605 into master will decrease coverage by 0.01%.
The diff coverage is 89.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #605      +/-   ##
==========================================
- Coverage   91.03%   91.01%   -0.02%     
==========================================
  Files         172      173       +1     
  Lines       17838    17990     +152     
==========================================
+ Hits        16239    16374     +135     
- Misses       1599     1616      +17
Impacted Files Coverage Δ
tests/failpoints/mod.rs 94.44% <ø> (-0.16%) ⬇️
src/core/index.rs 92.72% <0%> (-0.89%) ⬇️
src/directory/mmap_directory.rs 90.55% <100%> (+0.07%) ⬆️
src/directory/mod.rs 100% <100%> (ø)
src/store/writer.rs 92.59% <100%> (ø) ⬆️
src/directory/ram_directory.rs 88.88% <100%> (+0.31%) ⬆️
src/common/counting_writer.rs 100% <100%> (ø) ⬆️
src/common/composite_file.rs 94.65% <100%> (-0.05%) ⬇️
src/indexer/index_writer.rs 94.1% <100%> (+0.01%) ⬆️
src/directory/managed_directory.rs 88.05% <89.78%> (+0.93%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d74f71b...2aac957. Read the comment docs.

src/directory/mod.rs Outdated Show resolved Hide resolved
use BitOrder for integer to raw byte conversion
consider atomic write imply atomic read, which might not actually be true
use some indirection to have a boxable terminating writer
…ould

add dependancy to drop_bomb to help find where terminate() should be called
implement TerminatingWrite for wrapper writers
make tests pass
/!\ some tests seems to pass where they shouldn't
let index_version = footer[0];
match index_version {
0 => Footer::V0(V0::from_bytes(footer)),
_ => panic!("unsuported index_version"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return an error?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a TODO to add a "string version", so that the error message in a backward incompatibility scenario becomes more helpful?

}

#[derive(Debug, Copy, Clone)]
pub enum Footer {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are stuff we can force for all versions...

Should we use a

pub struct Footer {
  version_configuration: VersionConfiguration,  
  meta: String //< human readable with information,
}

and put the Version specific information in a separate enum.

If you want we can do that in a separate PR. In that case please add a TODO.

@fulmicoton
Copy link
Collaborator

@fdb-hiroshima I am very happy with all of the choice you made.

I added a couple of nitpicks. No need to address all of them but I think there could be more unit tests especially for serialization/deserialization.

Could you also add your contribution in the CHANGELOG?

let tantivy_patch = LittleEndian::read_u32(&footer[size - 8..]);
Ok(Footer {
tantivy_version: (tantivy_major, tantivy_minor, tantivy_patch),
meta: String::from_utf8_lossy(&footer[size - meta_len - 20..size - 20]).into_owned(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well thought!

@fulmicoton fulmicoton merged commit d8894f0 into quickwit-oss:master Sep 18, 2019
@trinity-1686a trinity-1686a deleted the checksum branch September 18, 2019 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a checksum to all data files.
2 participants