Repository navigation
fix(engine): answer text exists without hydrating the corpus - #2130
Merged
Merged
Conversation
Finalize-verify issues size:0 terms aggregations filtered by exists on a semantic_text field. Those fields are stored as text with doc_values false, so the fast-agg path had no column, refused the request, and search_inner cloned every stored document into the brute aggregation corpus — including a window whose terms filter matched nothing. A presence bitmap (kind byte 2) is now written into the existing .dv sidecar for every doc_values:false field, including fields that are absent on every row. exists and missing use that bitmap when its doc_count matches the segment. A terms filter with no ordinals becomes SegPred::Never and the fused pass returns before any row walk. Term, range, sort, and value_count still treat a presence column as "no value column" and keep the source scan, so a keyword with doc_values false is not counted from a bitmap. Segments written before this change have no presence column and still scan. An unknown future kind byte is skipped so one new column does not drop its siblings. An older binary that cannot skip unknown kinds fails the whole sidecar on kind 2. A node that panics, fails an allocation (jemalloc returns null), or dies on SIGABRT, SIGSEGV, SIGBUS, or SIGILL writes a FATAL line to stderr and, once the data directory exists, appends the same line to crash.log. SIGKILL still cannot be reported. The memory ceiling that produces the abort is unchanged. The index-phase RSS slope reported with the ~240 KB/record headline was not measured in this change and is not fixed. The verify spike this removes is the stored-document hydrate, which is a different slope from ingest. Written by an AI coding agent (Cursor Grok 4.7). Evidence (rustc 1.97.1, debug, engine/): - cargo fmt -p xerj-storage -p xerj-engine -p xerj-server -- --check - cargo clippy -p those three --all-targets -- -D warnings (exit 0) - cargo test -p xerj-storage --lib: 228 passed - cargo test -p xerj-engine --lib: 790 passed - cargo test -p xerj-server --bin xerj: 105 passed - cargo test -p xerj-engine --test text_exists_does_not_hydrate: 1 passed in 2.78s. 10_000 docs; corpus_docs_hydrated delta 0; stored_sections_cached unchanged; bucket totals match the brute path - cargo test -p xerj-engine --test count_matches_search_on_text_term: 5 passed Refs #1940 #1122 #1267
added 3 commits
October 21, 2026 20:45
build_doc_value_columns walks only top-level _source keys. A text field mapped under an object (user.bio) was pre-seeded with an empty presence column that nothing ever filled, so exists on user.bio answered no rows from the bitmap. Dotted names now get no column and keep the source scan.
…c hook The fatal-signal handler took SIGSEGV/SIGBUS over the Rust runtime's guard-page handler without SA_ONSTACK, so a stack overflow could no longer run any handler (and lost "has overflowed its stack"). It now runs on the alternate stack, puts back the previous disposition and returns, so the fault reaches the runtime handler with its real siginfo. The panic hook replaced the default one (thread name, backtrace) and printed FATAL for panics a task may catch. It now chains to the previous hook and writes a "panicked" line to crash.log.
6 of 8 tasks
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Xerj Merger.
|
Owner
Author
|
Xerj Merger made the fix: two corrections.
On-disk compatibility, checked:
Local CI passed on main + #2129 + #2130 + #2131 + #2132: fmt, clippy |
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written by an AI coding agent (Cursor Grok 4.7), run by @xerj-org, who has reviewed this change.
Relates to #1940, #1122, and #1267. Field reports that describe the same symptoms: #2012, #2117, #2028, #1761. None of those issues are fully resolved here, so this description does not use Fixes.
What this changes, and why
Finalize-verify asks
size:0terms aggregations filtered byexistson asemantic_textfield. That field is stored as text withdoc_values: false, so the fast-agg path had no column, refused the request, andsearch_innercloned every stored document into the brute aggregation corpus. A terms window that matched nothing still paid that cost. That is the verify/finalize part of #1940 and the whole-index scan in #1267's text/semantic_textlane.A presence bitmap (kind byte 2) is now written into the existing
.dvsidecar for everydoc_values: falsefield, including a field that is absent on every row.existsandmissinguse that bitmap when itsdoc_countmatches the segment. A terms filter with no ordinals becomesSegPred::Neverand the fused pass returns before any row walk. Term, range, sort, andvalue_countstill treat a presence column as "no value column" and keep the source scan, so a keyword withdoc_values: falseis not counted from a bitmap. The scoredsize > 0existsfilter uses the same bitmap and does not decode stored sections when the column covers the segment.Segments written before this change have no presence column and still scan. An unknown future kind byte is skipped so one new column does not drop its siblings. An older binary that cannot skip unknown kinds fails the whole sidecar on kind 2.
A node that panics, fails an allocation (jemalloc returns null), or dies on SIGABRT, SIGSEGV, SIGBUS, or SIGILL writes a
FATALline to stderr and, once the data directory exists, appends the same line to{data_dir}/crash.log. This is the loud report asked for by #1122. SIGKILL still cannot be reported, and the memory ceiling that produces the abort is unchanged. The earlier spawn gate is what stops thethread::spawnpanic; this change only makes the death visible.The index-phase RSS slope behind the ~240 KB/record headline in #1940 was not measured here and is not fixed. The verify spike this removes is the stored-document hydrate, which is a different slope from ingest. A plausible ingest contributor is the
semantic_textcompanion vector plus the FTS and HNSW structures built with each record; that is a reading of the code, not a measurement.Evidence
No RSS number was measured. The bound in the new test is the hydration counter and the stored-section cache, which stay flat across those four queries on 10_000 documents.
Checks
cargo fmtcheck on the three crates touched (xerj-storage,xerj-engine,xerj-server). Notcargo fmt --all.cargo test -plib/bin for the three crates, plus the new integration test andcount_matches_search_on_text_term. The fullxerj-engineintegration suite was not run.FAST_AGG_MIN_DOCS(10_000) and never enter this path, so a green YAML run would not exercise the presence column.crash.logand theFATALline are new operator-visible output;llms.txtwas left alone.docs/CONTRIBUTION_REVIEW.md: the presence column is a new kind inside the existing.dvsidecar. Old segments without it fall back to the source scan. A future unknown kind is skipped. Downgrade (new sidecar, old binary) fails the whole sidecar, because the old decoder has no skip. Counters are process-global; the integration test is its own binary and asserts deltas.Not run: workspace-wide
cargo fmt --all, scoped release builds, the ES-YAML gate, a new YAML case, docs, the fullxerj-engineintegration suite, and any RSS measurement of ingest or verify.Provenance
corpus_docs_hydrateddelta 0, an unchangedstored_sections_cached, and bucket totals equal to the brute reference.autoindexthat is flat per record after this patch. Not measured.missingon text matches the brutevalue_presentcomplement wheneverdoc_countmatches the segment. The new test checksexists, not amissingaggregation. Falsified by amissingagg whose doc_count disagrees with a source scan on the same segment.existscount is delete-blind and the dirty path row-scans. Falsified by a deleted-doc window whose total disagrees with search.open_crash_log(data dir not created yet), still produce nocrash.logline. The signal and alloc formatters are unit-tested; no process was actually aborted.