Re: SQL Accounting... ¿Negative?

Alan DeKok aland at deployingradius.com
Wed Sep 4 16:45:27 CEST 2019


On Sep 4, 2019, at 10:43 AM, Gabriel Trabanco Llano <gabriel at trabanco.soy> wrote:
> I do not manipulate the original table, it has the original information from the FR.

  That's good.

> As far as I can see and I know of database for me when I saw the FR source code is rewrite the total amount of sessiontime, data input/output… So If in the trigger I rest:
> 		new_value - old_value
> 
> So it should contain the difference and I am writing the amount by hours in other table. Why sometimes this value is negative? For my as far as I can see there is not such a way where this value could be negative… Just in the case the NAS is bugged.

  RADIUS packets can come out of order.

  My $0.02 is to skip using a trigger.  Just run a stored procedure at the end of the billing cycle to copy the data to another table.  Then, run another stored procedure to do the "diffs" in usage between billing cycles.

  That way you're operating on the *data* and not on the *RADIUS packets*.  It's much safer.

  Alan DeKok.




More information about the Freeradius-Users mailing list