Re: [exim] domainlist & mysql

Pàgina inicial
Delete this message
Reply to this message
Autor: Stephen Gran
Data:  
A: exim-users
Assumpte: Re: [exim] domainlist & mysql
On Sun, Oct 17, 2004 at 11:34:52PM -0400, Wakko Warner said:
> > domainlist virt_domains = mysql; select distinct domain from Virtusers
>
> That won't work. When you use <lookup>;query like you're doing, it is only
> looking for a "yes" or "no" answer (1 or more rows returned = yes, none =
> no). As long as you have 1 row in Virtusers, it is always true.


That helps a lot, thanks.

> > Trying this:
> > domainlist virt_domains = mysql; select distinct domain from Virtusers \
> >                           where domain = '$domain'

> >
> > works fine, but is more overhead than I would like, since it does not
> > cache the entire domain list. If I dump the domains to a file, it does
> > read the whole list and cache it just fine, so this leads me to the
> > inevitable conclusion I am just doing somethign stupid.
>
> Again, it's the same thing, but be careful, because if you do checking on a
> sender, $domain is going to be the recipient's domain, NOT the sender's
> domain.
>
> I sucessfully did this at work using something like this:
> domainlist doms = ${lookup mysql{select name from domains}{$sg{$value}{ *\\n}{:}}fail}


Just for the record, it was:
domainlist virt_domains = ${lookup mysql{select distinct domain from Virtusers}{${sg{$value}{ *\\n}{:}}}fail}
(extra {} - always gets me too :)

> You might want to double check the syntax, I am not looking at the config I
> used nor the spec. IIRC it does cache this!


It appears to, but only for the first address lookup. In other words,
I have a list of domains that contain no real users - they all undergo
alias expansion and are remailed elsewhere to real email addresses (that
may then be forwarded again for all I know, but I'm just doing this hop).
When I try an address, say foo@???, it gets looked up in SQL, and
then later, when a routing decision is made based on +virtual_domains,
it uses the cached lookup. After alias expansion to bar@??? occurs
in that redirect router, however, and it is routing the second address,
exim has to make a new query - the results of the old aren't cached
any more. Now I have to decide which kind of lookup is less overhead :)
Since the connection is cached, I am betting multiple single key lookups
is better than two big ones here.

Thanks for the help,
--
--------------------------------------------------------------------------
|  Stephen Gran                  | Would you care to view the ruins of my  |
|  steve@???             | good intentions?                        |
|  http://www.lobefin.net/~steve |                                         |

--------------------------------------------------------------------------