From 2a311295b211408585b57543d30789cf264248a7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 20 Feb 2019 10:55:56 -0500 Subject: [PATCH] TT#52964 suppress stray warning when no MySQL acc records are found Change-Id: Ib795ee8d9b4c99d8abb09c09390d0bfac35c597d (cherry picked from commit d6f58ed4ca479556dd98bd5b44a264689203dde9) --- mediator.c | 4 ++-- medmysql.c | 7 ++++--- medmysql.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mediator.c b/mediator.c index 61394da..52e23e1 100644 --- a/mediator.c +++ b/mediator.c @@ -305,7 +305,7 @@ int main(int argc, char **argv) gettimeofday(&tv_start, NULL); #endif - if(medmysql_fetch_records(&(mysql_callids[i]), &mysql_records, &mysql_rec_count) != 0) + if(medmysql_fetch_records(&(mysql_callids[i]), &mysql_records, &mysql_rec_count, 1) != 0) goto out; if(medredis_fetch_records(&(mysql_callids[i]), &redis_records, &redis_rec_count) == 0 @@ -366,7 +366,7 @@ int main(int argc, char **argv) if(medredis_fetch_records(&(redis_callids[i]), &redis_records, &redis_rec_count) != 0) goto out; - if(medmysql_fetch_records(&(redis_callids[i]), &mysql_records, &mysql_rec_count) == 0 + if(medmysql_fetch_records(&(redis_callids[i]), &mysql_records, &mysql_rec_count, 0) == 0 && mysql_rec_count) { redis_records = realloc(redis_records, (mysql_rec_count + redis_rec_count) * sizeof(med_entry_t)); diff --git a/medmysql.c b/medmysql.c index 4373ca5..0767c8d 100644 --- a/medmysql.c +++ b/medmysql.c @@ -543,7 +543,7 @@ out: /**********************************************************************/ int medmysql_fetch_records(med_callid_t *callid, - med_entry_t **entries, uint64_t *count) + med_entry_t **entries, uint64_t *count, int warn_empty) { MYSQL_RES *res; MYSQL_ROW row; @@ -575,8 +575,9 @@ int medmysql_fetch_records(med_callid_t *callid, *count = mysql_num_rows(res); if(*count == 0) { - L_CRITICAL("No records found for callid '%s'!", - callid->value); + if (warn_empty) + L_CRITICAL("No records found for callid '%s'!", + callid->value); ret = -1; goto out; } diff --git a/medmysql.h b/medmysql.h index ddd683d..f61397c 100644 --- a/medmysql.h +++ b/medmysql.h @@ -36,7 +36,7 @@ struct medmysql_call_stat_info_t { int medmysql_init(); void medmysql_cleanup(); med_callid_t *medmysql_fetch_callids(uint64_t *count); -int medmysql_fetch_records(med_callid_t *callid, med_entry_t **entries, uint64_t *count); +int medmysql_fetch_records(med_callid_t *callid, med_entry_t **entries, uint64_t *count, int warn_empty); int medmysql_trash_entries(const char *callid, struct medmysql_batches *); int medmysql_backup_entries(const char *callid, struct medmysql_batches *); int medmysql_delete_entries(const char *callid, struct medmysql_batches *);