Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real-time reader does not observe changes to the index #52

Closed
zmb3 opened this issue Feb 13, 2021 · 2 comments
Closed

Real-time reader does not observe changes to the index #52

zmb3 opened this issue Feb 13, 2021 · 2 comments

Comments

@zmb3
Copy link

zmb3 commented Feb 13, 2021

Hi there! Coming from bleve and was surprised by the following behavior:

If I open a writer, and then simultaneously open a "near real-time reader" (with writer.Reader()) and start writing to the index, searches via the reader are unable to pick up results for anything that is written after the reader was opened. Is this the expected behavior or should the reader be able to observe future updates?

If this is the expected behavior, is it more common to keep a long-lived reader open and swap it out for a new one when the index is updated, or is the best practice to acquire a reader only when you need to perform a search and then discard it?

@mschoch
Copy link
Member

mschoch commented Feb 13, 2021

This is expected, as all readers in Bluge present a stable snapshot of the index. The near-realtime readers simply have the ability to search data not yet persisted to disk, whereas the traditional readers operate on snapshots persisted to disk.

As for the best practice, generally we recommend you open up a Reader when you need to execute a search, and then Close it. This releases that snapshot so that it can be cleaned up. Holding a reader open for a long period of time would otherwise interfere with regular maintenance of the index.

@zmb3
Copy link
Author

zmb3 commented Feb 13, 2021

Thanks Marty, makes sense!

@zmb3 zmb3 closed this as completed Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants