Re: [exim] Trim down pgsql callouts

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Sam Smith
Date:  
À: Graeme Fowler
CC: exim-users
Sujet: Re: [exim] Trim down pgsql callouts
Thank you, Graeme and David for your help.
Excuse my impatience earlier - we've just been stumped by this little
problem, and were hoping someone fairly knowledgeable would be able to
point out the error!

I have run what you recommended, Graeme, except that when I ran the
command and pipe below, nothing was output when I sent the message.

So I ran the command exim joseph@??? 2>&1| tee /path/to/logfile

and this is what I get as far as pgsql lookups:

search_open: pgsql "NULL"
search_find: file="NULL"
  key="select mailbox,username,uid from mailtest where
  username='joseph'" partial=-1 affix=NULL starflags=0
  LRU list:
  internal_search_find: file="NULL"
    type=pgsql key="select mailbox,username,uid from mailtest where
    username='joseph'"
    database lookup required for select mailbox,username,uid from
    mailtest where username='joseph'
    PGSQL query: select mailbox,username,uid from mailtest where
    username='joseph'
    PGSQL new connection: host=127.0.0.1 port= database=testdb user=root
    lookup yielded: mailbox=/home/joseph/mail username=joseph uid=1004
    joseph in "joseph"? yes (matched "joseph")


But then this part is repeated 3 times in the log file, and postgres'
log indicates 3 lookups.

Here is an excerpt of the postgres log:

2008-07-09 21:56:21 BST LOG: duration: 0.252 ms statement: set
client_encoding to 'SQL_ASCII'
2008-07-09 21:56:21 BST LOG: duration: 1.992 ms statement: select
mailbox,username,uid from mailtest where username='joseph'
2008-07-09 21:56:21 BST LOG: duration: 0.228 ms statement: set
client_encoding to 'SQL_ASCII'
2008-07-09 21:56:21 BST LOG: duration: 1.982 ms statement: select
mailbox,username,uid from mailtest where username='joseph'
2008-07-09 21:56:21 BST LOG: duration: 0.232 ms statement: set
client_encoding to 'SQL_ASCII'
2008-07-09 21:56:21 BST LOG: duration: 2.106 ms statement: select
mailbox,username,uid from mailtest where username='joseph'

This is all a test setup, so there is no confidential information in the
log displays.

Regarding what you mentioned, David, I think I'm only running one exim
process (just on one server), but forgive my ignorance if I got that
wrong.

Thanks again for your help.

On Wed, Jul 09, 2008 at 07:37:41PM +0100, Graeme Fowler wrote:
> Hi
>
> On Wed, 2008-07-09 at 17:10 +0100, Sam Smith wrote:
> > Any help with this please?
>
> You'll need to use "exim -d" and a set of appropriate options to see
> what's going on here. Probably the easiest way to do this would to be to
> stop Exim then run "exim -bd -d" and then send a message to the machine
> which would cause the router in question to be triggered.
>
> If you want to capture the debug, do it like this:
>
> exim -bd -d 2>&1 | tee /path/to/file-you-want-to-save-as
>
> (And yes, there are many other ways to do this!)
>
> Once you've done it, look through the debug output to see if you can
> fathom what's going on - it should show the DB lookups something like
> this:
>
> 1834 type=mysql key="SELECT home FROM maildata WHERE
> name='graeme@???' limit 1"
> 1834 database lookup required for SELECT home FROM maildata WHERE
> name='graeme@???' limit 1
> 1834 MySQL query: SELECT home FROM maildata WHERE
> name='graeme@???' limit 1
> 1834 MYSQL new connection: [connection data removed]
> 1834 lookup yielded: /var/spool/path/to/graeme
>
> [other things happen]
>
> 1834 cached data used for lookup of SELECT home FROM passwd WHERE
> name='graeme@???' limit 1
>
> In this case as the message traverses other routers a total of three
> identical lookups are done, two of which are pulled from the cache.
> (Other lookups also happen, which makes me realise I could optimise this
> a little by using the "extract" operator).
>
> Make sure you also understand what happens with redirect routers - if
> the message is processed by a redirect router, it starts the chain again
> and may then cause non-cached lookups. I'd have to re-read the caching
> code to see if the cached entry would be invalidated under those
> conditions.
>
> So: use "-d" and see what you get. If you don't understand, post the
> output (but be careful not to post your database username/password).
>
> Graeme
>
>
> --
> ## List details at http://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/