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