rlm_sql_log. accounting and locking

Nicolas Baradakis nbk at sitadelle.com
Sat Dec 8 00:08:41 CET 2007


Phil Mayers wrote:

> The rlm_sql_log module only logs a single query; unlike the main sql 
> module which (for accounting) will do an update or insert if not found.
> 
> How, if at all, are people merging the rows? Triggers? Post-processing?

Indeed rlm_sql_log executes a single SQL statement. However you could
use more complex statements than the config example. For example you
have the "INSERT ... ON DUPLICATE KEY UPDATE" syntax since MySQL 4.1
or stored procedures since MySQL 5.0.

> Also, I doubt it will be an issue, but just wanted to check; is the 
> flock() of the file likely to cause any contention issues? Is there an 
> easy way of hashing the NAS-IP-Address to writing to 26 files named 
> "sql-log-[a-z]" and asking radsqlrelay to replay them all?

Don't worry too much about the lock. rlm_sql_log is locking the "sql-relay"
file and radsqlrelay is locking "sql-relay.work" therefore the lock should
never block. It's only there to catch a corner case where the file is
renamed before rlm_sql_log finishes writing.

I note rlm_sql_log and radsqlrelay are interacting exactly the same way
as rlm_detail and radrelay do.

-- 
Nicolas Baradakis




More information about the Freeradius-Users mailing list