quickwit-oss / tantivy

Tantivy is a full-text search engine library inspired by Apache Lucene and written in Rust
MIT License
11.8k stars 655 forks source link

Deregister FileWatcher in MmapDirectory #2200

Open naveenann opened 11 months ago

naveenann commented 11 months ago

Is your feature request related to a problem? Please describe.

On Creating the Index the File Watcher starts a watch on meta.json and cannot be deregister or unwatched. This is a problem when you have to delete the index. The File Watcher will still be active and will try to read the file and throw an Warning.

thread-tantivy-meta-file-watcher ThreadId(17) tantivy::directory::file_watcher: Failed to open meta file "/data/85ee930e/meta.json": Os { code: 2, kind: NotFound, message: "No such file or directory" } 2023-09-30T07:09:25.687061Z WARN thread-tantivy-meta-file-watcher ThreadId(17) tantivy::directory::file_watcher: Failed to open meta file "/data/85ee930e/meta.json": Os { code: 2, kind: NotFound, message: "No such file or directory" }

Describe the solution you'd like

A way to drop the File watcher after we delete the index. A fn in mmap_directory.rs to drop/ unregister the file watcher.

PSeitz commented 11 months ago

Unregister on drop should be done. Having an interface to unregister could be done when there's a use case for it.