[sr-dev] git:5.4:a472aaae: db_redis: fix unfiltered table deletion

Richard Fuchs rfuchs at sipwise.com
Thu Jul 16 17:26:17 CEST 2020


Module: kamailio
Branch: 5.4
Commit: a472aaae69f7bd483c232cc5c9f59078bad1e938
URL: https://github.com/kamailio/kamailio/commit/a472aaae69f7bd483c232cc5c9f59078bad1e938

Author: Richard Fuchs <rfuchs at sipwise.com>
Committer: Richard Fuchs <rfuchs at sipwise.com>
Date: 2020-07-16T11:26:05-04:00

db_redis: fix unfiltered table deletion

---

Modified: src/modules/db_redis/redis_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/a472aaae69f7bd483c232cc5c9f59078bad1e938.diff
Patch: https://github.com/kamailio/kamailio/commit/a472aaae69f7bd483c232cc5c9f59078bad1e938.patch

---

diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 9c81385a39..c9a25adf36 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -1698,12 +1698,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
         if (tmp)
             db_redis_key_free(&tmp);
 
-        // skip if delete all rows
-        if (!*manual_keys_count) {
-          db_redis_key_free (&query_v);
-          goto skipkeys;
-        }
-
         if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) {
             LM_ERR("Failed to set hmget command to pre-delete query\n");
             goto error;
@@ -1795,7 +1789,6 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
         db_vals = NULL;
         db_redis_free_reply(&reply);
 
-      skipkeys:
         if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) {
             LM_ERR("Failed to add del command to delete query\n");
             goto error;
@@ -2655,6 +2648,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k,
     } else {
         LM_DBG("no columns given to build query keys, falling back to full table scan\n");
         keys_count = 0;
+        do_table_scan = 1;
     }
 
     if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,




More information about the sr-dev mailing list