cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
544 stars 149 forks source link

relocate_by_id - fatal error: Unknown meta file requested #4848

Open Devstellar opened 7 months ago

Devstellar commented 7 months ago

Today I migrated some servers from 3.4 to 3.6.... all ok. But, trying to use relocate_by_id to migrate any mailboxes to uuid storage is not working and I can't understand why.

Example: relocate_by_id 'user/aaaaa.bbbb@domain.com'

Relocating: user/aaaaa.bbbb/web Gres@domain.com fatal error: Unknown meta file requested

Devstellar commented 7 months ago

Seems related to issue #4409 but my configure is not "bare".

Mar 16 21:10:19 local6:debug relocate_by_id: relocate_by_id[2501774]: requested meta partition directory for unknown partition 'default'

Version is 3.6.4

In imapd.conf:

configdirectory: /cyrimap
defaultpartition: default
partition-default: /cyrimap/part1

Looking for meta:

# cyr_info conf-all -C /etc/imapd.conf -M /etc/cyrus | grep -i meta
metapartition_files:
sieve_extensions: fileinto reject vacation vacation-seconds notify include envelope environment body relational regex subaddress copy date index imap4flags imapflags mailbox mboxmetadata servermetadata variables editheader extlists duplicate ihave fcc special-use redirect-dsn redirect-deliverby mailboxid vnd.cyrus.log x-cyrus-log vnd.cyrus.jmapquery x-cyrus-jmapquery vnd.cyrus.imip snooze vnd.cyrus.snooze x-cyrus-snooze
elliefm commented 7 months ago

Mar 16 21:10:19 local6:debug relocate_by_id: relocate_by_id[2501774]: requested meta partition directory for unknown partition 'default'

I think that log message is misleading, it's not that the partition 'default' is unknown, you just don't have a meta partition for that partition, which should be okay.

fatal error: Unknown meta file requested

That's the real problem, it's asked for a metafile that it doesn't recognise

Can you apply a patch, rebuild, and try again? If so, this patch will make it log the bad metafile. What number does it log?

diff --git a/imap/mboxname.c b/imap/mboxname.c
index 2f048c2d0..1f4271412 100644
--- a/imap/mboxname.c
+++ b/imap/mboxname.c
@@ -2163,6 +2163,7 @@ EXPORTED char *mboxname_metapath(const char *partition,
     case 0:
         break;
     default:
+        syslog(LOG_ERR, "Unknown meta file requested: %d", metafile);
         fatal("Unknown meta file requested", EX_SOFTWARE);
     }
Devstellar commented 7 months ago

Can you apply a patch, rebuild, and try again? If so, this patch will make it log the bad metafile. What number does it log?

Done: 7

Mar 18 05:55:16 local6:debug relocate_by_id: relocate_by_id[3309087]: requested meta partition directory for unknown partition 'default'
Mar 18 05:55:16 local6:err relocate_by_id: relocate_by_id[3309087]: Unknown meta file requested: 7
elliefm commented 7 months ago

Ah.h -- 7 is META_DAV, which is conditional in this switch statement in 3.6.

Looks like your 3.6 build was configured without --enable-http, or the build couldn't find sqlite and so disabled all the DAV functionality.

I think usually there wouldn't be any DAV metadata on a server that doesn't have it, so I guess that implies that this server used to have http/dav enabled at some point, probably before you upgraded. If you rebuild with http/dav enabled, that might solve the problem.

You're right that this is related to #4409, and it was fixed in 3.8+ by #4412.

If you don't want to enable http, this commit might get you going on 3.6 without it: https://github.com/cyrusimap/cyrus-imapd/pull/4412/commits/7b8c76f99f23e861450f26d801133ca9fc34a500, which you can get as a patch file here: https://github.com/cyrusimap/cyrus-imapd/commit/7b8c76f99f23e861450f26d801133ca9fc34a500.patch

Does this help?

Devstellar commented 7 months ago

Yes, server is configured without http, but the server has never had it.

The patch worked. I have relocated several mailboxes now without issue.

elliefm commented 7 months ago

Great, thanks for checking that. I'll get that patch included in future releases of 3.6, so you won't need to do the same thing next time you upgrade :)