Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Remove log in chunk generator
Browse files Browse the repository at this point in the history
  • Loading branch information
ManyTheFish committed Sep 2, 2021
1 parent 7f7fafb commit 741a444
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
18 changes: 1 addition & 17 deletions milli/src/update/index_documents/helpers/grenad_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ impl GrenadParameters {
pub fn grenad_obkv_into_chunks<R: io::Read>(
mut reader: grenad::Reader<R>,
indexer: GrenadParameters,
log_frequency: Option<usize>,
documents_chunk_size: usize,
) -> Result<impl Iterator<Item = Result<grenad::Reader<File>>>> {
let mut document_count = 0;
let mut continue_reading = true;

let indexer_clone = indexer.clone();
Expand All @@ -154,11 +152,6 @@ pub fn grenad_obkv_into_chunks<R: io::Read>(
obkv_documents.insert(document_id, obkv)?;
current_chunk_size += document_id.len() as u64 + obkv.len() as u64;

document_count += 1;
if log_frequency.map_or(false, |log_frequency| document_count % log_frequency == 0) {
debug!("reached {} chunked documents", document_count);
}

if current_chunk_size >= documents_chunk_size as u64 {
return writer_into_reader(obkv_documents).map(Some);
}
Expand All @@ -168,16 +161,7 @@ pub fn grenad_obkv_into_chunks<R: io::Read>(
writer_into_reader(obkv_documents).map(Some)
};

Ok(std::iter::from_fn(move || {
let result = transposer().transpose();
if result.as_ref().map_or(false, |r| r.is_ok()) {
debug!(
"A new chunk of approximately {:.2} MiB has been generated",
documents_chunk_size as f64 / 1024.0 / 1024.0,
);
}
result
}))
Ok(std::iter::from_fn(move || transposer().transpose()))
}

pub fn write_into_lmdb_database(
Expand Down
1 change: 0 additions & 1 deletion milli/src/update/index_documents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> {
let chunk_iter = grenad_obkv_into_chunks(
documents_file,
params.clone(),
self.log_every_n,
self.documents_chunk_size.unwrap_or(1024 * 1024 * 128), // 128MiB
);

Expand Down
2 changes: 1 addition & 1 deletion milli/tests/search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use big_s::S;
use either::{Either, Left, Right};
use heed::EnvOpenOptions;
use maplit::{hashmap, hashset};
use milli::update::{IndexDocuments, Settings, UpdateBuilder, UpdateFormat};
use milli::update::{Settings, UpdateBuilder, UpdateFormat};
use milli::{AscDesc, Criterion, DocumentId, Index};
use serde::Deserialize;
use slice_group_by::GroupBy;
Expand Down

0 comments on commit 741a444

Please sign in to comment.