From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KhkrMYVcqGDjBAAAgWs5BA (envelope-from ) for ; Sat, 22 May 2021 03:21:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qC1OLIVcqGDCBwAA1q6Kng (envelope-from ) for ; Sat, 22 May 2021 01:21:09 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 77EAE1CD59 for ; Sat, 22 May 2021 03:21:09 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2BB0829000; Fri, 21 May 2021 21:20:55 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 5ABD1271E8 for ; Fri, 21 May 2021 21:20:52 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 1A8D75FD26; Fri, 21 May 2021 21:20:51 -0400 (EDT) Received: (nullmailer pid 1412726 invoked by uid 1000); Sat, 22 May 2021 01:20:48 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 1/5] database/close: remove misleading code / comment Date: Fri, 21 May 2021 22:20:36 -0300 Message-Id: <20210522012040.1412467-2-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210522012040.1412467-1-david@tethera.net> References: <20210522012040.1412467-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: M2NFZYSFWWA7V2BTERB7PLLR45QWPJLW X-Message-ID-Hash: M2NFZYSFWWA7V2BTERB7PLLR45QWPJLW X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621646469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TJQTCkhXLzbBlKwk/zj76/Gb15BI01WDISzkPL5cdD8=; b=bXAqEtoLGQspcpkbEHmRYlM9wnTLcugA+ZDbM2xSOQCZSWxdqLSsBfyRLMag5ra6thUVGy wY2vB069MGOyaGeEHbaOM50GZD4kkD2UtxJ416wt8TaEBV0cDp0B0VdvvWO2RhMaHH5iCv yYycPDKkACj7PH5Qocw+jHUOObEHdlIe7lFtihNOKB9L8bQG6XunXRSZnMGgtsF7qRbOXQ 9QOZK2MYurd1x5fiRZOs7fqosG8J2xevaG6BNb0XvlgAkkcmCAWYN0Oef+bvOrBEiLVYAQ DtRdZM8aNdGpM7tdXONwcQWot+//xOLSTmiS6H/V1OA57p8OXKFba/ztevskWw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621646469; a=rsa-sha256; cv=none; b=LunlTX8CSbZY1czyxwK91NmpAcv7w82W+TjldfwD6qtJdLGqKmmGSB4807fKK99A40HAUd o7GulruBa9txCFT8EBNTtbTCzFO/DFrgBUqdq75yOF2LnB1tipFBl71HrQBIvrxSa8vLBF q9bQKM6HygI7vBvSFERLff29x//4DTSfn8uIWGMOAedeKAzue/YC9WcnypG1XZh7PI59dw eHIu0D/fDLKYq9RGqsPzfsigDFAODUTyXIFHQgtAdDwXnBeURqr2JAcOtX8gK/Fbx5BhOz rjy1NhJ2FDsMTBVvgB/SYQL27XFVktByOAqGu3Onu5pNoGufmUI9/R6GyXZjhg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.07 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 77EAE1CD59 X-Spam-Score: -1.07 X-Migadu-Scanner: scn0.migadu.com X-TUID: 86lBBVA+KBFu Unfortunately, it doesn't make a difference if we call cancel_transaction or not, all uncommited changes are discarded if there is an open (unflushed) transaction. --- lib/database.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 96458f6f..db7feca2 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -502,17 +502,9 @@ notmuch_database_close (notmuch_database_t *notmuch) * close it. Thus, we explicitly close it here. */ if (notmuch->open) { try { - /* If there's an outstanding transaction, it's unclear if - * closing the Xapian database commits everything up to - * that transaction, or may discard committed (but - * unflushed) transactions. To be certain, explicitly - * cancel any outstanding transaction before closing. */ - if (_notmuch_database_mode (notmuch) == NOTMUCH_DATABASE_MODE_READ_WRITE && - notmuch->atomic_nesting) - notmuch->writable_xapian_db->cancel_transaction (); - /* Close the database. This implicitly flushes - * outstanding changes. */ + * outstanding changes. If there is an open (non-flushed) + * transaction, ALL pending changes will be discarded */ notmuch->xapian_db->close (); } catch (const Xapian::Error &error) { status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; -- 2.30.2