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

岳帅杰 ysj.ray at gmail.com
Thu Nov 12 05:33:30 GMT 2009


Hi, All:

    I was using xapian with python. But I didn't understand the following
code:

    (The "db_path" and "docid" are both valid variable.)

    """
    reader1 = xapian.Database(db_path)

    writter = xapian.WritableDatabase(db_path, xapian.DB_CREATE_OR_OPEN)
    writter.delete_document(docid)
    writter.flush()

    print '*' * 30, reader1.get_document(docid).get_data()

    reader2 = xapian.Database(db_path)
    print '*' * 30, reader2.get_document(tempid).get_data()

    """

    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?


-- 
Best wishes from Ray ...


More information about the Xapian-discuss mailing list