From 1a417862b9ba6b2c21ec4fcbd7d224d58b2b4a9f Mon Sep 17 00:00:00 2001 From: David Bremner Date: Thu, 7 Apr 2016 07:27:10 +2100 Subject: [PATCH] [PATCH 2/3] test/atomicity: guard chert-only optimization --- 84/c23e9b9422c59367bcb2bbe983759d2dc53237 | 91 +++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 84/c23e9b9422c59367bcb2bbe983759d2dc53237 diff --git a/84/c23e9b9422c59367bcb2bbe983759d2dc53237 b/84/c23e9b9422c59367bcb2bbe983759d2dc53237 new file mode 100644 index 000000000..0f88b9269 --- /dev/null +++ b/84/c23e9b9422c59367bcb2bbe983759d2dc53237 @@ -0,0 +1,91 @@ +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 50F036DE02DD + for ; Wed, 6 Apr 2016 03:27:29 -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 PXJLn4erIQ7V for ; + Wed, 6 Apr 2016 03:27:20 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id F32C46DE0243 + for ; Wed, 6 Apr 2016 03:27:19 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1ankgi-00033H-Vu; Wed, 06 Apr 2016 06:27:53 -0400 +Received: (nullmailer pid 28740 invoked by uid 1000); + Wed, 06 Apr 2016 10:27:16 -0000 +From: David Bremner +To: David Bremner , notmuch@notmuchmail.org +Subject: [PATCH 2/3] test/atomicity: guard chert-only optimization +Date: Wed, 6 Apr 2016 07:27:10 -0300 +Message-Id: <1459938431-28670-3-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1459938431-28670-1-git-send-email-david@tethera.net> +References: <1459855082-5715-2-git-send-email-david@tethera.net> + <1459938431-28670-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: Wed, 06 Apr 2016 10:27:29 -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 + -- 2.26.2