Reduce log noise for indexing limit warnings on online journal files (#21816)
Online files are re-indexed every ~1s, so cardinality/payload-size warnings are emitted at trace level instead of warn/info.
vkalintiris committed
Feb 25, 2026 at 16:11 UTC
192fab5ac9c4919c1980f3c99c491d59e1e8260e
1 file changed
+22
-6
src/crates/journal-index/src/file_indexer.rs
+22
-6
@@ -15,7 +15,7 @@ use journal_core::collections::{HashMap, HashSet};
15
use journal_core::file::{JournalFile, Mmap, offset_array::InlinedCursor};
16
use journal_registry::File;
17
use std::num::NonZeroU64;
18
-use tracing::{error, warn};
18
+use tracing::{error, trace, warn};
19
20
/// Default maximum number of unique values to index per field.
21
pub const DEFAULT_MAX_UNIQUE_VALUES_PER_FIELD: usize = 500;
@@ -203,8 +203,13 @@ impl FileIndexer {
203
.collect();
204
205
// Create the bitmaps for field=value pairs
206
- let entries =
207
- self.build_entries_index(&journal_file, &field_map, field_names, tail_object_offset)?;
206
+ let entries = self.build_entries_index(
207
+ &journal_file,
208
+ &field_map,
209
+ field_names,
210
+ tail_object_offset,
211
+ was_online,
212
+ )?;
213
214
// Convert field_names to HashSet<FieldName> for indexed_fields
215
let indexed_fields: HashSet<FieldName> = field_names.iter().cloned().collect();
@@ -243,6 +248,7 @@ impl FileIndexer {
248
field_map: &HashMap<String, String>,
249
field_names: &[FieldName],
250
tail_object_offset: NonZeroU64,
251
+ was_online: bool,
252
) -> Result<HashMap<FieldValuePair, Bitmap>> {
253
let mut entries_index = HashMap::default();
254
let mut truncated_fields: Vec<&FieldName> = Vec::new();
@@ -365,28 +371,38 @@ impl FileIndexer {
371
}
372
}
373
368
- // Log summary of indexing issues
374
+ // Log summary of indexing issues.
375
if !truncated_fields.is_empty() {
376
let field_names: Vec<&str> = truncated_fields.iter().map(|f| f.as_str()).collect();
371
- warn!(
377
+ let msg = format!(
378
"File '{}': {} field(s) truncated due to cardinality limit ({}): {:?}",
379
journal_file.file().path(),
380
truncated_fields.len(),
381
self.limits.max_unique_values_per_field,
382
field_names
383
);
384
+ if was_online {
385
+ trace!("{msg}");
386
+ } else {
387
+ warn!("{msg}");
388
+ }
389
}
390
if !fields_with_large_payloads.is_empty() {
391
let field_names: Vec<&str> = fields_with_large_payloads
392
.iter()
393
.map(|f| f.as_str())
394
.collect();
384
- tracing::info!(
395
+ let msg = format!(
396
"File '{}': {} field(s) had values skipped due to large payloads: {:?}",
397
journal_file.file().path(),
398
fields_with_large_payloads.len(),
399
field_names
400
);
401
+ if was_online {
402
+ trace!("{msg}");
403
+ } else {
404
+ tracing::info!("{msg}");
405
+ }
406
}
407
408
Ok(entries_index)