Module: kamailio
Branch: master
Commit: 3ab38fd199ea72c21750b242fffe8c8a5ca85631
URL: https://github.com/kamailio/kamailio/commit/3ab38fd199ea72c21750b242fffe8c8…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2017-05-10T06:47:22+02:00
modules: readme files regenerated - ndb_redis ... [skip ci]
---
Modified: src/modules/ndb_redis/README
---
Diff: https://github.com/kamailio/kamailio/commit/3ab38fd199ea72c21750b242fffe8c8…
Patch: https://github.com/kamailio/kamailio/commit/3ab38fd199ea72c21750b242fffe8c8…
---
diff --git a/src/modules/ndb_redis/README b/src/modules/ndb_redis/README
index 43d283f..8ef7d7d 100644
--- a/src/modules/ndb_redis/README
+++ b/src/modules/ndb_redis/README
@@ -48,6 +48,7 @@ Carsten Bock
3.5. cluster (integer)
3.6. allowed_timeouts (integer)
3.7. disable_time (integer)
+ 3.8. flush_on_reconnect (integer)
4. Functions
@@ -65,9 +66,10 @@ Carsten Bock
1.5. Set cluster parameter
1.6. Set allowed_timeots parameter
1.7. Set disable_time parameter
- 1.8. redis_cmd usage
- 1.9. redis_execute usage
- 1.10. redis_free usage
+ 1.8. Set flush_on_reconnect parameter
+ 1.9. redis_cmd usage
+ 1.10. redis_execute usage
+ 1.11. redis_free usage
Chapter 1. Admin Guide
@@ -88,6 +90,7 @@ Chapter 1. Admin Guide
3.5. cluster (integer)
3.6. allowed_timeouts (integer)
3.7. disable_time (integer)
+ 3.8. flush_on_reconnect (integer)
4. Functions
@@ -130,6 +133,7 @@ Chapter 1. Admin Guide
3.5. cluster (integer)
3.6. allowed_timeouts (integer)
3.7. disable_time (integer)
+ 3.8. flush_on_reconnect (integer)
3.1. server (str)
@@ -259,6 +263,27 @@ modparam("ndb_redis", "allowed_timeouts", 0)
modparam("ndb_redis", "disable_time", 30)
...
+3.8. flush_on_reconnect (integer)
+
+ If this is set to a non zero value, a "FLUSHALL" command is issued
+ after reconnecting to a REDIS server, to clear the entire database.
+
+ When a command to a REDIS server fails, a reconnection to that server
+ is made, so with this parameter each failed command will result in a
+ flush of the database.
+
+ This is useful in scenarios when a REDIS server does not respond to
+ commands, but the commands might have been issued, and the responses
+ lost. If this leaves the data in the db in an uncertain state, a flush
+ might fix any issues that may occur.
+
+ Default value is “0” (disabled).
+
+ Example 1.8. Set flush_on_reconnect parameter
+...
+modparam("ndb_redis", "flush_on_reconnect", 1)
+...
+
4. Functions
4.1. redis_cmd(srvname, command, ..., replyid)
@@ -289,7 +314,7 @@ modparam("ndb_redis", "disable_time", 30)
* value[n] - returns value of the nth element. value - returns null
for an array. You need to get each element by index.
- Example 1.8. redis_cmd usage
+ Example 1.9. redis_cmd usage
...
if(redis_cmd("srvN", "INCR cnt", "r")) {
# success - the incremented value is in $redis(r=>value)
@@ -358,7 +383,7 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
If cluster parameter is set to 1, this function will log an error and
do nothing.
- Example 1.9. redis_execute usage
+ Example 1.10. redis_execute usage
...
After several redis command calls:
redis_pipe_cmd("srvA", "SET foo bar", "r1");
@@ -406,7 +431,7 @@ d commands. The call is not necessary
function. When ndb_redis module closes, all pending replies are freed
automatically.
- Example 1.10. redis_free usage
+ Example 1.11. redis_free usage
...
After a redis command call:
redis_cmd("srvN", "INCR cnt", "r");
Module: kamailio
Branch: master
Commit: 79e9133ccd86b53b0199980d3f221e64da595344
URL: https://github.com/kamailio/kamailio/commit/79e9133ccd86b53b0199980d3f221e6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2017-05-10T06:43:37+02:00
Merge pull request #1125 from claudiupb/redis_flush_on_reconnect
ndb_redis: add flush_db_on_reconnect parameter
---
Modified: src/modules/ndb_redis/doc/ndb_redis_admin.xml
Modified: src/modules/ndb_redis/ndb_redis_mod.c
Modified: src/modules/ndb_redis/redis_client.c
---
Diff: https://github.com/kamailio/kamailio/commit/79e9133ccd86b53b0199980d3f221e6…
Patch: https://github.com/kamailio/kamailio/commit/79e9133ccd86b53b0199980d3f221e6…
---
diff --git a/src/modules/ndb_redis/doc/ndb_redis_admin.xml b/src/modules/ndb_redis/doc/ndb_redis_admin.xml
index e7dc381..e72fb51 100644
--- a/src/modules/ndb_redis/doc/ndb_redis_admin.xml
+++ b/src/modules/ndb_redis/doc/ndb_redis_admin.xml
@@ -239,6 +239,38 @@ modparam("ndb_redis", "disable_time", 30)
</programlisting>
</example>
</section>
+ <section id="ndb_redis.p.flush_db_on_reconnect">
+ <title><varname>flush_db_on_reconnect</varname> (integer)</title>
+ <para>
+ If this is set to a non zero value, a "FLUSHALL" command is
+ issued after reconnecting to a REDIS server, to clear the
+ entire database.
+ </para>
+ <para>
+ When a command to a REDIS server fails, a reconnection
+ to that server is made, so with this parameter each failed
+ command will result in a flush of the database.
+ </para>
+ <para>
+ This is useful in scenarios when a REDIS server does not respond
+ to commands, but the commands might have been issued, and the
+ responses lost. If this leaves the data in the db in an uncertain
+ state, a flush might fix any issues that may occur.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>0</quote> (disabled).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>flush_db_on_reconnect</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("ndb_redis", "flush_db_on_reconnect", 1)
+...
+ </programlisting>
+ </example>
+ </section>
</section>
<section>
diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c
index 6e43849..2cac1fb 100644
--- a/src/modules/ndb_redis/ndb_redis_mod.c
+++ b/src/modules/ndb_redis/ndb_redis_mod.c
@@ -50,6 +50,7 @@ int redis_cmd_timeout_param = 1000;
int redis_cluster_param = 0;
int redis_disable_time_param=0;
int redis_allowed_timeouts_param=-1;
+int redis_flush_db_on_reconnect_param=0;
static int w_redis_cmd3(struct sip_msg* msg, char* ssrv, char* scmd,
char* sres);
@@ -124,6 +125,7 @@ static param_export_t params[]={
{"cluster", INT_PARAM, &redis_cluster_param},
{"disable_time", INT_PARAM, &redis_disable_time_param},
{"allowed_timeouts", INT_PARAM, &redis_allowed_timeouts_param},
+ {"flush_db_on_reconnect", INT_PARAM, &redis_flush_db_on_reconnect_param},
{0, 0, 0}
};
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index 9fb7791..4683133 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -51,6 +51,7 @@ extern int redis_cmd_timeout_param;
extern int redis_cluster_param;
extern int redis_disable_time_param;
extern int redis_allowed_timeouts_param;
+extern int redis_flush_db_on_reconnect_param;
/* backwards compatibility with hiredis < 0.12 */
#if (HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12)
@@ -374,7 +375,9 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
goto err2;
if ((redis_cluster_param == 0) && redisCommandNR(rsrv->ctxRedis, "SELECT %i", db))
goto err2;
-
+ if (redis_flush_db_on_reconnect_param)
+ if (redisCommandNR(rsrv->ctxRedis, "FLUSHALL"))
+ goto err2;
return 0;
err2:
Module: kamailio
Branch: master
Commit: c886a9b0578a190f23a1084317cfecc3238a0007
URL: https://github.com/kamailio/kamailio/commit/c886a9b0578a190f23a1084317cfecc…
Author: Claudiu Boriga <paul.boriga(a)1and1.ro>
Committer: Claudiu Boriga <paul.boriga(a)1and1.ro>
Date: 2017-05-09T15:02:45+03:00
ndb_redis: add flush_db_on_reconnect parameter
---
Modified: src/modules/ndb_redis/doc/ndb_redis_admin.xml
Modified: src/modules/ndb_redis/ndb_redis_mod.c
Modified: src/modules/ndb_redis/redis_client.c
---
Diff: https://github.com/kamailio/kamailio/commit/c886a9b0578a190f23a1084317cfecc…
Patch: https://github.com/kamailio/kamailio/commit/c886a9b0578a190f23a1084317cfecc…
---
diff --git a/src/modules/ndb_redis/doc/ndb_redis_admin.xml b/src/modules/ndb_redis/doc/ndb_redis_admin.xml
index e7dc381..e72fb51 100644
--- a/src/modules/ndb_redis/doc/ndb_redis_admin.xml
+++ b/src/modules/ndb_redis/doc/ndb_redis_admin.xml
@@ -239,6 +239,38 @@ modparam("ndb_redis", "disable_time", 30)
</programlisting>
</example>
</section>
+ <section id="ndb_redis.p.flush_db_on_reconnect">
+ <title><varname>flush_db_on_reconnect</varname> (integer)</title>
+ <para>
+ If this is set to a non zero value, a "FLUSHALL" command is
+ issued after reconnecting to a REDIS server, to clear the
+ entire database.
+ </para>
+ <para>
+ When a command to a REDIS server fails, a reconnection
+ to that server is made, so with this parameter each failed
+ command will result in a flush of the database.
+ </para>
+ <para>
+ This is useful in scenarios when a REDIS server does not respond
+ to commands, but the commands might have been issued, and the
+ responses lost. If this leaves the data in the db in an uncertain
+ state, a flush might fix any issues that may occur.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>0</quote> (disabled).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>flush_db_on_reconnect</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("ndb_redis", "flush_db_on_reconnect", 1)
+...
+ </programlisting>
+ </example>
+ </section>
</section>
<section>
diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c
index 6e43849..2cac1fb 100644
--- a/src/modules/ndb_redis/ndb_redis_mod.c
+++ b/src/modules/ndb_redis/ndb_redis_mod.c
@@ -50,6 +50,7 @@ int redis_cmd_timeout_param = 1000;
int redis_cluster_param = 0;
int redis_disable_time_param=0;
int redis_allowed_timeouts_param=-1;
+int redis_flush_db_on_reconnect_param=0;
static int w_redis_cmd3(struct sip_msg* msg, char* ssrv, char* scmd,
char* sres);
@@ -124,6 +125,7 @@ static param_export_t params[]={
{"cluster", INT_PARAM, &redis_cluster_param},
{"disable_time", INT_PARAM, &redis_disable_time_param},
{"allowed_timeouts", INT_PARAM, &redis_allowed_timeouts_param},
+ {"flush_db_on_reconnect", INT_PARAM, &redis_flush_db_on_reconnect_param},
{0, 0, 0}
};
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index 9fb7791..4683133 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -51,6 +51,7 @@ extern int redis_cmd_timeout_param;
extern int redis_cluster_param;
extern int redis_disable_time_param;
extern int redis_allowed_timeouts_param;
+extern int redis_flush_db_on_reconnect_param;
/* backwards compatibility with hiredis < 0.12 */
#if (HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12)
@@ -374,7 +375,9 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
goto err2;
if ((redis_cluster_param == 0) && redisCommandNR(rsrv->ctxRedis, "SELECT %i", db))
goto err2;
-
+ if (redis_flush_db_on_reconnect_param)
+ if (redisCommandNR(rsrv->ctxRedis, "FLUSHALL"))
+ goto err2;
return 0;
err2:
Hello,
We added a new parameter to ndb_redis module. If set to 1 a "FLUSHALL" command is issued to the REDIS server when reconnecting to a server after a failed command. This way for each failed command the database is flushed.
This is useful when a connection to the REDIS server may become unstable and some commands are issued but the replies are not received (it may happen that the command has reached the REDIS server but the reply was lost). If for example we increment and decrement counters this may leave the db in an invalid state.
This can especially happen if the allowed_timeouts/disable_time parameters are configured, since the first commands may be issued and the next ones are never tried.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1125
-- Commit Summary --
* ndb_redis: add flush_db_on_reconnect parameter
-- File Changes --
M src/modules/ndb_redis/doc/ndb_redis_admin.xml (32)
M src/modules/ndb_redis/ndb_redis_mod.c (2)
M src/modules/ndb_redis/redis_client.c (5)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1125.patchhttps://github.com/kamailio/kamailio/pull/1125.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1125
Hi,
It seems I ran into the same issue on 5.0.1.
Was using pua.publish and my Kamailio complained "Entity: line 1: parser
error : Start tag expected, '<' not found
Messages-Waiting: yes
^
2(8) ERROR: presence [presentity.c:283]: check_if_dialog(): failed to
parse xml document"
The content-type is "application/simple-message-summary". Do we need the
same patch in 5.0.x?
Thanks,
Bing
Module: kamailio
Branch: master
Commit: df04997cd1505b3687a7005c7578a9b012f25d85
URL: https://github.com/kamailio/kamailio/commit/df04997cd1505b3687a7005c7578a9b…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: 2017-05-09T13:41:12+01:00
dmq_usrloc: fix incorrectly formatted XML docbook
---
Modified: src/modules/dmq_usrloc/doc/dmq_usrloc.xml
Modified: src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/df04997cd1505b3687a7005c7578a9b…
Patch: https://github.com/kamailio/kamailio/commit/df04997cd1505b3687a7005c7578a9b…
---
diff --git a/src/modules/dmq_usrloc/doc/dmq_usrloc.xml b/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
index c6b36ac..8391296 100644
--- a/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
+++ b/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
@@ -39,6 +39,7 @@
<copyright>
<year>2014</year>
</copyright>
+ <authorgroup>
<editor>
<firstname>Julien</firstname>
<surname>Chavanton</surname>
diff --git a/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml b/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
index 81be430..e936573 100644
--- a/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
+++ b/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
@@ -180,10 +180,12 @@ modparam("dmq_usrloc", "batch_usleep", 1000)
<section id="usrloc_dmq.p.batch_msg_size">
<title><varname>batch_msg_size</varname> (int)</title>
<para>
- The parameter controls the size of the messages during a sync
- This is to make sure the messages are never larger then 65536 (the maximum datagram size)
-
- Note that batch_msg_contacts will also be checked
+ The parameter controls the size of the messages during a sync.
+ This is to make sure the messages are never larger then 65536 (the maximum datagram size).
+ </para>
+ <para>
+ Note that batch_msg_contacts will also be checked.
+ </para>
<para>
<emphasis>
Default value is 60000.
@@ -204,9 +206,11 @@ modparam("dmq_usrloc", "batch_msg_size", 500000)
<section id="usrloc_dmq.p.batch_msg_contacts">
<title><varname>batch_msg_contacts</varname> (int)</title>
<para>
- The parameter controls the amount of contact per message/transaction during a sync
-
- Note that batch_msg_size will also be checked
+ The parameter controls the amount of contact per message/transaction during a sync.
+ </para>
+ <para>
+ Note that batch_msg_size will also be checked.
+ </para>
<para>
<emphasis>
Default value is 1.
@@ -225,7 +229,6 @@ modparam("dmq_usrloc", "batch_usleep", 500000) # one batch every 500ms
</programlisting>
</example>
</section>
- </section>
<section id="usrloc_dmq.p.usrloc_domain">
<title><varname>usrloc_domain</varname> (string)</title>
@@ -246,6 +249,7 @@ modparam("dmq_usrloc", "usrloc_domain", "my_domain")
</programlisting>
</example>
</section>
+ </section>
</chapter>