Re: [PATCH 1/3] new: Do not defer maildir flag synchronization during the first run
authorAustin Clements <amdragon@MIT.EDU>
Wed, 26 Jan 2011 15:07:28 +0000 (10:07 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:46 +0000 (09:37 -0800)
c8/507e3a06186b9a997e46c067a6560316fa1c6e [new file with mode: 0644]

diff --git a/c8/507e3a06186b9a997e46c067a6560316fa1c6e b/c8/507e3a06186b9a997e46c067a6560316fa1c6e
new file mode 100644 (file)
index 0000000..773fbab
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 24F29431FD0\r
+       for <notmuch@notmuchmail.org>; Wed, 26 Jan 2011 07:07:37 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Zb44c7D8q00c for <notmuch@notmuchmail.org>;\r
+       Wed, 26 Jan 2011 07:07:36 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9CA9D431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 26 Jan 2011 07:07:36 -0800 (PST)\r
+X-AuditID: 1209190e-b7b3bae000000a71-5d-4d4038b7166c\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Brightmail Gateway) with\r
+       SMTP id 38.86.02673.7B8304D4; Wed, 26 Jan 2011 10:07:35 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id p0QF7XqV029337; \r
+       Wed, 26 Jan 2011 10:07:34 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p0QF7Sm5012536\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Wed, 26 Jan 2011 10:07:29 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Pi6y0-000840-Cg; Wed, 26 Jan 2011 10:07:28 -0500\r
+Date: Wed, 26 Jan 2011 10:07:28 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Carl Worth <cworth@cworth.org>\r
+Subject: Re: [PATCH 1/3] new: Do not defer maildir flag synchronization\r
+       during the first run\r
+Message-ID: <20110126150728.GT13226@mit.edu>\r
+References: <1295603977-14326-1-git-send-email-sojkam1@fel.cvut.cz>\r
+       <1295603977-14326-3-git-send-email-sojkam1@fel.cvut.cz>\r
+       <AANLkTinsC+89yx7jGUaB8PLiftLjyTr7gosUDgAC_g0S@mail.gmail.com>\r
+       <87pqrk10wm.fsf@yoom.home.cworth.org>\r
+       <87mxmn27w6.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87mxmn27w6.fsf@yoom.home.cworth.org>\r
+User-Agent: Mutt/1.5.20 (2009-06-14)\r
+X-Brightmail-Tracker: AAAAAA==\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 26 Jan 2011 15:07:37 -0000\r
+\r
+Quoth Carl Worth on Jan 26 at  9:59 pm:\r
+> On Wed, 26 Jan 2011 19:15:21 +1000, Carl Worth <cworth@cworth.org> wrote:\r
+> > But then I'm also wondering if perhaps we could do the processing undeferred\r
+> > in all cases?\r
+> > \r
+> > I haven't thought that through, but I'd be glad to hear your ideas.\r
+> \r
+> This is still an open question if anyone wants to pursue it, (it might\r
+> make it simpler to then fix the atomicity bugs with adding new messages\r
+> to the database, and only later adjusting the maildir filename).\r
+\r
+I believe you're right that synchronization could always be done\r
+eagerly.  In fact, I believe this is true even with the addition of\r
+conjunctive and disjunctive flags.\r
+\r
+When adding or removing messages, flag synchronization fully dictates\r
+all tags in flag2tag (that is, the tags' current states don't matter).\r
+It also always examines *all* file names backing the message.  This is\r
+a stateless process.  With eager synchronization, the tags may go\r
+through some transient states during notmuch new, but will always\r
+settle down to the correct set as of the final add or remove for a\r
+given message ID.\r
+\r
+> On that topic, if we decide we do need to defer the tags/flags mapping,\r
+> then the real fix is to probably also defer the addition of the filename\r
+> to the message document in the database. If we change these things only\r
+> at the same time, then we should be able to avoid any problems with\r
+> things getting out of synchronization.\r
+\r
+I'd been thinking about this as a way to break up notmuch new into\r
+small, consistent transactions, but I don't think it's necessary since\r
+flags can be synchronized eagerly.  In fact, with eager\r
+synchronization and one other change, I believe notmuch new can be\r
+completely correctly performed in lots of small transactions.\r
+\r
+The one other change is that currently, if notmuch is interrupted\r
+after updating a directory mtime but before processing file removals,\r
+a subsequent notmuch new will miss those removals.  This could be\r
+brushed under the rug, since notmuch will notice the removal after any\r
+other change in that directory.  Or it could be handled correctly by\r
+giving directories a "removal mtime" in addition to their current\r
+"addition mtime" that is only updated after removals are handled.\r