Hi Thomas,

> you can use strace to see what SQL statements are issued:
> 
> strace -s 100 -a 160 -e trace=sendto dbmail-util  -v -y -dp
> 
> will give you something like this:
> 
> ....
> Deleting messages with DELETE status...
> sendto(3, "Q\0\0\0%SET statement_timeout TO 300000;\0", 38,
> MSG_NOSIGNAL, NULL, 0)
>                             = 38
> sendto(3, "Q\0\0\0\27BEGIN TRANSACTION;\0", 24, MSG_NOSIGNAL, NULL, 0)
> 
>                 = 24
> sendto(3, "Q\0\0\0/DELETE FROM dbmail_messages WHERE status=3\0", 48,
> MSG_NOSIGNAL, NULL, 0)
>                   = 48
> sendto(3, "Q\0\0\0\30COMMIT TRANSACTION;\0", 25, MSG_NOSIGNAL, NULL, 0)
> 
>                 = 25
> sendto(3, "Q\0\0\0#SET statement_timeout TO 3000;\0", 36, MSG_NOSIGNAL,
> NULL, 0)
>                 = 36
> Ok. Messages deleted.
> 
> Setting DELETE status for deleted messages...
> sendto(3, "Q\0\0\0%SET statement_timeout TO 300000;\0", 38,
> MSG_NOSIGNAL, NULL, 0)
>                             = 38
> sendto(3, "Q\0\0\0\27BEGIN TRANSACTION;\0", 24, MSG_NOSIGNAL, NULL, 0)
> 
>                 = 24
> sendto(3, "Q\0\0\0;UPDATE dbmail_messages SET status = 3 WHERE status =
> 2\0", 60, MSG_NOSIGNAL, NULL, 0)
>                 = 60
> sendto(3, "Q\0\0\0\30COMMIT TRANSACTION;\0", 25, MSG_NOSIGNAL, NULL, 0)
> 
>                 = 25
> sendto(3, "Q\0\0\0#SET statement_timeout TO 3000;\0", 36, MSG_NOSIGNAL,
> NULL, 0)
>                 = 36
> Ok. Messages set for deletion.
> Re-calculating used quota for all users...
> sendto(3, "Q\0\0\0%SET statement_timeout TO 300000;\0", 38,
> MSG_NOSIGNAL, NULL, 0)
>                             = 38
> sendto(3, "Q\0\0\1\316SELECT usr.user_idnr, SUM(pm.messagesize),
> usr.curmail_size FROM dbmail_users usr LEFT JOIN dbm"..., 463,
> MSG_NOSIGNAL, NULL, 0)          = 463
> sendto(3, "Q\0\0\0#SET statement_timeout TO 3000;\0", 36, MSG_NOSIGNAL,
> NULL, 0)
>                 = 36
> Ok. Used quota updated for all users.
> ....
> 
> so what i did was check the status field in dbmail_messages before
> deleting,
> -) after deleting (in thunderbird) => status 2
> -)  then after running dbmail-util to mark the deleted messages =>
> status 2->3
> -) after dbmail-util pruning => messages are gone
> 
> so it seems to work here.
> 
> anyway with that strace command you can debug the SQL commands easier
> than setting some logging in the DB (which of course would be for more
> than one executable then).

In fact I was thinking in a way to the SQL executed by -util but the only
way I figured out yet was the sql logs but during work hours it's almost
impossible to retrieve them, and the only change is to get them at very late
hours.

Haven't thinked in strace yet, but thanks for the tip :)
Will do and post.

Thanks,
 

_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to