Hello Robert,
this was briefly discussed on our devel meeting today. It seems that the DB_REDIS module
does not implement the necessary delete all API from the redis library. You can have a
look to the module and see if you can extend it – alternatively open a feature request
about it on our tracker.
Cheers,
Henning
--
Henning Westerholt –
https://skalatan.de/blog/
Kamailio services –
https://gilawa.com<https://gilawa.com/>
Kamailio Merchandising –
https://skalatan.de/merchandising
From: sr-dev <sr-dev-bounces(a)lists.kamailio.org> On Behalf Of Robert Boisvert
Sent: Thursday, November 14, 2019 5:55 PM
To: sr-dev(a)lists.kamailio.org
Subject: [sr-dev] DB_REDIS Doesn't Seem to Work With Unfiltered Deletes
Greetings,
I'm using the delete record feature as described in section
9.2.9<http://www.asipto.com/pub/kamailio-devel-guide/#c09f_delete> of the Kamailio
SIP Server v3.2.0 Development Guide. When I try to delete the entire table without any
filtering, as shown in the code below, DB_REDIS fails. Is this a bug?
Thank you in advance for your help,
Bob
Log
DEBUG: db_redis [redis_connection.c:118]: db_redis_connect(): connecting to redis at
127.0.0.1:6379<http://127.0.0.1:6379>
DEBUG: db_redis [redis_connection.c:171]: db_redis_connect(): connection opened to
redis://127.0.0.1:6379/5<http://127.0.0.1:6379/5>
DEBUG: db_redis [redis_connection.c:232]: db_redis_new_connection(): connection opened to
redis://127.0.0.1:6379/5<http://127.0.0.1:6379/5>
DEBUG: db_redis [redis_dbase.c:2019]: db_redis_delete(): deleting from prefix (table)
'mohqcalls'
DEBUG: db_redis [redis_dbase.c:524]: db_redis_build_query_keys(): build query keys
DEBUG: db_redis [redis_dbase.c:295]: db_redis_find_query_key(): checking for existence of
entry key 'call_id' in query
DEBUG: db_redis [redis_dbase.c:306]: db_redis_find_query_key(): found key in entry key
DEBUG: db_redis [redis_dbase.c:123]: db_redis_val2str(): converting string value
'a1960c88-640f2e0f-bf639d1a@10.197.126.143<mailto:a1960c88-640f2e0f-bf639d1a@10.197.126.143>'
with len 41 to str
DEBUG: db_redis [redis_dbase.c:338]: db_redis_find_query_key(): entry key so far is
'mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143<mailto:mohqcalls%3Aentry%3A%3Aa1960c88-640f2e0f-bf639d1a@10.197.126.143>'
DEBUG: db_redis [redis_dbase.c:543]: db_redis_build_query_keys(): found suitable entry key
'mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143<mailto:mohqcalls%3Aentry%3A%3Aa1960c88-640f2e0f-bf639d1a@10.197.126.143>'
for query
DEBUG: db_redis [redis_dbase.c:617]: db_redis_build_query_keys(): building manual keys
DEBUG: db_redis [redis_dbase.c:254]: db_redis_build_entry_manual_keys(): checking for
existence of entry key 'call_id' in query to get manual key
DEBUG: db_redis [redis_dbase.c:259]: db_redis_build_entry_manual_keys(): found key in
entry key
DEBUG: db_redis [redis_dbase.c:1297]: db_redis_perform_delete(): delete all keys
DEBUG: db_redis [redis_dbase.c:1303]: db_redis_perform_delete(): delete key
'mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143<mailto:mohqcalls%3Aentry%3A%3Aa1960c88-640f2e0f-bf639d1a@10.197.126.143>'
DEBUG: db_redis [redis_connection.c:32]: print_query(): Query dump:
DEBUG: db_redis [redis_connection.c:34]: print_query(): EXISTS
DEBUG: db_redis [redis_connection.c:34]: print_query():
mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143<mailto:mohqcalls%3Aentry%3A%3Aa1960c88-640f2e0f-bf639d1a@10.197.126.143>
DEBUG: db_redis [redis_table.c:154]: db_redis_key_list2arr(): returning 2 entries
DEBUG: db_redis [redis_connection.c:279]: db_redis_command_argv(): query has 2 args
DEBUG: db_redis [redis_connection.c:32]: print_query(): Query dump:
DEBUG: db_redis [redis_connection.c:34]: print_query(): HMGET
DEBUG: db_redis [redis_connection.c:34]: print_query():
mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143<mailto:mohqcalls%3Aentry%3A%3Aa1960c88-640f2e0f-bf639d1a@10.197.126.143>
DEBUG: db_redis [redis_table.c:154]: db_redis_key_list2arr(): returning 2 entries
DEBUG: db_redis [redis_connection.c:279]: db_redis_command_argv(): query has 2 args
ERROR: db_redis [redis_dbase.c:1352]: db_redis_perform_delete(): Failed to fetch type
entry: ERR wrong number of arguments for 'hmget' command
ERROR: db_redis [redis_dbase.c:1460]: db_redis_perform_delete(): failed to perform the
delete
ERROR: db_redis [redis_dbase.c:2076]: db_redis_delete(): failed to do the query
WARNING: mohqueue [mohq_db.c:278]: delete_call_rec(): delete_call_rec: Unable to delete
row from mohqcalls
Code
db_func_t *pdb = pmod_data->pdb;
pdb->use_table (pconn, &pmod_data->pcfg->db_ctable);
if (pdb->delete (pconn, 0, 0, 0, 0) < 0)
{
LM_WARN ("%sUnable to delete all rows from %s\n", pfncname,
pmod_data->pcfg->db_ctable.s);
}