[Devel] [ openser-Feature Requests-1581172 ] table names for ACC module

SourceForge.net noreply at sourceforge.net
Sat Oct 21 22:37:35 CEST 2006


Feature Requests item #1581172, was opened at 2006-10-20 12:54
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743023&aid=1581172&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Victor Gamov (vitspec)
Assigned to: Nobody/Anonymous (nobody)
Summary: table names for ACC module

Initial Comment:
ACC module utilize only one table `acc' to save
accounting info now.

But it's may be very useful in some situations (to
produce CDR-records periodically for example) if we can
write accounting info into different tables changed
periodically by the time principle.

I propose to use meta-characters in table-name
parameter for this purpose. We can use meta-characters
like strftime() for example, so if we have something like 

modparam("acc", "db_table_acc", "myacc_table-%Y-%m-%d")

in config file then we will get one accounting table
per day.

One complexity which I see now -- we must have CREATE
TABLE statement in OpenSER.  But if OpenSER write
accounting into some external database.table (not
default openser.acc) external process can create this
table or (more correctly) we can have one more ACC
module parameter like "db_table_acc_create" and use it
as SQL statement to create table.


----------------------------------------------------------------------

>Comment By: Bogdan (bogdan_iancu)
Date: 2006-10-21 23:37

Message:
Logged In: YES 
user_id=1275325

Victor wrote:

<quote>
Yes, it's my opinion too: in this world we must do
everything simple :-)

But it's not good idea to write sheel script to rotate
tables and that is why.
If I use SQL-statements like

CREATE new_acc_table ...
INSERT INTO new_acc_table SELECT * FROM acc
TRUNCATE acc

I need to place LOCK acc and new_acc_table before this
tatements and UNLOCK after and proxy can not write into acc
during this time. Not good idea.

If I use
ALTER TABLE acc RENAME new_acc_table (or RENAME acc TO
new_acc_table)
then we cannot have any locked tables or active transactions
at this time.  It's may be problem for proxy too.
</quote>


Bogdan wrote:

actually is not necessary - there are other options like:
1) use a column with ordered values to take a marker before
doing the rotation:
  SELECT max(timestamp) FROM acc;
2) move in a different table all records older thant the marker:
  CREATE new_acc_table ...
  INSERT INTO new_acc_table SELECT * FROM acc WHERE
timestamp<=marker
3) deletem them
  DELETE FROM acc WHERE timestamp<=marker;

so, you do no need ant changes in openser, neither any
locking on the table :)

is this resonable for you?

regards,
bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743023&aid=1581172&group_id=139143



More information about the Devel mailing list