[Dovecot] Doveadm search in public namespaces
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Say I want to create a script to perform some 'doveadm' tasks. Is there any particular reason why "mailbox-guids" would not work for public namespaces?
Let's search something to play with:
$ doveadm search sentbefore 01-jan-2011 mailbox "Public/Mailing-Lists/Dovecot" adeffe1c8b7ba64bb3770000a998a2df 1021 […]
Trying to fetch headers using mailbox-guids *fails*:
$ doveadm fetch hdr mailbox-guid adeffe1c8b7ba64bb3770000a998a2df uid 1021
…while it works using mailbox name:
$ doveadm fetch hdr mailbox Public/Mailing-Lists/Dovecot uid 1021
Seems odd.
Regards Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
iEYEARECAAYFAk0XSf8ACgkQ+meF/S97aXjqggCbBAL+FFTmHRXwuxLX46vYFclr 42UAn0dSEwvUzZUy8QU/Pvux+UzVdRlB =vWk6 -----END PGP SIGNATURE-----
On Sun, 2010-12-26 at 14:58 +0100, Thomas Leuxner wrote:
Say I want to create a script to perform some 'doveadm' tasks. Is there any particular reason why "mailbox-guids" would not work for public namespaces?
Am 30.12.2010 um 11:41 schrieb Timo Sirainen:
On Sun, 2010-12-26 at 14:58 +0100, Thomas Leuxner wrote:
Say I want to create a script to perform some 'doveadm' tasks. Is there any particular reason why "mailbox-guids" would not work for public namespaces?
Did some tests with the fix, not sure it works correct/as expected:
$ time doveadm fetch -u user@domain.tld hdr mailbox Public/Mailing-Lists/Dovecot uid 1039 real 0m0.053s
$ time doveadm fetch -u user@domain.tld hdr mailbox-guid adeffe1c8b7ba64bb3770000a998a2df uid 1039 real 0m0.418s
It takes considerably longer when using 'mailbox-guid' compared to mailbox name, wonder why that is…
I'm also not sure why it would recursively mangle all 'dovecot-uidlist' files within the namespace (it does in a public maildir namespace). This is really dangerous when missing the proper -u parameter. Say you run it as 'root' and it should be run by 'vmail' really, then effectively all 'dovecot-uidlist' files will be owned by the wrong user afterwards… (root vs. vmail).
Regards Thomas
On Thu, 2010-12-30 at 13:25 +0100, Thomas Leuxner wrote:
Did some tests with the fix, not sure it works correct/as expected:
$ time doveadm fetch -u user@domain.tld hdr mailbox Public/Mailing-Lists/Dovecot uid 1039 real 0m0.053s
$ time doveadm fetch -u user@domain.tld hdr mailbox-guid adeffe1c8b7ba64bb3770000a998a2df uid 1039 real 0m0.418s
It takes considerably longer when using 'mailbox-guid' compared to mailbox name, wonder why that is…
It's because there is no easy way to access mailbox GUIDs, so it has to open each mailbox and get its GUID.
I'm also not sure why it would recursively mangle all 'dovecot-uidlist' files within the namespace (it does in a public maildir namespace).
The mailbox GUID is stored in dovecot-uidlist file. If the mailbox doesn't already have a GUID, it's added there.
This is really dangerous when missing the proper -u parameter. Say you run it as 'root' and it should be run by 'vmail' really, then effectively all 'dovecot-uidlist' files will be owned by the wrong user afterwards… (root vs. vmail).
Well, I'm not really sure what to do about this.. Maybe it should refuse to run as root, but maybe some people actually want to do that..
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 30.12.2010 um 13:43 schrieb Timo Sirainen:
It takes considerably longer when using 'mailbox-guid' compared to mailbox name, wonder why that is…
It's because there is no easy way to access mailbox GUIDs, so it has to open each mailbox and get its GUID.
Right. I wanted to use the GUIDs because they are spit out on searches. Guess will have to use names then if faster.
$ doveadm search -u user@domain.tld sentbefore 02-jan-2010 mailbox Public/Mailing-Lists/Dovecot adeffe1c8b7ba64bb3770000a998a2df 1021 […]
I'm also not sure why it would recursively mangle all 'dovecot-uidlist' files within the namespace (it does in a public maildir namespace).
The mailbox GUID is stored in dovecot-uidlist file. If the mailbox doesn't already have a GUID, it's added there.
So if the mailbox would have a current index it would not rebuild it? In other words: Wouldn't the Dovecot Mailing-List be current as it gets updated on every new post presumably? It was also rebuilt... -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
iEYEARECAAYFAk0cgY4ACgkQ+meF/S97aXjpaQCgij5J0UpnLa/xNyVzOiqMzMdl PAUAn0o/Mtxj6ANM3PK6GjgP0SyqANvP =LTfL -----END PGP SIGNATURE-----
On Thu, 2010-12-30 at 13:56 +0100, Thomas Leuxner wrote:
It's because there is no easy way to access mailbox GUIDs, so it has to open each mailbox and get its GUID.
Right. I wanted to use the GUIDs because they are spit out on searches. Guess will have to use names then if faster.
Maybe some day mailbox list indexes are created and they offer fast access to GUIDs.
The mailbox GUID is stored in dovecot-uidlist file. If the mailbox doesn't already have a GUID, it's added there.
So if the mailbox would have a current index it would not rebuild it? In other words: Wouldn't the Dovecot Mailing-List be current as it gets updated on every new post presumably? It was also rebuilt...
The mailbox GUID isn't generated until it's requested for the first time. Only dsync and doveadm request it.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 30.12.2010 um 14:07 schrieb Timo Sirainen:
The mailbox GUID isn't generated until it's requested for the first time. Only dsync and doveadm request it.
It gets rewritten on every search in my setup. As I did searches before it should have a GUID, right?
[14:09] root spectre:/# l /var/vmail/public/Mailing-Lists/Dovecot/dovecot-uidlist
- -rw------- 1 vmail vmail 680204 Dec 30 14:09 /var/vmail/public/Mailing-Lists/Dovecot/dovecot-uidlist
[14:10] root spectre:/# doveadm search -u user@domain.tld sentbefore 02-jan-2010 mailbox Public/Mailing-Lists/Dovecot adeffe1c8b7ba64bb3770000a998a2df 1021 […]
[14:10] root spectre:/# l /var/vmail/public/Mailing-Lists/Dovecot/dovecot-uidlist
- -rw------- 1 vmail vmail 680204 Dec 30 14:10 /var/vmail/public/Mailing-Lists/Dovecot/dovecot-uidlist
-----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
iEYEARECAAYFAk0chWYACgkQ+meF/S97aXjx4wCglpX3wjN/eSnsw8ptmUws3QJW y2sAn2Dbd5Z7B1ycUSertmzykif/xyav =5WQF -----END PGP SIGNATURE-----
On Thu, 2010-12-30 at 14:13 +0100, Thomas Leuxner wrote:
The mailbox GUID isn't generated until it's requested for the first time. Only dsync and doveadm request it.
It gets rewritten on every search in my setup. As I did searches before it should have a GUID, right?
Bug, fixed: http://hg.dovecot.org/dovecot-2.0/rev/af5903102d38
participants (2)
-
Thomas Leuxner
-
Timo Sirainen