unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 33005@debbugs.gnu.org
Subject: bug#33005: 27.0.50; Data loss with Gnus registry
Date: Tue, 03 Dec 2019 09:19:30 +0000	[thread overview]
Message-ID: <87lfrtwyu5.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87imn2luz8.fsf@web.de> (Michael Heerdegen's message of "Fri, 29 Nov 2019 13:36:59 +0100")

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> I'd be awfully surprised if it only worked for me -- I'd think we
>> would have seen bug reports by now.
>
> My impressions is: some people may have tried using the registry, but
> most of them gave up, and nearly nobody is using it.
>
>> I still blame your usage of debbugs-gnu :)
>
> I don't.  AFAICT the issue happens with (featurep 'debbugs-gnu) ==> nil
> all the time.

No, I didn't really mean that...

Would you try the attached patch? It leaves gnus-registry-db at nil to
start with, and also removes the root of the double-loading (which was a
problem only because it can potentially be very slow).

Thanks,
Eric

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Continued-fixes-to-gnus-registry-loading.patch --]
[-- Type: text/x-patch, Size: 4845 bytes --]

From ea39e2a7a1969e669c32ef4f883cda357ad144a8 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Tue, 3 Dec 2019 09:12:44 +0000
Subject: [PATCH] Continued fixes to gnus registry loading

* lisp/gnus/gnus-registry.el (gnus-registry-db): Do not initialize
this variable to an empty database, that should only be done for new
databases.
(gnus-registry-load): Remove "force" argument, don't check if the
database is already loaded, as we're only going to load it once.
(gnus-registry-initialize): Either load the db directly, or set up a
hook to do it later.
(gnus-registry-install-hooks): Don't load on
gnus-read-newsrc-el-hook.
---
 lisp/gnus/gnus-registry.el | 70 ++++++++++++++++----------------------
 1 file changed, 30 insertions(+), 40 deletions(-)

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index e6fb382c2f..ff4c640c82 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -340,7 +340,7 @@ gnus-registry-make-db
                   :precious nil
                   :tracked nil)))
 
-(defvar gnus-registry-db (gnus-registry-make-db)
+(defvar gnus-registry-db nil
   "The article registry by Message ID.  See `registry-db'.")
 
 ;; top-level registry data management
@@ -352,40 +352,33 @@ gnus-registry-remake-db
     (gnus-message 4 "Remaking the Gnus registry")
     (setq gnus-registry-db (gnus-registry-make-db))))
 
