From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 74F346DE0B2B for ; Mon, 31 Jul 2017 14:20:07 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 uUHoZkzSlLu2 for ; Mon, 31 Jul 2017 14:20:05 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 555E26DE092F for ; Mon, 31 Jul 2017 14:20:05 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dcI3H-0002Ft-SZ; Mon, 31 Jul 2017 17:16:35 -0400 Received: (nullmailer pid 28825 invoked by uid 1000); Mon, 31 Jul 2017 21:20:00 -0000 From: David Bremner To: William Pettersson , notmuch@notmuchmail.org Subject: Re: Python/thaw/freeze: Different references to same message In-Reply-To: <20170729115850.ojg4uzalfyv7i64t@enigmas> References: <20170729115850.ojg4uzalfyv7i64t@enigmas> Date: Mon, 31 Jul 2017 17:20:00 -0400 Message-ID: <87a83ktibj.fsf@rocinante.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Mon, 31 Jul 2017 21:20:07 -0000 William Pettersson writes: > That script (which admittedly is from 6 years ago) freezes messages > before changing tags. But when changing tags, new searches are often > run, returning some of the same results. It seems any changes on these > "inner" messages are lost when the outer messages are thawed, and I'm > guessing this is because the "inner" and "outer" messages reference > different objects in memory which point to the same Xapian document. That sounds likely to be the case. There's no attempt to synchronize multiple in memory caches of the same xapian document. > Now If I'm correct in guessing the issue here, I can understand that > it's not the sort of thing that is fun to fix, so I'm more looking to > see if my understanding is right. In particular, I'm asking because > clearly 6 years ago Ben's scripts worked, so maybe I'm just not > understanding them/notmuch correctly. > > If I am right, then I'll just leave out the freezing/thawing. As it > stands, I'm only adding ~5-10 emails at most each run (which is every 10 > minutes) so performance when adding emails isn't (yet) an issue for me. You might try begin_atomic / end_atomic instead. These nest properly by design, although I'm not so confident about the performance impact (they're not really focussed on performance).