Skip to content
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
20 changes: 9 additions & 11 deletions orchagent/response_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,11 @@ void RecordResponse(const std::string &response_channel, const std::string &key,
} // namespace

ResponsePublisher::ResponsePublisher(const std::string &dbName, bool buffered, bool db_write_thread)
: m_db(std::make_unique<swss::DBConnector>(dbName, 0)), m_buffered(buffered)
: m_db(std::make_unique<swss::DBConnector>(dbName, 0)),
m_ntf_pipe(std::make_unique<swss::RedisPipeline>(m_db.get())),
m_db_pipe(std::make_unique<swss::RedisPipeline>(m_db.get())),
m_buffered(buffered)
{
if (m_buffered)
{
m_ntf_pipe = std::make_unique<swss::RedisPipeline>(m_db.get());
m_db_pipe = std::make_unique<swss::RedisPipeline>(m_db.get());
}
else
{
m_ntf_pipe = std::make_unique<swss::RedisPipeline>(m_db.get(), 1);
m_db_pipe = std::make_unique<swss::RedisPipeline>(m_db.get(), 1);
}
if (db_write_thread)
{
m_update_thread = std::unique_ptr<std::thread>(new std::thread(&ResponsePublisher::dbUpdateThread, this));
Expand Down Expand Up @@ -164,6 +157,11 @@ void ResponsePublisher::writeToDBInternal(const std::string &table, const std::s
auto attrs = values;
if (op == SET_COMMAND)
{
if (m_directDbWrite)
{
applStateTable.set(key, attrs);
return;
}
if (replace)
{
applStateTable.del(key);
Expand Down
5 changes: 5 additions & 0 deletions orchagent/response_publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class ResponsePublisher : public ResponsePublisherInterface
*/
void setBuffered(bool buffered);


// When true, write attributes directly to DB without merge logic.
// When false (default), check for existing keys and filter NULL-valued attributes.
bool m_directDbWrite = false;

private:
struct entry
{
Expand Down
1 change: 1 addition & 0 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,
SWSS_LOG_ENTER();

m_publisher.setBuffered(true);
m_publisher.m_directDbWrite = true;

sai_attribute_t attr;
attr.id = SAI_SWITCH_ATTR_NUMBER_OF_ECMP_GROUPS;
Expand Down
Loading