Doris-Breakwater commented on issue #70877: URL: https://github.com/apache/doris/issues/70877#issuecomment-7095985358
Breakwater-GitHub-Analysis-Slot: slot_efb345db5a1c The reported increase from sub-second latency to 124 seconds warrants investigating ANN coverage on the full-compaction output. I reviewed the source at the reported commit, `7126cf65d96`. The cause of the reported coverage loss is still open. Please clarify whether the count of 68 comes from the query profile or from inspecting the active segments’ index files. ### What the source confirms - **Full compaction can rebuild ANN.** It rewrites segments and takes its output schema from the highest-schema-version input rowset. When that schema declares the ANN index, both segment writers build it during finalization. The ANN writer deliberately omits segments below `max(FAISS training minimum, ann_index_build_min_segment_rows)`. For HNSW/SQ8 the training minimum is one row and the BE setting defaults to zero, so under defaults the size rule cannot explain an omitted index on a nonempty output segment. [Compaction schema selection](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/be/src/storage/compaction/compaction.cpp#L501-L529), [ANN writer](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/be/src/storage/index/ann/ann_index_writer.cpp#L135-L171), [FAISS training minimum](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/be/src/storage/index/ann/faiss_ann_index.cpp#L501-L525). - **The duplicate DDL and the short jobs need to be correlated.** A same-name `CREATE INDEX` or `ALTER TABLE … ADD INDEX` raises an already-exists error. With `IF NOT EXISTS`, it returns before creating any job. On the local light-index path, the initial `CREATE INDEX` adds the definition and an explicit `BUILD INDEX` can queue the backfill. That job is displayed as `ADD INDEX` in `SHOW BUILD INDEX`. Its BE task skips active rowsets that already declare the ANN index ID and can finish successfully with an empty candidate list. That check uses schema metadata and cannot certify that the segment index entries are present or readable. This is the limitation described in #69816. [Duplicate check](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java#L2826-L2836), [Job display](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/fe/fe-core/src/main/java/org/apach e/doris/alter/IndexChangeJob.java#L543-L571), [BE rowset selection](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/be/src/storage/tablet/tablet.cpp#L1283-L1311). - **The profile counter has several causes.** ANN Top-N increments the fallback counter when there is no ANN reader, when loading the index fails, or when the query takes a fallback branch such as the small-candidate check. If 68 is `AnnIndexFallbackBruteForceCnt`, it counts fallback events and cannot identify which segments lost physical coverage. [Top-N fallback logic](https://github.com/apache/doris/blob/7126cf65d96ebc43fce0906f51e92c1a2ccf24a6/be/src/storage/segment/segment_iterator.cpp#L877-L975). ### Evidence to collect before a repair attempt 1. Share one affected tablet and, if available, one unaffected tablet. For each, include the BE build SHA, full-compaction response and tablet-level task result, input/output rowset IDs and version ranges, and each active output segment’s row count, rowset schema version, ANN index ID, and whether its ANN file or compound-file entry can be opened. The table-level POST acknowledges submission, so the per-tablet result matters. Include the effective `ann_index_build_min_segment_rows` on those BEs and the compaction-window log lines containing `Create a new faiss index`, `Skipping index building`, or a build error. 2. Share paired before/after `EXPLAIN VERBOSE` and full query profiles with query IDs and per-BE scan details. Use the same precomputed query vector if possible to isolate the ANN scan from `EMBED`. Include `NumSegmentTotal`, `AnnIndexTopNSearchCnt`, `AnnIndexFallbackBruteForceCnt`, `AnnIndexTopNFallbackBySmallCandidateCnt`, ANN load/search time, scan CPU and I/O, and any ANN reader warnings. Please identify the source and time of the 186 and 187 totals so we can match the same snapshot. 3. Share the exact initial and repeat SQL, client responses, FE build SHA and `enable_light_index_change` setting, and the matching `SHOW BUILD INDEX` job IDs and FE audit entries. If the short jobs were explicit builds, look for `_input_rowsets is empty` on their BEs. For a maintainer repro, start with one tablet and multiple loaded rowsets, confirm ANN searches before compaction, then run tablet-level full compaction and inspect the new rowset before any rebuild. If an eligible nonempty output segment declares the index ID but its ANN entry is missing or unreadable, that gives a concrete compaction failure to reproduce and also explains why repeating `BUILD INDEX` can finish without repairing it. A segment whose rowset lacks the index ID can instead qualify for an explicit build. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
