[tpop3d-discuss]Re: tpop3d+Exim with hashed maildir directories

Dom Gallagher dgallagher at starnetusa.net
Tue, 01 Jun 2004 12:05:25 -0500

At 06:00 AM 5/31/2004, tpop3d-discuss-request@lists.beasts.org wrote:
>What we've done here is assign each user their own unique uid, which most
>other places do as well.  The hashing scheme we used was as follows:
><some base dir>/<last 2 digits of uid>/<2 digits before the last 2 of the 
>uid,0 padded>/uid<uid>/mail/
>This is a little hard to understand, so an example is about the only useful
>way of describing the above.
>Let's say my uid is 500.  Using the above hashing method, my maildir spool 
>would be at '/var/spool/mail/00/05/uid500/mail/'.  If my uid was 32768, 
>the maildir would be '.../68/27/uid32768/mail/'.  Using some quick math 
>calculations and LPAD in MySQL, this hashing scheme was pretty easy to setup.

That's very cool; it limits the number of hashed directories to 100x100, 
whilst still scaling (and keeping even distribution) as far up as you 
need.  How many users have you tested this with?

>One benefit to using the uid is if someone wants to change their username, 
>they will still be able to retrieve all of their email that was delivered 
>to their old address, without having someone login and move the mail around.

Interesting idea, and a definite advantage.  Are the user ID to 
username/domain mappings kept on the same machine?  If not, how do you deal 
with syncing issues?

Dom Gallagher (dgallagher@starnetusa.net)
Development Engineering
StarNet/MegaPOP - http://www.megapop.net

This message is sent in confidence to the addressees.
It may contain privileged, proprietary, or confidential information.