Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid full table scan for dispatcher table using db_redis as backend #2149

Closed
joelsdc opened this issue Nov 25, 2019 · 1 comment
Closed

Comments

@joelsdc
Copy link

joelsdc commented Nov 25, 2019

Description

I'm trying to avoid getting this warning:

Nov 22 20:36:35 test COPS[25531]: WARNING: db_redis [redis_dbase.c:1098]: db_redis_perform_query(): performing full table scan on table 'dispatcher' while performing query

Troubleshooting

Having:

modparam("db_redis", "keys", "version=entry:table_name")
modparam("db_redis", "keys", "dispatcher=entry:id")

And debug logs showing the key being found:

Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:200]: db_redis_print_all_tables():   table dispatcher
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:203]: db_redis_print_all_tables():     schema:
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       description: 3
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       attrs: 3
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       flags: 0
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       destination: 3
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       priority: 0
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       setid: 0
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:208]: db_redis_print_all_tables():       id: 0
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:214]: db_redis_print_all_tables():     entry keys:
Nov 25 18:16:09 test COPS[18195]: DEBUG: db_redis [redis_table.c:217]: db_redis_print_all_tables():       id

Every time you do a dispatcher reload you get the warning. Debug logs:

Nov 25 18:01:13 test COPS[17825]: DEBUG: db_redis [redis_dbase.c:1761]: db_redis_query(): querying prefix (table) 'dispatcher'
Nov 25 18:01:13 test COPS[17825]: DEBUG: db_redis [redis_dbase.c:1811]: db_redis_query(): no columns given to build query keys, falling back to full table scan
Nov 25 18:01:13 test COPS[17825]: DEBUG: <core> [db_res.c:119]: db_new_result(): allocate 56 bytes for result set at 0x7efe768040b0
Nov 25 18:01:13 test COPS[17825]: DEBUG: <core> [db_res.c:156]: db_allocate_columns(): allocate 40 bytes for result names at 0x7efe76804150
Nov 25 18:01:13 test COPS[17825]: DEBUG: <core> [db_res.c:167]: db_allocate_columns(): allocate 20 bytes for result types at 0x7efe768041e0
Nov 25 18:01:13 test COPS[17825]: WARNING: db_redis [redis_dbase.c:1098]: db_redis_perform_query(): performing full table scan on table 'dispatcher' while performing query

Possible Solutions

I don't know the code, but I would think of:
a) fix what is causing the key to no be correctly set
or
b) exclude this warning from dispatcher table reload if it's not necessary

Additional Information

  • Kamailio Version - output of kamailio -v
version: kamailio 5.4.0-dev2 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 8.3.0
  • Operating System:
Linux test 4.19.0-6-cloud-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux
@joelsdc joelsdc changed the title Avoid full table scan for dispatcher table using db_redis using ds_reload() from config script In Avoid full table scan for dispatcher table using db_redis as backend Nov 25, 2019
@miconda
Copy link
Member

miconda commented Nov 26, 2019

I pushed a patch to not print the warning when it is supposed to load full table -- see the reference above. If still an issue, reopen.

@miconda miconda closed this as completed Nov 26, 2019
henningw pushed a commit that referenced this issue Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants