From: David Bremner Date: Sat, 9 Apr 2016 01:49:48 +0000 (+2100) Subject: [PATCH 2/4] test/atomicity: guard chert-only optimization X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=43f030db8760bdb6d552a3cd5e93d20db4b2ad19;p=notmuch-archives.git [PATCH 2/4] test/atomicity: guard chert-only optimization --- diff --git a/a6/3f769d2628cc56b9c4e0b66ec67f70c1785d7f b/a6/3f769d2628cc56b9c4e0b66ec67f70c1785d7f new file mode 100644 index 000000000..b743bc435 --- /dev/null +++ b/a6/3f769d2628cc56b9c4e0b66ec67f70c1785d7f @@ -0,0 +1,90 @@ +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 2E9FD6DE0355 + for ; Fri, 8 Apr 2016 18:50:17 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.02 +X-Spam-Level: +X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009, + 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 5di1jpOFmryZ for ; + Fri, 8 Apr 2016 18:50:09 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id 0B5B86DE02CD + for ; Fri, 8 Apr 2016 18:50:00 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aoi2L-00022e-Sz; Fri, 08 Apr 2016 21:50:09 -0400 +Received: (nullmailer pid 6632 invoked by uid 1000); + Sat, 09 Apr 2016 01:49:55 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 2/4] test/atomicity: guard chert-only optimization +Date: Fri, 8 Apr 2016 22:49:48 -0300 +Message-Id: <1460166590-6526-3-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net> +References: <1460166590-6526-1-git-send-email-david@tethera.net> +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: Sat, 09 Apr 2016 01:50:17 -0000 + +This should potentially be updated to have an equivalent optimization +for the glass backend, but it in my unscientific tests, the glass backend +without the optimization is faster then the chert backend with. +--- + test/atomicity.py | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +diff --git a/test/atomicity.py b/test/atomicity.py +index 01a4205..1ca52b9 100644 +--- a/test/atomicity.py ++++ b/test/atomicity.py +@@ -29,16 +29,19 @@ class RenameBreakpoint(gdb.Breakpoint): + self.n = 0 + + def stop(self): +- # As an optimization, only consider snapshots after a Xapian +- # has really committed. Xapian overwrites record.base? as the +- # last step in the commit, so keep an eye on their inumbers. +- inodes = {} +- for path in glob.glob('%s/.notmuch/xapian/record.base*' % maildir): +- inodes[path] = os.stat(path).st_ino +- if inodes == self.last_inodes: +- # Continue +- return False +- self.last_inodes = inodes ++ xapiandir = '%s/.notmuch/xapian' % maildir ++ if os.path.isfile('%s/iamchert' % xapiandir): ++ # As an optimization, only consider snapshots after a ++ # Xapian has really committed. The chert backend ++ # overwrites record.base? as the last step in the commit, ++ # so keep an eye on their inumbers. ++ inodes = {} ++ for path in glob.glob('%s/record.base*' % xapiandir): ++ inodes[path] = os.stat(path).st_ino ++ if inodes == self.last_inodes: ++ # Continue ++ return False ++ self.last_inodes = inodes + + # Save a backtrace in case the test does fail + backtrace = gdb.execute('backtrace', to_string=True) +-- +2.8.0.rc3 +