[Dovecot] Dinamic 'mail_location' for each user
Hello,
I have a lot of domains in a mail server, so I make a balanced allocation of mailboxes in the storage disks. That improves performance of access to records. Therefore, I want to overwrite 'mail_location' directive for each user. But I also want to use the modifier 'H' to spray the mailboxes of the same partition in a hash.
Then, each user has your own 'mail_location' that I would like load from database. Like this:
mdbox:/var/spool/imap/partition1/%256HRu/%u:INDEX=/var/lib/imap/user/% 256HRu/%u
partition1 is in range [partition1 .. partiton7]
In my tests the '%256HRu/%u' kind of 'mail_location' is not being interpreted by Dovecot.
Can Dovecot to interpret 'mail_location' load from database ?
Thank you.
[]'s Thiago Henrique Network Administration Digirati Networks K8 Networks
On Thu, 2010-07-15 at 11:29 -0300, Thiago Henrique wrote:
mdbox:/var/spool/imap/partition1/%256HRu/%u:INDEX=/var/lib/imap/user/% 256HRu/%u
Can Dovecot to interpret 'mail_location' load from database ?
You mean your userdb is returning a "mail" field that contains those % variables? No, that won't work. If you're already returning a partial location from userdb, why not just store and return a full path to it permanently?
Em Qui, 2010-07-15 às 20:45 +0100, Timo Sirainen escreveu:
You mean your userdb is returning a "mail" field that contains those % variables? No, that won't work.
It is important for me to spread the mailboxes inside the partition. Use the 'H' modifier for it would be perfect. A patch for this would be accepted?
Thank you.
[]'s Thiago Henrique Network Administration Digirati Networks K8 Networks
On Thu, 2010-07-15 at 17:12 -0300, Thiago Henrique wrote:
Em Qui, 2010-07-15 às 20:45 +0100, Timo Sirainen escreveu:
You mean your userdb is returning a "mail" field that contains those % variables? No, that won't work.
It is important for me to spread the mailboxes inside the partition. Use the 'H' modifier for it would be perfect.
But you can do that yourself when storing the path to database. Build a script that hashes the username path in a way you want, and store that.
A patch for this would be accepted?
I'm still not sure if you mean what I thought you mean. If you mean that % variables would be expanded when they're coming out of userdb then no, it would not be accepted. It would break people's setup who actually have % characters in paths.
Hello,
I understand your argument, although it's not good for me :)
But you can do that yourself when storing the path to database. Build a script that hashes the username path in a way you want, and store that.
I wouldn't like to do this. I have a lot of users and I can't to migrate everything at once. So I can't to make big changes in my code.
I'm still not sure if you mean what I thought you mean. If you mean that % variables would be expanded when they're coming out of userdb then no, it would not be accepted. It would break people's setup who actually have % characters in paths.
You understand correctly, sorry for my poor English.
Anyway, we know that things changes in new versions. Otherwise, would never be
released new variables. I understand your point, but ask you think about
it, so it can be useful for many people.
Thanks
-- []'s Thiago Henrique Network Administration Digirati Networks K8 Networks
On 15/07/2010 21:12, Thiago Henrique wrote:
You mean your userdb is returning a "mail" field that contains those % variables? No, that won't work. It is important for me to spread the mailboxes inside the partition. Use
Em Qui, 2010-07-15 às 20:45 +0100, Timo Sirainen escreveu: the 'H' modifier for it would be perfect. A patch for this would be accepted?
Remember SQL is quite a powerful "language" and your query simply has to return the fields, nobody says that it only needs do a simple SELECT with no functions... If you can use SQL to replace() your magic characters (which don't need to be %H of course) then you can do this bit yourself?
Things like this can be useful in your migration perhaps? Remember in any case that you don't need to move all users at once, eg when migrating between servers you can disable logins for a user, move the directory, update the DB, re-enable logins on a one by one basis?
Good luck
Ed W
participants (3)
-
Ed W
-
Thiago Henrique
-
Timo Sirainen