From d6ef95f39685cfeead62781fa8c520ca723e99ca Mon Sep 17 00:00:00 2001 From: Sihui Han Date: Wed, 25 Apr 2018 21:31:14 +0000 Subject: [PATCH 1/2] [buffermgr]: remove the item from consumer queue if invalid Signed-off-by: Sihui Han --- cfgmgr/buffermgr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cfgmgr/buffermgr.cpp b/cfgmgr/buffermgr.cpp index f3c1d5db9b8..c2e3c49d127 100644 --- a/cfgmgr/buffermgr.cpp +++ b/cfgmgr/buffermgr.cpp @@ -227,7 +227,8 @@ void BufferMgr::doTask(Consumer &consumer) { case task_process_status::task_failed: SWSS_LOG_ERROR("Failed to process table update"); - return; + it = consumer.m_toSync.erase(it); + break; case task_process_status::task_need_retry: SWSS_LOG_INFO("Unable to process table update. Will retry..."); ++it; From 8e6dcb082326443a17dfd4eec46d4702b1ae5b92 Mon Sep 17 00:00:00 2001 From: Sihui Han Date: Wed, 25 Apr 2018 23:35:26 +0000 Subject: [PATCH 2/2] change error to task_invalid_entry Signed-off-by: Sihui Han --- cfgmgr/buffermgr.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cfgmgr/buffermgr.cpp b/cfgmgr/buffermgr.cpp index c2e3c49d127..89b01970bce 100644 --- a/cfgmgr/buffermgr.cpp +++ b/cfgmgr/buffermgr.cpp @@ -126,7 +126,7 @@ task_process_status BufferMgr::doSpeedUpdateTask(string port, string speed) { SWSS_LOG_ERROR("Unable to create/update PG profile for port %s. No PG profile configured for speed %s and cable length %s", port.c_str(), speed.c_str(), cable.c_str()); - return task_process_status::task_failed; + return task_process_status::task_invalid_entry; } // Crete record in BUFFER_PROFILE table @@ -227,12 +227,15 @@ void BufferMgr::doTask(Consumer &consumer) { case task_process_status::task_failed: SWSS_LOG_ERROR("Failed to process table update"); - it = consumer.m_toSync.erase(it); - break; + return; case task_process_status::task_need_retry: SWSS_LOG_INFO("Unable to process table update. Will retry..."); ++it; break; + case task_process_status::task_invalid_entry: + SWSS_LOG_ERROR("Failed to process invalid entry, drop it"); + it = consumer.m_toSync.erase(it); + break; default: it = consumer.m_toSync.erase(it); break;