From 32539ef8b31f6aefff424219ebf90b4fede86058 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 23 Jan 2024 19:17:59 +0200 Subject: [PATCH] [sql_cacher] fix proper update on status/report upon quick exit Be sure the SR info is properly updated (on the reload result) even when doing a quick return upon no records loaded --- modules/sql_cacher/sql_cacher.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/sql_cacher/sql_cacher.c b/modules/sql_cacher/sql_cacher.c index bdc73f7a65f..965daa597be 100644 --- a/modules/sql_cacher/sql_cacher.c +++ b/modules/sql_cacher/sql_cacher.c @@ -942,11 +942,8 @@ static int load_entire_table(cache_entry_t *c_entry, db_handlers_t *db_hdls, } /* anything loaded ? if not, we can do a quick exit here */ - if (RES_ROW_N(sql_res) == 0) { - lock_stop_write(db_hdls->c_entry->ref_lock); - db_hdls->db_funcs.free_result(db_hdls->db_con, sql_res); - return 0; - } + if (RES_ROW_N(sql_res) == 0) + goto done; row = RES_ROWS(sql_res); values = ROW_VALUES(row); @@ -982,6 +979,7 @@ static int load_entire_table(cache_entry_t *c_entry, db_handlers_t *db_hdls, } } while (RES_ROW_N(sql_res) > 0); +done: lock_stop_write(db_hdls->c_entry->ref_lock); db_hdls->db_funcs.free_result(db_hdls->db_con, sql_res);