airborne12 commented on code in PR #70270:
URL: https://github.com/apache/doris/pull/70270#discussion_r4657729058


##########
be/src/storage/index/index_file_reader.cpp:
##########
@@ -497,6 +499,19 @@ Result<std::unique_ptr<DorisCompoundReader, 
DirectoryDeleter>> IndexFileReader::
     return _open(index_id, index_suffix, io_ctx);
 }
 
+Result<std::unique_ptr<AnnIndexSource>> IndexFileReader::open_ann_source(
+        const TabletIndex* index_meta, const io::IOContext* io_ctx) const {
+    // Every format serves an ANN index through the compound reader of its 
files:
+    // V1 its per-index file, V2 its entry table over the one index file, and 
SNII
+    // (until it serves ANN natively) the blob's extents in the container.
+    auto compound_reader = open(index_meta, io_ctx);

Review Comment:
   Reproduced and fixed in 448ed7466fd.
   
   A new test, 
`AnnIndexRangeReadTest.ACutShortIndexFileFailsTheLoadWithAStatus`, cuts 4 KiB 
off a V1 and a V2 HNSW index file and calls `load_index()`. Before the fix it 
threw `doris::Exception` "[E34] Failed to read vector index: ... read past EOF" 
out of `faiss::read_index`, so `try_load_index()` could not fall back to brute 
force.
   
   The exception does not come from the compound reader: for V2 and SNII, 
`_open()` builds `DorisCompoundReader` from the entry table without reading the 
stream, and `init()` already turns a header parse failure into a status. It 
comes from `FaissIndexReader`, whose callback can only count items, so a failed 
read is thrown. master behaves the same way (the same test fails there, on 
7eef244a412): its catch in `load_index()` only took `CLuceneError`.
   
   Fix: `FaissVectorIndex::load` now wraps both `faiss::read_index` calls in 
`RETURN_IF_CATCH_EXCEPTION`, as `write_index_file()` already does for 
`faiss::write_index`. The test now passes for V1 and V2, and the ANN, vector 
search, index file, index builder and SNII suites pass under ASAN.
   



##########
build-support/check-header-deps.py:
##########
@@ -644,16 +644,11 @@
 # the gate, so the tables only shrink.
 # Files that include a CLucene header and are under a root or reached from one.
 CLUCENE_INCLUDING_FILES = {
-    # ANN storage (T11, T12).

Review Comment:
   Added in baaf9666d28.
   
   `test-build-hygiene-header-deps.sh` now injects a CLucene include into 
`ann_index_writer.h` and a CLucene symbol into `ann_index_storage.h`; with the 
ANN entries out of both tables, each must fail the gate. The two 
stale-exception cases pointed at analysis files the tables no longer list, so 
they failed on master already; they now use `snii/snii_index_reader.cpp`, which 
both tables still list. `bash build-support/tests/run.sh` passes.
   



-- 
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]

Reply via email to