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

Bytes fastfield codec mismatch #1278

Closed
PSeitz opened this issue Feb 18, 2022 · 0 comments · Fixed by #1279
Closed

Bytes fastfield codec mismatch #1278

PSeitz opened this issue Feb 18, 2022 · 0 comments · Fixed by #1279

Comments

@PSeitz
Copy link
Contributor

PSeitz commented Feb 18, 2022

Bytes fast field consists of two indices, the raw bytes data and a fast field index to find the bytes for a doc.

When writing a bytes fast field for the first time, the index is always written with the bitpack codec

let mut doc_index_serializer =
serializer.new_u64_fast_field_with_idx(self.field, 0, self.vals.len() as u64, 0)?;

When merging indices there is generic code used, which has an auto-detection for the best codec

fn write_1_n_fast_field_idx_generic<T: MultiValueLength>(
field: Field,
fast_field_serializer: &mut CompositeFastFieldSerializer,
doc_id_mapping: &SegmentDocIdMapping,
reader_and_field_accessors: &[(&SegmentReader, T)],

The index part of the bytes field is always read as Bitpacked serialized index, which can lead to following error after a merge:

thread 'merge_thread0' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`: Tried to open fast field as bitpacked encoded (id=1), but got serializer with different id', C:\Users\ChillFish8\.cargo\git\checkouts\tantivy-f70b7ea03dadae9a\13a4473\src\fastfield\reader.rs:160:9
PSeitz added a commit that referenced this issue Feb 18, 2022
fulmicoton pushed a commit that referenced this issue Feb 18, 2022
* Fix opening bytes index with dynamic codec

Fix #1278

* extend proptest to cover bytes field codec bug
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 a pull request may close this issue.

1 participant