Keep track of last modification time of database
|Reported by:||Richard Boulton||Owned by:||Vaibhav Kansagara|
Description (last modified by )
It would be useful to be able to find out the time at which a modification was last made to a database. Two possible uses for this information:
- supporting caching in an HTTP search server: for example, this would allow if-modified-since requests to be satisfied without having to perform a search (when not modified since).
- displaying status information about a database to users.
To implement this, we'd need to store the modification time in the database somewhere, since we want to know the time of the last successful commit; this can't be derived by looking at the timestamp of the files, since it's possible that a commit nearly happened, but was cancelled or failed at the last minute (or, indeed, since we use fdatasync(), that a commit succeeded, but the timestamp information about the file modification never got written to disk due to a machine crash immediately after the commit). [This is true for chert and older backends, but for glass a new
iamglass file is written to a temporary name and then renamed to atomically perform the commit, so its timestamp should be reliable even in the face of these concerns]
This could be emulated by storing the current time in a metadata value each time that flush() is called, but this wouldn't cover modifications made by implicit flushes. Currently, to implement this correctly on top of xapian, you'd need to use explicit transactions.
Change History (8)
comment:7 by , 4 years ago
|Component:||Backend-Chert → Backend-Glass|