[Mod_log_sql] Bug#425027: I need to know if using MySQL or pgsql for my score board patch and pgsql

Thomas Goirand thomas at goirand.fr
Fri May 25 11:46:08 EDT 2007


James Cloos wrote:
> The original, mysql-specific query he used is:
> 
> ,----
> | insert ignore into %s (domain,vhost,month,year,count_impressions)
> |        values ('%s','%s','%s','%s','0')
> `----
> 
> I discovered that this works on postgres, w/o having to change any of
> the rest of his patch:
> 
> ,----
> | begin;insert into %s (domain,vhost,month,year,count_impressions)
> |       values ('%s','%s',%s,%s,0);commit
> `----
> 
> Ie, s/insert ignore/insert/ and wrap in a transaction.

Hi!

I tried to to this with the MySQL backend driver, and unfortunately,
mod_log_sql was returning an error in the apache error.log. I was
surprised about it as the MySQL documentation said that it should work.

> Also, you may want to use global_config.driver->insert() instead of
> using safe_sql_insert() to execute the insert.  I've not investigated
> the differences, so I cannot be sure, though.

The advantage of safe_sql_insert() is that when it fails, the query goes
in a preserve file. Later, when the insert works again, then this file
is read and the insert statements are commited. I have found this very
nice, the only "problem" that I found is that this file is writen in
/etc while I think it should have been write somewhere in /var, possibly
in /var/lib/mod_log_sql. I think I should patch mod_log_sql to act like
this, and create the /var/lib/mod_log_sql folder in my debian packaging.
Currently, the package doesn't create the folder in /etc/apache2 so it
just writes in the error.log that writing in the preserve file didn't
work. Somebody could even have written a bug report about this issue, I
just didn't had the time to patch mod_log_sql to correct this yet.

Edward: do you think it would be possible that future versions of
mod_log_sql writes in /var rather than in /etc to be compliant with the
filesystem standards?

Also for Edward: I would have love to take the advantage of the new
thing you did in mod_log_sql 1.101 so my score_board patch could
calculate bytes out AND bytes in. Would you have time to help me to
write this, and support that new 1.101 (if not write it)? I'm currently
working on some other things (virtual private server statistics for I/O,
network and CPU inside our control panel) that we are in a hurry to
finish...

Thomas



More information about the Mod_log_sql mailing list