From 3941fcc47daa4a3e61fb5758966bb35fcbe76a94 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Thu, 18 Oct 2012 11:28:56 +2000 Subject: [PATCH] [PATCH 2/3] Produce status messages during compacting --- 20/397d15937f08d5ca438b0b575a4ab2cb4a63fc | 98 +++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 20/397d15937f08d5ca438b0b575a4ab2cb4a63fc diff --git a/20/397d15937f08d5ca438b0b575a4ab2cb4a63fc b/20/397d15937f08d5ca438b0b575a4ab2cb4a63fc new file mode 100644 index 000000000..e428a94f2 --- /dev/null +++ b/20/397d15937f08d5ca438b0b575a4ab2cb4a63fc @@ -0,0 +1,98 @@ +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 26370431FC4 + for ; Wed, 17 Oct 2012 08:29:40 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, 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 bfShYsbAkPOn for ; + Wed, 17 Oct 2012 08:29:39 -0700 (PDT) +Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com + [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 881F4431FB6 + for ; Wed, 17 Oct 2012 08:29:39 -0700 (PDT) +Received: by mail-qa0-f46.google.com with SMTP id c26so637242qad.5 + for ; Wed, 17 Oct 2012 08:29:39 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=D1KJeMANvVeI1envwO2kMhZeS29daCLoE2IYrWHYoSg=; + b=ARr7rQC6h7dpsgfD2NI6ZHD+V3WD1H4fvg2wyOo3esJmd80Mimbp7vCnqLFb9nLzxY + jym1aLkk4gd1oL3LjPAx48YtKJQ63FB/8l9fztJCJs7BU6/hTs9SjMOtBmtNs1yq3tg0 + S0o6Bvaqdd/wx79pE+CFFfn6XBLAWNGY6/r4d55IdzKOax/p6IbFMXzcPLr6V4Aas64i + fzafwBAiS9ZYwvOBuOnCRtbLJihcqfjnPvXynJ5Jg8ThZhDrnZw8kkxddkDPl24TlOQR + PwyOQj44LiJ8YQZvwXYQ3TANaAAPq0VDA9oxA3GqQt/iKHZNQ5NJyfsTLlH4xuNbqxMw + XaKA== +Received: by 10.49.85.194 with SMTP id j2mr43115507qez.54.1350487778961; + Wed, 17 Oct 2012 08:29:38 -0700 (PDT) +Received: from ben-laptop.hasb.physics.cns (physicsnat56.physics.umass.edu. + [128.119.50.38]) + by mx.google.com with ESMTPS id eq10sm13366039qab.0.2012.10.17.08.29.38 + (version=SSLv3 cipher=OTHER); Wed, 17 Oct 2012 08:29:38 -0700 (PDT) +From: Ben Gamari +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3] Produce status messages during compacting +Date: Wed, 17 Oct 2012 11:28:56 -0400 +Message-Id: <1350487737-32058-3-git-send-email-bgamari.foss@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1350487737-32058-1-git-send-email-bgamari.foss@gmail.com> +References: <1350487737-32058-1-git-send-email-bgamari.foss@gmail.com> +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, 17 Oct 2012 15:29:40 -0000 + +--- + lib/database.cc | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 6e83a61..49aa36d 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -780,11 +780,24 @@ notmuch_database_close (notmuch_database_t *notmuch) + notmuch->value_range_processor = NULL; + } + ++class NotmuchCompactor : public Xapian::Compactor ++{ ++public: ++ virtual void ++ set_status (const std::string &table, const std::string &status) ++ { ++ if (status.length() == 0) ++ fprintf (stderr, "compacting table %s:\n", table.c_str()); ++ else ++ fprintf (stderr, " %s\n", status.c_str()); ++ } ++}; ++ + void + notmuch_database_close_compact (notmuch_database_t *notmuch) + { + void *local = talloc_new (NULL); +- Xapian::Compactor compactor; ++ NotmuchCompactor compactor; + char *notmuch_path, *xapian_path, *compact_xapian_path, *old_xapian_path; + + #if HAVE_XAPIAN_COMPACT +-- +1.7.10.4 + -- 2.26.2