From a892fdaafbc02df17f784569c276fbd437b59506 Mon Sep 17 00:00:00 2001 From: Gaute Hope Date: Thu, 10 Apr 2014 16:43:03 +0200 Subject: [PATCH] Re: [PATCH] Add configurable changed tag to messages that have been changed on disk --- 7f/975126e734a68eaf2ce210c9d3cb7cf94a15c3 | 117 ++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 7f/975126e734a68eaf2ce210c9d3cb7cf94a15c3 diff --git a/7f/975126e734a68eaf2ce210c9d3cb7cf94a15c3 b/7f/975126e734a68eaf2ce210c9d3cb7cf94a15c3 new file mode 100644 index 000000000..e1aa2b56c --- /dev/null +++ b/7f/975126e734a68eaf2ce210c9d3cb7cf94a15c3 @@ -0,0 +1,117 @@ +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 28719431FBD + for ; Thu, 10 Apr 2014 07:44:23 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 Gfws4xGCRht2 for ; + Thu, 10 Apr 2014 07:44:16 -0700 (PDT) +Received: from mail-la0-f52.google.com (mail-la0-f52.google.com + [209.85.215.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 55FE7431FBC + for ; Thu, 10 Apr 2014 07:44:16 -0700 (PDT) +Received: by mail-la0-f52.google.com with SMTP id ec20so2425426lab.11 + for ; Thu, 10 Apr 2014 07:44:13 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:content-type:from:to:cc:subject:references + :in-reply-to:date:message-id:user-agent:content-transfer-encoding; + bh=Ghj/MGRG/vZASGsoLYASkEsREVxl8zAUF4WeNotvKFU=; + b=aQ/GG/W1999zwwcm+59U/7FyYKNSZoyV0HaSjsyfoHzL2SNUK0nPz6DVS8phVOTx+M + y5IF1we8b/3rulOKWYpcHckVPBqjUOQy+uALKajokGFdoz3DJc1XQxkBEPtF66jdbl6l + 9m9mpr9eNZaikHDWzcoGhe/VJPONgLMhlS0lE3kBne1xWXkZAmkFo3wviHcjgGcMgdej + At11Cd9wh7/gjIG+Ag3CaCiYPdOkA5e4/jF/A87NxnuUTBwFQfD68PvVOHg8Fo6S/zkT + XTe5nZwF9sCL63shAwsDDggbxaX6F4T1l/cHt7/bgYhjSPab/MAvI2vlPdxfpLuqy3An + iJXg== +X-Gm-Message-State: + ALoCoQkVDUZyySoReUlPdb/3MVOXGtB897WmcobdAhAk5MkyYxZ527Bte1Cj6XOzWQacgIdZJCCZ +X-Received: by 10.112.61.199 with SMTP id s7mr12049077lbr.25.1397141053481; + Thu, 10 Apr 2014 07:44:13 -0700 (PDT) +Received: from localhost ([128.39.46.106]) + by mx.google.com with ESMTPSA id f9sm4353270laa.8.2014.04.10.07.44.12 + for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 10 Apr 2014 07:44:12 -0700 (PDT) +Content-Type: text/plain; charset=UTF-8 +From: Gaute Hope +To: David Mazieres expires 2014-07-05 CEST + +Subject: Re: [PATCH] Add configurable changed tag to messages that have been + changed on disk +References: <1396800683-9164-1-git-send-email-eg@gaute.vetsj.com> + <87wqf2gqig.fsf@ta.scs.stanford.edu> +In-reply-to: <87wqf2gqig.fsf@ta.scs.stanford.edu> +Date: Thu, 10 Apr 2014 16:43:03 +0200 +Message-Id: <1397140962-sup-6514@qwerzila> +User-Agent: Sup/git +Content-Transfer-Encoding: 8bit +Cc: notmuch +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: Thu, 10 Apr 2014 14:44:23 -0000 + +Excerpts from David Mazieres's message of 2014-04-06 22:19:19 +0200: +> Gaute Hope writes: +> +> > When one of the source files for a message is changed on disk, renamed, +> > deleted or a new source file is added. A configurable changed tag is +> > is added. The tag can be configured under the option 'changed_tags' in +> > the [new] section, the default is none. Tests have been updated to +> > accept the new config option. +> > +> > notmuch-setup now asks for a changed tag after the new tags question. +> > +> > This could be useful for for example 'afew' to detect remote changes in +> > IMAP folders and update the FolderNameFilter to also add tags or remove +> > tags when a _existing_ message has been added to or removed from a +> > maildir. +> +> I think this is the wrong way to achieve such functionality, because +> then the change tag A) is expensive to remove, B) is easy to misuse +> (remember to call fsync everywhere before deleting the change tag), and +> C) can be used by only one application. +> +> A better approach would be to add a new "modtime" xapian value that is +> updated whenever the tags or any other terms (such as XFDIRENTRY) are +> added to or deleted from a docid. If it's a Xapian value, rather than a +> term, then modtime will be queriable just like date, allowing multiple +> applications to query all docids modified since the last time they ran. +> +> [... snip] + +This could also solve it, and probably have more uses. I don't quite see +how the opposite problem (for my use case) can be solved by this without +using a 'localchange' tag. This is to sync tag to maildir sync, when a +new tag has been added (by e.g. a user interaction in a client) it needs +to be copied to the maildir, if it is not done in the same go a +different application won't know whether the change was local or remote. +How did you solve this? + +I would suggest using a Xapian- or Index-time which gets a tick +everytime a modification is made to the index. Atomic operations could +operate on the same time in case this distinction turns out to be +useful. Perhaps something like this already exists in Xapian? This way +clock skew, clock resolution (lots of operations happening in the same +second, msec or nanosec) problems won't be an issue. The crux will be to +make sure all write-operations trigger a tick on the indextime. + +Regards, Gaute -- 2.26.2