[Xapian-discuss] Why the Database object cannot see changes made by other WritableDatabase object which has been flushed?

Tom tom at lemurconsulting.com
Thu Nov 12 09:08:14 GMT 2009


2009/11/12 岳帅杰 <ysj.ray at gmail.com>:
> Hi, All:
>
>    I was using xapian with python. But I didn't understand the following
> code:
> ...
>    I think this piece of code is quite simple for understanding.
>
>    I don't understand why reader1 cannot see the changes make by writter.
>    I see the document says:
>    "From the point of view of a separate process (or a separate database
> object in the same process) reading the database, all modifications made to
> a database are invisible until the modifications is committed."
>    But the writter had committed its change( by calling flush())
>
>    And why reader2 can see the change?

Hi Ray,

Database readers continue to see the version of the database that
existed when they opened it, even if the database is changed. That's
why reader2 sees changes that are invisible to reader1. (It's
implemented by multiple, versioned paths through the B-trees).

To make a reader see the latest flushed version of the database, you
can call Database::reopen().

cheers,
Tom



More information about the Xapian-discuss mailing list