Re: [SR-Users] Backing up htable to SQL table ...

2012-03-09 Thread Elena-Ramona Modroiu

Hi,

I committed the patch in master branch, but I removed the condition 
'ht_db_expires_flag!=0', because it is used to control if expires column 
is saved in database, nothing else. If I misunderstood something, let me 
know, if not and all works fine for you with the commit, then the patch 
can be backported to 3.2.


Ramona

On 3/8/12 10:38 PM, Krishna Kurapati wrote:

Thanks Daniel for the help. I was looking at other module parameters.
I added this like and tried it again

modparam(htable, htable,xhash=size=8;dbtable=htable;dbmode=1;)

However, it was still not backing up to the database. Seems like there 
is bug when the expiration is not set or

set to 0. I modified the code and it worked.

Here is the change log:

--- a/modules_k/htable/ht_db.c
+++ b/modules_k/htable/ht_db.c
@@ -369,10 +369,12 @@ int ht_db_save_table(ht_t *ht, str *dbtable)
it-name.len, it-name.s, 
it-value.n);

}
-   if (it-expire = now) {
+   if(ht-htexpire  0  ht_db_expires_flag!=0) {
+  if (it-expire = now) {
LM_DBG(skipping expired entry);
it = it-next;
continue;
+  }
}

If this is the right fix for the bug, can someone commit this to the main?

Thanks
Krishna Kura

On Wed, Mar 7, 2012 at 9:48 PM, Krishna Kurapati kkura...@gmail.com 
mailto:kkura...@gmail.com wrote:


Any help on how to backup the htable content to database table?

Thanks


On Tue, Mar 6, 2012 at 5:28 PM, Krishna Kurapati
kkura...@gmail.com mailto:kkura...@gmail.com wrote:

I did little more digging into htable source code. It looks
like syncing to database is happening when the module is being
destroyed.

To see if this is working, I tried to stop Kamailio and looked
into the database. The htable is still empty. Any configuration
changes required to make the process happen?

Thanks
Krish Kura

On Tue, Mar 6, 2012 at 8:38 AM, Krishna Kurapati
kkura...@gmail.com mailto:kkura...@gmail.com wrote:

Hi,

This is my first time attempt using htable module.
How can I back up the htable content in the database
incase the server restarts. I saw a htable in the MySQL
database.
My observation has been that htable module is not
automatically backing up to database even though I added
modparams to point to the database. Do I need to
explicitly backup htable content to database using sqlops
or some
other mechanism?

Thanks
Krish Kura






___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Backing up htable to SQL table ...

2012-03-09 Thread Krishna Kurapati
Ramona.

I pulled and it worked fine. Thanks for your support.

Krish

On Fri, Mar 9, 2012 at 11:10 AM, Elena-Ramona Modroiu ram...@asipto.comwrote:

  Hi,

 I committed the patch in master branch, but I removed the condition
 'ht_db_expires_flag!=0', because it is used to control if expires column is
 saved in database, nothing else. If I misunderstood something, let me know,
 if not and all works fine for you with the commit, then the patch can be
 backported to 3.2.

 Ramona

 On 3/8/12 10:38 PM, Krishna Kurapati wrote:

 Thanks Daniel for the help. I was looking at other module parameters.
 I added this like and tried it again

  modparam(htable, htable,xhash=size=8;dbtable=htable;dbmode=1;)

  However, it was still not backing up to the database. Seems like there
 is bug when the expiration is not set or
 set to 0. I modified the code and it worked.

  Here is the change log:

  --- a/modules_k/htable/ht_db.c
 +++ b/modules_k/htable/ht_db.c
 @@ -369,10 +369,12 @@ int ht_db_save_table(ht_t *ht, str *dbtable)
 it-name.len, it-name.s,
 it-value.n);
 }

 -   if (it-expire = now) {
 +   if(ht-htexpire  0  ht_db_expires_flag!=0) {
 +  if (it-expire = now) {
 LM_DBG(skipping expired entry);
 it = it-next;
 continue;
 +  }
 }


  If this is the right fix for the bug, can someone commit this to the
 main?

  Thanks
 Krishna Kura

  On Wed, Mar 7, 2012 at 9:48 PM, Krishna Kurapati kkura...@gmail.comwrote:

 Any help on how to backup the htable content to database table?

  Thanks


 On Tue, Mar 6, 2012 at 5:28 PM, Krishna Kurapati kkura...@gmail.comwrote:

 I did little more digging into htable source code. It looks like syncing
 to database is happening when the module is being
 destroyed.

  To see if this is working, I tried to stop Kamailio and looked into
 the database. The htable is still empty. Any configuration
 changes required to make the process happen?

  Thanks
 Krish Kura

 On Tue, Mar 6, 2012 at 8:38 AM, Krishna Kurapati kkura...@gmail.comwrote:

 Hi,

  This is my first time attempt using htable module.
 How can I back up the htable content in the database incase the server
 restarts. I saw a htable in the MySQL database.
 My observation has been that htable module is not automatically backing
 up to database even though I added
 modparams to point to the database. Do I need to explicitly backup
 htable content to database using sqlops or some
 other mechanism?

  Thanks
 Krish Kura






 ___
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
 listsr-us...@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Backing up htable to SQL table ...

2012-03-08 Thread Krishna Kurapati
Thanks Daniel for the help. I was looking at other module parameters.
I added this like and tried it again

modparam(htable, htable,xhash=size=8;dbtable=htable;dbmode=1;)

However, it was still not backing up to the database. Seems like there is
bug when the expiration is not set or
set to 0. I modified the code and it worked.

Here is the change log:

--- a/modules_k/htable/ht_db.c
+++ b/modules_k/htable/ht_db.c
@@ -369,10 +369,12 @@ int ht_db_save_table(ht_t *ht, str *dbtable)
it-name.len, it-name.s,
it-value.n);
}

