X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fdatabase.cc;h=aed053884108fdcf3ce30d94edc78fc77249c92a;hb=65f923219e08193d590bec35e2c3995dc6a19395;hp=96458f6ff104a18ba28d59929b7597cf284feeec;hpb=2e39ce6eb5d5e5ae2a2a4ed419190003f47e566e;p=notmuch diff --git a/lib/database.cc b/lib/database.cc index 96458f6f..aed05388 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -502,17 +502,9 @@ notmuch_database_close (notmuch_database_t *notmuch) * close it. Thus, we explicitly close it here. */ if (notmuch->open) { try { - /* If there's an outstanding transaction, it's unclear if - * closing the Xapian database commits everything up to - * that transaction, or may discard committed (but - * unflushed) transactions. To be certain, explicitly - * cancel any outstanding transaction before closing. */ - if (_notmuch_database_mode (notmuch) == NOTMUCH_DATABASE_MODE_READ_WRITE && - notmuch->atomic_nesting) - notmuch->writable_xapian_db->cancel_transaction (); - /* Close the database. This implicitly flushes - * outstanding changes. */ + * outstanding changes. If there is an open (non-flushed) + * transaction, ALL pending changes will be discarded */ notmuch->xapian_db->close (); } catch (const Xapian::Error &error) { status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; @@ -733,6 +725,15 @@ notmuch_status_t notmuch_database_destroy (notmuch_database_t *notmuch) { notmuch_status_t status; + const char *talloc_report; + + talloc_report = getenv ("NOTMUCH_TALLOC_REPORT"); + if (talloc_report && strcmp (talloc_report, "") != 0) { + FILE *report = fopen (talloc_report, "a"); + if (report) { + talloc_report_full (notmuch, report); + } + } status = notmuch_database_close (notmuch);