Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[buffer]: Remove failed tasks from the m_toSync queue #308

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 23 additions & 27 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,41 +526,37 @@ void BufferOrch::doTask(Consumer &consumer)
auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
KeyOpFieldsValuesTuple tuple = it->second;
string map_type_name = consumer.m_consumer->getTableName();
if (m_buffer_type_maps.find(map_type_name) == m_buffer_type_maps.end())
{
SWSS_LOG_ERROR("Unrecognised qos table encountered:%s", map_type_name.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
/* Make sure the handler is initialized for the task */
auto map_type_name = consumer.m_consumer->getTableName();
if (m_bufferHandlerMap.find(map_type_name) == m_bufferHandlerMap.end())
{
SWSS_LOG_ERROR("No handler for key:%s found.", map_type_name.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
task_process_status task_status = (this->*(m_bufferHandlerMap[map_type_name]))(consumer);

auto task_status = (this->*(m_bufferHandlerMap[map_type_name]))(consumer);
switch(task_status)
{
case task_process_status::task_success :
it = consumer.m_toSync.erase(it);
break;
case task_process_status::task_invalid_entry:
SWSS_LOG_ERROR("Invalid buffer task item was encountered, removing from queue.");
it = consumer.m_toSync.erase(it);
break;
case task_process_status::task_failed:
SWSS_LOG_ERROR("Processing buffer task item failed, exiting.");
return;
case task_process_status::task_need_retry:
SWSS_LOG_INFO("Processing buffer task item failed, will retry.");
it++;
break;
default:
SWSS_LOG_ERROR("Unknown task status: %d", task_status);
it = consumer.m_toSync.erase(it);
break;
case task_process_status::task_success :
it = consumer.m_toSync.erase(it);
break;
case task_process_status::task_invalid_entry:
SWSS_LOG_ERROR("Failed to process invalid buffer task");
it = consumer.m_toSync.erase(it);
break;
case task_process_status::task_failed:
SWSS_LOG_ERROR("Failed to process buffer task, drop it");
it = consumer.m_toSync.erase(it);
return;
case task_process_status::task_need_retry:
SWSS_LOG_INFO("Failed to process buffer task, retry it");
it++;
break;
default:
SWSS_LOG_ERROR("Invalid task status %d", task_status);
it = consumer.m_toSync.erase(it);
break;
}
}
}
4 changes: 2 additions & 2 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ void QosOrch::doTask(Consumer &consumer)
while (it != consumer.m_toSync.end())
{
/* Make sure the handler is initialized for the task */
string qos_map_type_name = consumer.m_consumer->getTableName();
auto qos_map_type_name = consumer.m_consumer->getTableName();
if (m_qos_handler_map.find(qos_map_type_name) == m_qos_handler_map.end())
{
SWSS_LOG_ERROR("Task %s handler is not initialized", qos_map_type_name.c_str());
Expand All @@ -1266,7 +1266,7 @@ void QosOrch::doTask(Consumer &consumer)
it = consumer.m_toSync.erase(it);
return;
case task_process_status::task_need_retry :
SWSS_LOG_ERROR("Failed to process QOS task, retry it");
SWSS_LOG_INFO("Failed to process QOS task, retry it");
it++;
break;
default:
Expand Down