-(defun gnus-registry-load (&optional force)
-  "Load the registry from the cache file.
-If the registry is already loaded, don't reload unless FORCE is
-non-nil."
+(defun gnus-registry-load ()
+  "Load the registry from the cache file."
   (interactive)
-  (when (or force
-	    ;; The registry is loaded by both
-	    ;; `gnus-registry-initialize' and the read-newsrc hook.
-	    ;; Don't load twice.
-	    (null (eieio-object-p gnus-registry-db)))
-    (let ((file gnus-registry-cache-file))
-      (condition-case nil
-          (gnus-registry-read file)
-	(file-error
-	 ;; Fix previous mis-naming of the registry file.
-	 (let ((old-file-name
-		(concat (file-name-sans-extension
-			 gnus-registry-cache-file)
-			".eioio")))
-	   (if (and (file-exists-p old-file-name)
-		    (yes-or-no-p
-		     (format "Rename registry file from %s to %s? "
-			     old-file-name file)))
-	       (progn
-		 (gnus-registry-read old-file-name)
-		 (setf (oref gnus-registry-db file) file)
-		 (gnus-message 1 "Registry filename changed to %s" file))
-	     (gnus-registry-remake-db t))))
-	(error
-	 (gnus-message
-          1
-          "The Gnus registry could not be loaded from %s, creating a new one"
-          file)
-	 (gnus-registry-remake-db t))))))
+  (let ((file gnus-registry-cache-file))
+    (condition-case nil
+        (gnus-registry-read file)
+      (file-error
+       ;; Fix previous mis-naming of the registry file.
+       (let ((old-file-name
+	      (concat (file-name-sans-extension
+		       gnus-registry-cache-file)
+		      ".eioio")))
+	 (if (and (file-exists-p old-file-name)
+		  (yes-or-no-p
+		   (format "Rename registry file from %s to %s? "
+			   old-file-name file)))
+	     (progn
+	       (gnus-registry-read old-file-name)
+	       (setf (oref gnus-registry-db file) file)
+	       (gnus-message 1 "Registry filename changed to %s" file))
+	   (gnus-registry-remake-db t))))
+      (error
+       (gnus-message
+        1
+        "The Gnus registry could not be loaded from %s, creating a new one"
+        file)
+       (gnus-registry-remake-db t)))))
 
 (defun gnus-registry-read (file)
   "Do the actual reading of the registry persistence file."
@@ -1178,13 +1171,12 @@ gnus-registry-initialize
   (gnus-message 5 "Initializing the registry")
   (gnus-registry-install-hooks)
   (gnus-registry-install-shortcuts)
-  (gnus-registry-load))
+  (if (gnus-alive-p)
+      (gnus-registry-load)
+    (add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-load)))
 
-;; FIXME: Why autoload this function?
-;;;###autoload
 (defun gnus-registry-install-hooks ()
   "Install the registry hooks."
-  (interactive)
   (setq gnus-registry-enabled t)
   (add-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
   (add-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
@@ -1192,13 +1184,11 @@ gnus-registry-install-hooks
   (add-hook 'nnmail-spool-hook 'gnus-registry-spool-action)
 
   (add-hook 'gnus-save-newsrc-hook 'gnus-registry-save)
-  (add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-load)
 
   (add-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids))
 
 (defun gnus-registry-unload-hook ()
   "Uninstall the registry hooks."
-  (interactive)
   (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
   (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
   (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action)
-- 
2.24.0


  reply	other threads:[~2019-12-03  9:19 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 13:24 bug#33005: 27.0.50; Data loss with Gnus registry Michael Heerdegen
2018-10-10 14:56 ` Eric Abrahamsen
2018-10-10 15:17   ` Michael Heerdegen
2018-10-10 16:08     ` Eric Abrahamsen
2018-10-10 20:23       ` Michael Heerdegen
2018-10-10 21:24       ` Michael Heerdegen
2018-10-10 23:05         ` Eric Abrahamsen
2018-10-11 12:44           ` Michael Heerdegen
2018-10-11 13:10             ` Michael Heerdegen
2018-10-11 18:12               ` Eric Abrahamsen
2018-10-11 20:28                 ` Michael Heerdegen
2018-10-11 22:09                   ` Eric Abrahamsen
2018-10-11 22:20                     ` Michael Heerdegen
2018-10-11 22:26                       ` Eric Abrahamsen
2018-10-12 14:22                     ` Michael Heerdegen
2018-10-12 16:57                       ` Eric Abrahamsen
2018-10-11 18:53           ` Eli Zaretskii
2018-10-11 18:57             ` Eric Abrahamsen
2018-10-11 20:08             ` Michael Heerdegen
2018-10-12  4:24               ` Eli Zaretskii
2018-10-12 11:04                 ` Michael Heerdegen
2018-10-12 12:51                   ` Eli Zaretskii
2018-10-12 14:46           ` Michael Heerdegen
2018-10-12 16:58             ` Eric Abrahamsen
2019-09-24  1:35             ` Michael Heerdegen
2019-09-24  3:34               ` Eric Abrahamsen
2019-10-01 23:37                 ` Eric Abrahamsen
2019-10-14  9:53                   ` Michael Heerdegen
2019-10-14 17:51                     ` Eric Abrahamsen
2019-10-15 14:28                       ` Michael Heerdegen
2019-10-15 20:11                         ` Eric Abrahamsen
2019-10-16  9:03                           ` Michael Heerdegen
2019-10-16 15:46                             ` Eric Abrahamsen
2019-10-17  8:21                               ` Michael Heerdegen
2019-10-17 15:53                                 ` Eric Abrahamsen
2019-10-18  9:18                                   ` Michael Heerdegen
2019-10-18 14:44                                     ` Michael Heerdegen
2019-10-19  2:05                                       ` Phil Sainty
2019-10-19 14:31                                         ` Michael Heerdegen
2019-10-19 22:12                                           ` Phil Sainty
2019-10-26  8:02                                             ` Michael Heerdegen
2019-10-26 15:35                                               ` Eric Abrahamsen
2019-11-18  9:17                                                 ` Phil Sainty
2019-10-18 14:46                                     ` Michael Heerdegen
2019-10-18 19:07                                       ` Eric Abrahamsen
2019-10-18 19:09                                       ` Eric Abrahamsen
2019-10-18 19:23                                         ` Michael Heerdegen
2019-10-18 19:24                                           ` Eric Abrahamsen
2019-10-19 14:25                                             ` Michael Heerdegen
2019-10-19 18:06                                               ` Eric Abrahamsen
2019-10-18 19:06                                     ` Eric Abrahamsen
2019-10-16  9:30                           ` Michael Heerdegen
2019-10-16 15:49                             ` Eric Abrahamsen
2019-10-17  8:32                               ` Michael Heerdegen
2019-10-17 10:23                                 ` Michael Heerdegen
2019-10-17 15:54                                   ` Eric Abrahamsen
2019-10-18  3:08                             ` Richard Stallman
2019-10-18  9:50                               ` Michael Heerdegen
2019-11-26  0:17 ` Michael Heerdegen
2019-11-26  0:51   ` Eric Abrahamsen
2019-11-26 16:32     ` Michael Heerdegen
2019-11-26 18:45       ` Eric Abrahamsen
2019-11-26 20:08         ` Michael Heerdegen
2019-11-26 20:41           ` Eric Abrahamsen
2019-11-26 20:45             ` Michael Heerdegen
2019-11-26 20:48               ` Eric Abrahamsen
2019-11-26 20:54                 ` Michael Heerdegen
2019-11-28  8:43                   ` Eric Abrahamsen
2019-11-28 16:25                     ` Michael Heerdegen
2019-11-28 23:55                       ` Eric Abrahamsen
2019-11-29 12:36                         ` Michael Heerdegen
2019-12-03  9:19                           ` Eric Abrahamsen [this message]
2019-12-04 16:10                             ` Michael Heerdegen
2019-12-04 17:26                               ` Eric Abrahamsen
2019-12-04 20:41                                 ` Michael Heerdegen
2019-12-04 20:53                                   ` Eric Abrahamsen
2019-12-04 21:02                                     ` Michael Heerdegen
2019-12-04 21:16                                       ` Eric Abrahamsen
2019-12-04 21:51                                         ` Michael Heerdegen
2019-12-05  0:51                                           ` Eric Abrahamsen
2019-12-08 15:48                                             ` Michael Heerdegen
2019-12-08 20:52                                               ` Eric Abrahamsen
2019-12-09 19:38                                                 ` Michael Heerdegen
2019-12-09 22:29                                                   ` Eric Abrahamsen
2019-12-09 23:07                                                     ` Michael Heerdegen
2019-12-10  0:24                                                       ` Eric Abrahamsen
2019-12-10  2:30                                                         ` Michael Heerdegen
2019-12-10 23:31                                                           ` Eric Abrahamsen
2019-12-15 17:07                                                             ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfrtwyu5.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=33005@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).