From d25bff226524bfe0eb96309cc9308fcf4c9277e2 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 26 Oct 2015 17:02:15 +2000 Subject: [PATCH] [bug] notmuch doesn't commit changes before an open transaction on close --- f7/e2bbb682b40a5b635c0bb9b9760352ede2e9c4 | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 f7/e2bbb682b40a5b635c0bb9b9760352ede2e9c4 diff --git a/f7/e2bbb682b40a5b635c0bb9b9760352ede2e9c4 b/f7/e2bbb682b40a5b635c0bb9b9760352ede2e9c4 new file mode 100644 index 000000000..0f28ad3e0 --- /dev/null +++ b/f7/e2bbb682b40a5b635c0bb9b9760352ede2e9c4 @@ -0,0 +1,136 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 5A7F26DE15DC + for ; Sun, 25 Oct 2015 14:02:27 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.681 +X-Spam-Level: +X-Spam-Status: No, score=-0.681 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, + T_FREEMAIL_FORGED_FROMDOMAIN=0.01, + T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id UsXHT5xb54uT for ; + Sun, 25 Oct 2015 14:02:24 -0700 (PDT) +Received: from mail-yk0-f171.google.com (mail-yk0-f171.google.com + [209.85.160.171]) + by arlo.cworth.org (Postfix) with ESMTPS id 086986DE1585 + for ; Sun, 25 Oct 2015 14:02:24 -0700 (PDT) +Received: by ykdr3 with SMTP id r3so166225054ykd.1 + for ; Sun, 25 Oct 2015 14:02:22 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=sender:date:from:to:subject:message-id:mime-version:content-type + :content-disposition:phone:user-agent; + bh=bcvY5qV4kdmK9HvLn0bXpIYqCLb2VLIL9ZW+KnKjDZY=; + b=TFbJPFeJ2NhhbXGVNwix7DGPYboNdf1V/jr26qLjfimwz1G3FzuRiaxeNkgV5ZKq1V + nnyLjsuHN72UydrjaBO5OCWVazqO/0my8KZArJGiMYU6826JBpw6Ojf2dJ+dOr5rTbXZ + UqWa7LCggKvygQ/lI+bwAWNP0vcAg8EreW6P9nvZ7si8By6iYPdpNi9ot2U6IXIJZjfZ + PEgfjuH/c7BcZKve2dVwG+o3bOyYoowYoH9hMHAhQa/pKnaYfzaKSUiQ1mosZ5+UF8+n + eIsSrgo7qG97jM71Zo37TpKk1m0yLmn8KaRcdx+IkpUp5QR1jaEFn2IVxnWkqoOJOA7i + r8gg== +X-Received: by 10.13.241.135 with SMTP id a129mr23111341ywf.325.1445806940965; + Sun, 25 Oct 2015 14:02:20 -0700 (PDT) +Received: from localhost (pool-71-174-176-247.bstnma.east.verizon.net. + [71.174.176.247]) + by smtp.gmail.com with ESMTPSA id r185sm5978967ywg.26.2015.10.25.14.02.19 + for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 25 Oct 2015 14:02:20 -0700 (PDT) +Sender: Steven +Date: Sun, 25 Oct 2015 17:02:15 -0400 +From: Steven Allen +To: notmuch@notmuchmail.org +Subject: [bug] notmuch doesn't commit changes before an open transaction on + close +Message-ID: <20151025210215.GA3754@stebalien.com> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha256; + protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" +Content-Disposition: inline +Phone: +1-310-433-5865 +X-PGP-Key: https://stebalien.com/assets/media/uploads/key.pgp +X-PGP-Fingerprint: 327B 20CE 21EA 68CF A774 8675 7C92 3221 5899 410C +User-Agent: Mutt/1.5.23.1 (2014-03-12) +X-Mailman-Approved-At: Sun, 25 Oct 2015 14:07:00 -0700 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 25 Oct 2015 21:02:27 -0000 + + +--x+6KMIRAuhnl3hBn +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +Notmuch claims to commit changes made before an open transaction on +close but actually throws them away (according to the documentation). + +According to the notmuch documentation, + +> For writable databases, notmuch_database_close commits all changes +> to disk before closing the database. If the caller is currently in +> an atomic section (there was a notmuch_database_begin_atomic +> without a matching notmuch_database_end_atomic), this will discard +> changes made in that atomic section (but still commit changes made +> prior to entering the atomic section). + +However, this isn't true. Notmuch atomic transactions don't flush on +entry so, this comment from the xapian documentation applies: + +> If you're applying atomic groups of changes and only wish to ensure +> that each group is either applied or not applied, then you can prevent +> the automatic commit() before and after the transaction by starting +> the transaction with begin_transaction(false). However, if +> cancel_transaction is called (or if commit_transaction isn't called +> before the WritableDatabase object is destroyed) then any changes +> which were pending before the transaction began will also be +> discarded. + +source: http://xapian.org/docs/apidoc/html/classXapian_1_1WritableDatabase.= +html + +This means that, in theory at least, xapian could throw away *all* +changes to the database if a transaction is open. + +--=20 +Steven Allen +(310) 433-5865 +((Do Not Email )) + +--x+6KMIRAuhnl3hBn +Content-Type: application/pgp-signature; name="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQIcBAEBCAAGBQJWLUNUAAoJEGVqlrqQ0li+dg0QAKDqTok9X+n7hZ51dSoss861 +GzhJ1HmE0ikcSDiMzMWT6tUkjKf+WdVl/abXliZZdMnccJGEr3kB5uakt+3HybBN +s3hLZdKjDhFLatdFdDUJzOHWI3nJENXT614lb3RhCjGK6fiyloQ543sDPxT3PQ+D +PGknZ3LZI54R/L93hEdR1OCBcMSNRw5+7tmEfrHj+P12duYcgL5Nj9XY+wv9GqYY +WA/58qEeDVlKkt7K4zTkw8Chrzb58o0whrqJGojw+5eTOA1MUA7/wkcfb1nsEW87 +eRRc+KjgzFclEdE/XYwkdIqFhuurB4KflLo5f1k9Py2O7qPeQssru9RDcdjFACB+ +w7CEKvHvo6RX+j+Vq1h25fXxG3bogOfp08AlTJFZLp75KNRjGdS1frvgaF1ufhZq +1aTxKbnXo+OTRhriMFWS7P94410Sm7cbhCe7IJJbpu3LFi2ZLkT7jwOgSB+Oj7HQ +CJtLgyJsRBjrfTmexV3aUU94NhNJGfFj6R7GueckjNdPcH/MVIu52cQxfSLo7DTg +waReepRIc5xdjRwXI+xr0xjtlnNbFOz2fQVe1/RSxvsLb5elEeTAINjMZ7WF9hOe +bWjsLEB+CyPmDT5mxfvFSdWtN385S4foWWsnvhqCz1+gc22ZRQLwWqUOQKFayH0Q +STSUYWPnPA+mOq2+lTQv +=q6/j +-----END PGP SIGNATURE----- + +--x+6KMIRAuhnl3hBn-- -- 2.26.2