Lost updates to Notmuch database

Eric J eric at deptj.eu
Wed Feb 17 12:44:23 PST 2016


Using the API, I am adding single mail files, already in the maildir, to
the Notmuch database and tagging them. It works, every time, as long as
I run it one file at a time. 

However, if I do it twice, in different processes, at the same time, one
file is added and tagged properly, the other is not (totally unfindable
by notmuch search). Neither process reports any error, and they both log
their actions normally. Actually a third simultaneous process also fails
to leave any result in the database.

This is in spite of using begin_atomic/end_atomic. I would not have been
surprised to get Xapian lock errors, but the database_open returns
success, as does the database_begin_atomic. 

The wrapper around the API for Tcl is very simple, and I can not see any
way for that or Tcl itself to cause this sort of problem. Beyond this,
I haven't thought of any way to decide if this could be a Notmuch problem
or a Xapian problem.

The API sequence is:

    database_open
    database_begin_atomic
    database_add_message
    (next 4 are a for loop)
    message_get_tags
    tags_valid
    tags_move_to_next
    tags_get
    message_freeze
    message_add_tag
    message_thaw
    message_maildir_flags_to_tags
    message_get_filename
    message_get_message_id
    database_end_atomic
    message_destroy
    database_close
    database_destroy

I didn't realise till it was mostly written, but it is pretty much like
add_new() in notmuch-new.c .

Eric
-- 
ms fnd in a lbry


More information about the notmuch mailing list