CatgirlIntelligenceAgency/code/services-core/index-service
Viktor Lofgren f15dd06473 (index) Delayed close() of SearchIndexReader
This avoids concurrent access errors.  This is especially important when using Unsafe-based LongArrays, since we have concurrent access to the underlying memory-mapped file.  If pull the rug from under the caller by closing the file, we'll get a SIGSEGV.  Even with a "safe" MemorySegment, we'll get ugly stacktraces if we close the file while a thread is still accessing it.

So we spin up a thread that sleeps for a minute before actually unmapping the file, allowing any ongoing requests to wrap up.  This is 100% a hack, but it lets us get away with doing this without adding locks to the index readers.

Since this is "just" mmapped data, and this operation happens optimistically once a month, it should be safe if the call gets lost.
2024-01-23 11:08:41 +01:00
..
src (index) Delayed close() of SearchIndexReader 2024-01-23 11:08:41 +01:00
build.gradle (index/qs) GRPC API for better query peformance 2023-10-24 11:38:07 +02:00
readme.md (docs) Update documentation 2023-10-27 12:45:39 +02:00

Index Service

The index service is a partitioned service that knows which document contains which keywords.

image

Central Classes

See Also

The index service relies heavily on the primitives in features-index: