From 6ed43db42627fc80daec88c83b18aee8b8b7bfb4 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 20 Jul 2021 14:36:27 -0400 Subject: [PATCH] TT#14008 don't delete calls from foreign DB during restore If a keyspace notification SET is received and the call already exists as a foreign call, the call is first destroyed before being re-restored. The call destruction involves a DEL from Redis on the "hosted DB" number, which points to the foreign DB. This makes it impossible to then restore the call because it's just been deleted. closes #1308 closes #1334 Change-Id: Ie895b021441b2d299f8ebb5bde1824b01e12633c (cherry picked from commit 590189ef29c716df9d3d114f7e542233e1bdbd51) --- daemon/redis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/redis.c b/daemon/redis.c index 141b91da3..f9a863107 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -372,13 +372,17 @@ void on_redis_notification(redisAsyncContext *actx, void *reply, void *privdata) c = call_get(&callid); if (c) { rwlock_unlock_w(&c->master_lock); - if (IS_FOREIGN_CALL(c)) + if (IS_FOREIGN_CALL(c)) { + c->redis_hosted_db = rtpe_redis_write->db; // don't delete from foreign DB call_destroy(c); + } else { rlog(LOG_WARN, "Redis-Notifier: Ignoring SET received for OWN call: %s\n", rr->element[2]->str); goto err; } } + + redis_select_db(r, r->db); mutex_unlock(&r->lock); // unlock before restoring calls to avoid deadlock in case err happens