From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EKSmDhbAlWMWfwAAbAwnHQ (envelope-from ) for ; Sun, 11 Dec 2022 12:33:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IGu2DhbAlWPg3wAA9RJhRA (envelope-from ) for ; Sun, 11 Dec 2022 12:33:42 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 50F15BBB1 for ; Sun, 11 Dec 2022 12:33:41 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4KZU-00036M-AW; Sun, 11 Dec 2022 06:32:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4KZD-00035e-UW for emacs-orgmode@gnu.org; Sun, 11 Dec 2022 06:32:34 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4KZB-0008Sm-UE for emacs-orgmode@gnu.org; Sun, 11 Dec 2022 06:32:23 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 626365C0037; Sun, 11 Dec 2022 06:32:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 11 Dec 2022 06:32:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecosaur.net; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1670758340; x=1670844740; bh=WJFbHPiRF5 FGLmuX3+/O0t4y1T5f9edrr/LD7gFSNx8=; b=ZEfy294tP1ZcUU2fl22zp8IHmS yH/lXbnMx04qYEc7Zc/bXEgObOBsseGWJhaSwLlwYzxR/iNt1pv+ZOg4O2Nsar0C cAoLKYlM3V2G1m864QZqYrt10R4thI3AP8uNeadrbnTQx4353Cloh6XHh/+NO4eR ah0x4DMVSXyskOqC3hMnqvExloDyblEDFZh/E9v+3UYaLRjDq68pr295OCP+64mO X/jR2A5Q4Doy80ZH4FI/Du6ZbyHknUQKoKPdFesI6jGYg+5PeYXq6dW0AqaCpCSS tymDp0hOx7TSfgJMrnXougkWhg0vqeR7qDRkh0YfAkVXhOWtShHQKiTpYJ3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1670758340; x=1670844740; bh=WJFbHPiRF5FGLmuX3+/O0t4y1T5f 9edrr/LD7gFSNx8=; b=clU8jYM56XIEYl8zO600ap2hcsKSJ3og9eqKixKDsEX7 5YLCfV9Q25DKM07B2PTi+cPzlrKEYEjHBMPe5CqJjy65gCwsDpDSLPCzlIsCysEp M2KBNoQP+V4BeLBd2CRDbXYGmkVw96orPPtvIO3APQoMcGyn4UE+XlKbj3bATFyo GHQbzFV6JC06REex2YpmuOuX3OW6Yd0ux3JlgwMbvfJWUABsWNf/7JoIvV/kvN9p lNazR+YteWJDAIbnUNvZw366jKLW4SwpvmAOrOZmKBg/TAGZVQROm5q7WRiOUkq3 vU7pYcJz+IT/Qtba+Mtcijj4vfvIzislft58JGp35Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeigddvlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevuffffhgfjgfkgggtsehmtderredtreejnecuhfhrohhmpefvihhmohht hhihuceoohhrghhmohguvgesthgvtgdrthgvtghoshgruhhrrdhnvghtqeenucggtffrrg htthgvrhhnpeeiuddvfeekfeeffeegieeuhfekvdekffejjedtffeftdegleevteffvddt udehffenucffohhmrghinhepohhrghhmohguvgdrohhrghdplhhisggvrhgrphgrhidrtg homhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeho rhhgmhhouggvsehtvggtrdhtvggtohhsrghurhdrnhgvth X-ME-Proxy: Feedback-ID: iecf94634:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 11 Dec 2022 06:32:19 -0500 (EST) From: Timothy To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Merge loaded org-persist index with index file contents Date: Sun, 11 Dec 2022 19:26:42 +0800 References: <87359mqqvf.fsf@tec.tecosaur.net> User-agent: mu4e 1.8.11; emacs 28.2.50 In-reply-to: Message-ID: <871qp6qipu.fsf@tec.tecosaur.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: none client-ip=66.111.4.25; envelope-from=orgmode@tec.tecosaur.net; helo=out1-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670758422; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=WJFbHPiRF5FGLmuX3+/O0t4y1T5f9edrr/LD7gFSNx8=; b=tKuNqt9G1lCUfwmGEDs83FCmwxMOYM0PmxNorQ25sZ+Gstchp0EcWvxkZYcKU68vGZTdeq irNXmU66gNHimP9qARTj1Z5+FqUWPa+GquJb2sUQuGyRBtiiTDVepexrSjAgxiXwrOmMIE V72TAkKK6e6llYRXpgXK8ErKmWn5Mn/c4xmw9atKhaYxN8645pXAmv4lpVYBn5B8G3S41T z5bITWo9O6dt0ZalwWwIedWiVECuSW0Qtt2ynkZ+WMhemFe8E0KyUezQx3APGU1fma6etl 35GSx1aCPa3nnOUWaW6eyIZagV2VFz9bfdWXxBFVC0rGckOG6H0YXzTdm5r/pQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tecosaur.net header.s=fm1 header.b=ZEfy294t; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=clU8jYM5; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670758422; a=rsa-sha256; cv=none; b=iaukZILYRExhLcrXBqC3j075WH7H6Nixxy3X4FtENxFszO/Yd2ihYC90bAWZtTzV9cqpY+ mtTEhBIaml8jsN8XAiBLaLfFv6m4GLOB2y4E/eFOru3Gu7VO8PXcildYD8uhQRpzt4wwmR GZyDvlnA5I86mg38u+no+s2I3KoMrokkKKokmOudPWRG8bTMnMwcKaI1K+WvGsgf4+RRMe 9ytsW/FGLXpT9EJQX9Pz2tnAMmobAc7c3ui74zLy00AqlOPrmukQmtXzSnQgLf3cjHEgxe cYpL/4TXWft1Tfwd6lqHUKOC0vVqJLj4Nc6WYVUy6islPnuJVEATBMn6VaUuiA== X-Migadu-Spam-Score: 2.15 X-Spam-Score: 2.15 X-Migadu-Queue-Id: 50F15BBB1 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tecosaur.net header.s=fm1 header.b=ZEfy294t; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=clU8jYM5; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-TUID: vOcLkVExczCk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Max, > Please, avoid mixing of system clock and filesystem timestamps. > > (file-attribute-modification-time (file-attributes file)) > > should be more reliable. Thanks for the tip, I=E2=80=99ve updated the patch to use this. > In general, I would prefer to avoid relying on timestamps at all, but I a= m not > sure if it is possible to implement in elisp with reasonable efforts. The= idea > is to save into file header a hash of content (or a random number). To ch= eck > if file has not been modified, just header is read at first. If hash does= not > match the value stored in memory then it is necessary to read the whole f= ile. The current approach is certainly sub-optimal, but it=E2=80=99s also simple= and unlikely to cause any issues in practice. > Another point that I am unsure is if Emacs ensures file locks. If one ema= cs > process writes disk cache file then attempts to read the same file by oth= er > emacs instances must be postponed. I=E2=80=99m not sure, but you=E2=80=99d need two Emacs instances to try rea= ding/writing the index file at near-/exactly/ the same time, which seems vanishingly unlikel= y. > Cooperation in respect to disk cache would be an improvement, but it may = be > tricky to implement it reliably. We could just write more often and run `org-persist--merge-index-with-disk'= with some heuristic during operation (if the file is unmodified since it was last checked nothing will happen). However, I think that=E2=80=99s probably best= left to another conversation =E2=80=94 let=E2=80=99s not allow perfect to be the en= emy of good here =F0=9F=99=82. All the best, Timothy --=20 Timothy (=E2=80=98tecosaur=E2=80=99/=E2=80=98TEC=E2=80=99), Org mode contri= butor. Learn more about Org mode at . Support Org development at , or support my work at . --=-=-=--