On 03/15/2012 09:11 PM, Aidan Rowe wrote:
Any possible updates on this? It seems at some point the man pages changed from using INSERTs and UPDATEs to only using INSERTS.
I'm guessing here, but I suspect the problem with doing UPDATEs is that they noop if the row isn't present. This can happen if an Accounting-Start packet gets dropped and fails its retransmit for example. This is not a problem if you just do INSERTs. The "sql" module (driven either synchronously, or asynchronously via buffered detail files / SQL) handles this differently for this exact reason - it does an UPDATE and if no rows are changed, does an INSERT instead. FWIW we use sql_log and just INSERT to a log table, and a trigger on the table then does the "UPDATE or INSERT" magic. We never moved to using buffered SQL because we need to stream the auth logs as well as the accounting logs (long story) and I couldn't see a way to do that.