airborne12 opened a new pull request, #66856:
URL: https://github.com/apache/doris/pull/66856
### What problem does this PR solve?
Issue Number: None
Related PR: #66052
Problem Summary:
SNII staged every serialized Faiss ANN sub-file in a growing in-memory
vector. A large HNSW or IVF index therefore retained a second complete copy of
the serialized index and could exhaust BE memory during index construction.
A 64 MiB staging reproduction increased allocated heap by 67,388,976 bytes
before this change. Fault-injection reproductions also showed that final
buffered append or fsync failures could escape `AnnIndexColumnWriter::finish()`
as `CLuceneError`; the IVF data path additionally leaked its raw output owner.
This change reuses the self-cleaning `StagedBlobFile` abstraction for ANN
sub-files and keeps only the fixed CLucene output buffer resident. It also
gives both `ann.faiss` and `ann.ivfdata` explicit RAII ownership, closes them
in a catchable context, and converts staging failures to `Status`.
The successful Faiss sub-file bytes, SNII container layout, persisted index
format, and query behavior are unchanged. Existing SNII indexes remain readable
after upgrade.
### Release note
Reduce peak BE memory while building SNII ANN indexes by staging serialized
Faiss files on temporary storage instead of retaining a complete in-memory copy.
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- `./run-be-ut.sh -j 192 --run
--filter="SniiAnnContainerTest.*:BkdStagedBlobFileTest.*"` (20 tests passed)
- `./build.sh --be -j 192` (ASAN build passed)
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [x] Yes. SNII ANN build-time staging now uses self-cleaning temporary
files; the persisted index format and query behavior are unchanged.
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]