From 481b0bf277f8a77eda23fde224d428fe885130f0 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 22 Jun 2021 10:57:46 +0200 Subject: [PATCH 1/2] Warn for when a facet key is too large for LMDB --- milli/src/update/index_documents/store.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/milli/src/update/index_documents/store.rs b/milli/src/update/index_documents/store.rs index 7318c5bd0..f6f1756dd 100644 --- a/milli/src/update/index_documents/store.rs +++ b/milli/src/update/index_documents/store.rs @@ -11,7 +11,7 @@ use fst::Set; use grenad::{CompressionType, FileFuse, Reader, Sorter, Writer}; use heed::BytesEncode; use linked_hash_map::LinkedHashMap; -use log::{debug, info}; +use log::{debug, info, warn}; use meilisearch_tokenizer::token::SeparatorKind; use meilisearch_tokenizer::{Analyzer, AnalyzerConfig, Token, TokenKind}; use ordered_float::OrderedFloat; @@ -517,6 +517,8 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> { if lmdb_key_valid_size(&key_buffer) { sorter.insert(&key_buffer, &data_buffer)?; + } else { + warn!("facet value {:?} is too large to be saved", value); } } @@ -582,6 +584,8 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> { if lmdb_key_valid_size(&buffer) { sorter.insert(&buffer, &[])?; + } else { + warn!("facet value {:?} is too large to be saved", value); } Ok(()) From 51dbb2e06d5e2fba4a91b36d8f8ac64b877d0ad1 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Tue, 22 Jun 2021 11:51:36 +0200 Subject: [PATCH 2/2] Warn for when a key is too large for LMDB --- milli/src/update/index_documents/store.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/milli/src/update/index_documents/store.rs b/milli/src/update/index_documents/store.rs index f6f1756dd..766ed82b2 100644 --- a/milli/src/update/index_documents/store.rs +++ b/milli/src/update/index_documents/store.rs @@ -426,6 +426,11 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> { // that we write under the generated key into MTBL if lmdb_key_valid_size(&key) { sorter.insert(&key, &buffer)?; + } else { + warn!( + "words pairs proximity ({:?} - {:?}, {:?}) is too large to be saved", + w1, w2, min_prox + ); } } @@ -457,6 +462,8 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> { // that we write under the generated key into MTBL if lmdb_key_valid_size(&key) { writer.insert(&key, &buffer)?; + } else { + warn!("word {:?} is too large to be saved", word); } } @@ -493,6 +500,8 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> { // that we write under the generated key into MTBL if lmdb_key_valid_size(&key_buffer) { writer.insert(&key_buffer, &data_buffer)?; + } else { + warn!("word {:?} is too large to be saved", word); } } } @@ -610,6 +619,8 @@ impl<'s, A: AsRef<[u8]>> Store<'s, A> { // that we write under the generated key into MTBL if lmdb_key_valid_size(&key) { sorter.insert(&key, &buffer)?; + } else { + warn!("word {:?} is too large to be saved", word); } }