[Xapian-tickets] [Xapian] #333: Keep track of last modification time of database

Xapian nobody at xapian.org
Wed Mar 7 00:10:25 GMT 2018


#333: Keep track of last modification time of database
---------------------------+------------------------------
 Reporter:  richard        |             Owner:  olly
     Type:  enhancement    |            Status:  new
 Priority:  normal         |         Milestone:  1.4.x
Component:  Backend-Glass  |           Version:  SVN trunk
 Severity:  normal         |        Resolution:
 Keywords:  GoodFirstBug   |        Blocked By:
 Blocking:                 |  Operating System:  All
---------------------------+------------------------------
Changes (by olly):

 * keywords:   => GoodFirstBug
 * component:  Backend-Chert => Backend-Glass


Old description:

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

New description:

 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.

--

--
Ticket URL: <https://trac.xapian.org/ticket/333#comment:7>
Xapian <https://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list