-   if (it-expire = now) {
+   if(ht-htexpire  0  ht_db_expires_flag!=0) {
+  if (it-expire = now) {
LM_DBG(skipping expired entry);
it = it-next;
continue;
+  }
}


If this is the right fix for the bug, can someone commit this to the main?

Thanks
Krishna Kura

On Wed, Mar 7, 2012 at 9:48 PM, Krishna Kurapati kkura...@gmail.com wrote:

 Any help on how to backup the htable content to database table?

 Thanks


 On Tue, Mar 6, 2012 at 5:28 PM, Krishna Kurapati kkura...@gmail.comwrote:

 I did little more digging into htable source code. It looks like syncing
 to database is happening when the module is being
 destroyed.

 To see if this is working, I tried to stop Kamailio and looked into the
 database. The htable is still empty. Any configuration
 changes required to make the process happen?

 Thanks
 Krish Kura

 On Tue, Mar 6, 2012 at 8:38 AM, Krishna Kurapati kkura...@gmail.comwrote:

 Hi,

 This is my first time attempt using htable module.
 How can I back up the htable content in the database incase the server
 restarts. I saw a htable in the MySQL database.
 My observation has been that htable module is not automatically backing
 up to database even though I added
 modparams to point to the database. Do I need to explicitly backup
 htable content to database using sqlops or some
 other mechanism?

 Thanks
 Krish Kura




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Backing up htable to SQL table ...

2012-03-07 Thread Krishna Kurapati
Any help on how to backup the htable content to database table?

Thanks

On Tue, Mar 6, 2012 at 5:28 PM, Krishna Kurapati kkura...@gmail.com wrote:

 I did little more digging into htable source code. It looks like syncing
 to database is happening when the module is being
 destroyed.

 To see if this is working, I tried to stop Kamailio and looked into the
 database. The htable is still empty. Any configuration
 changes required to make the process happen?

 Thanks
 Krish Kura

 On Tue, Mar 6, 2012 at 8:38 AM, Krishna Kurapati kkura...@gmail.comwrote:

 Hi,

 This is my first time attempt using htable module.
 How can I back up the htable content in the database incase the server
 restarts. I saw a htable in the MySQL database.
 My observation has been that htable module is not automatically backing
 up to database even though I added
 modparams to point to the database. Do I need to explicitly backup htable
 content to database using sqlops or some
 other mechanism?

 Thanks
 Krish Kura



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Backing up htable to SQL table ...

2012-03-07 Thread Daniel-Constantin Mierla
Hello,

you have to set dbmode=1 when defining the hash table:

http://kamailio.org/docs/modules/stable/modules_k/htable.html#id2541457

Cheers,
Daniel

On Thu, Mar 8, 2012 at 4:48 AM, Krishna Kurapati kkura...@gmail.com wrote:

 Any help on how to backup the htable content to database table?

 Thanks

 On Tue, Mar 6, 2012 at 5:28 PM, Krishna Kurapati kkura...@gmail.comwrote:

 I did little more digging into htable source code. It looks like syncing
 to database is happening when the module is being
 destroyed.

 To see if this is working, I tried to stop Kamailio and looked into the
 database. The htable is still empty. Any configuration
 changes required to make the process happen?

 Thanks
 Krish Kura

 On Tue, Mar 6, 2012 at 8:38 AM, Krishna Kurapati kkura...@gmail.comwrote:

 Hi,

 This is my first time attempt using htable module.
 How can I back up the htable content in the database incase the server
 restarts. I saw a htable in the MySQL database.
 My observation has been that htable module is not automatically backing
 up to database even though I added
 modparams to point to the database. Do I need to explicitly backup
 htable content to database using sqlops or some
 other mechanism?

 Thanks
 Krish Kura




 ___
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
 sr-users@lists.sip-router.org
 http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




-- 
Daniel-Constantin Mierla
  http://www.asipto.com
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users