[Xapian-tickets] [Xapian] #421: Document modification can pick up old version

Xapian nobody at xapian.org
Thu Dec 24 23:18:48 GMT 2009


#421: Document modification can pick up old version
---------------------------+------------------------------------------------
 Reporter:  richard        |       Owner:  olly     
     Type:  defect         |      Status:  new      
 Priority:  normal         |   Milestone:  1.1.4    
Component:  Backend-Flint  |     Version:  SVN trunk
 Severity:  normal         |    Keywords:           
Blockedby:                 |    Platform:  All      
 Blocking:                 |  
---------------------------+------------------------------------------------

Comment(by olly):

 I think perhaps we should just document reality (that a Document object is
 a lazy-fetching facade, so you'll either get the old or new result the
 corresponding document in the database has been modify) and then the
 current behaviour is as expected.

 It doesn't seem very useful to try to force other user semantics -
 anything other than your suggestion of detecting this situation and
 throwing an exception is going to involve disproportionate complexity, and
 the obvious way to detect modification is just to track and compare the
 database revision, which is pessimistic as it would prevent reading from
 documents
 which aren't modified as well as those that are, so this wouldn't work
 though is clearly safe (not that it is a particularly important case,
 though the {{{commit()}}} could be implicit if there have been 9999
 batched changes, so this change would add unpredictable failures for
 this code without the {{{commit()}}}):

 {{{
 #!cpp
 Xapian::Document doc1 = db.get_document(1);
 Xapian::Document doc2 = db.get_document(2);
 doc1.add_term("XTAGfoo");
 db.replace_document(1, doc1);
 db.commit();
 doc2.add_term("XTAGfoo");
 db.replace_document(2, doc2);
 db.commit();
 }}}

-- 
Ticket URL: <http://trac.xapian.org/ticket/421#comment:1>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list