Ticket #267 (new defect)

Opened 7 months ago

Last modified 7 months ago

Make autoflush in implicit transaction not commit.

Reported by: richard Owned by: olly
Priority: normal Milestone: 1.1.0
Component: Library API Version: SVN trunk
Severity: normal Keywords:
Cc: Blocked By: #266
Operating System: All Blocking:

Description

Currently, when no explicit transaction is in progress, and an automatic flush occurs, the changes so far are committed.

Instead, it would be better if a flush of the buffered changes occurred, but not commit() happened.

This would lead to more predictable behaviour from the API (in particular, if a lot of documents are added without a flush, currently, a user may see that some of them are available for searching, and not realise that an explicit flush() is needed to make them all available).

This would probably be easiest to implement in conjunction with the changes to support #266, so I've marked this as blocked by #266.

Change History

Changed 7 months ago by olly

On the flip side, people might see their database getting bigger and bigger, and have heard that Xapian allows searching while indexing, and wonder why they can't see any (new) documents. Especially as this is the current behaviour.

True, documentation could explain this, but then documentation currently says that changes are flushed automatically every 10000 documents (which your hypothetical user apparently hasn't read).

Also, committing changes in larger batches will tend to bloat tables (especially the postlist table, but also others if documents are being updated) with unused blocks - the number of such blocks grows as the batch size does.

Your suggested behaviour can currently be achieved by using a transaction. With this change, getting the current behaviour isn't so easy. At present, you could count and commit explicitly every N changes, but that wouldn't allow the user to emulate more sophisticated flush criteria.

Note: See TracTickets for help on using tickets.