diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index 2f420cd8418e..9c3e39a98195 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -6,7 +6,7 @@ #include "netmsg.h" #include "ipprefix.h" #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "fpmsyncd/fpmlink.h" #include "fpmsyncd/routesync.h" diff --git a/fpmsyncd/routesync.h b/fpmsyncd/routesync.h index ba30f681b169..ba751d21a681 100644 --- a/fpmsyncd/routesync.h +++ b/fpmsyncd/routesync.h @@ -2,7 +2,7 @@ #define __ROUTESYNC__ #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "netmsg.h" namespace swss { @@ -17,7 +17,7 @@ class RouteSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); private: - ProducerTable m_routeTable; + ProducerStateTable m_routeTable; struct nl_cache *m_link_cache; struct nl_sock *m_nl_sock; }; diff --git a/intfsyncd/intfsync.cpp b/intfsyncd/intfsync.cpp index 521b033d9872..45ece341c8d2 100644 --- a/intfsyncd/intfsync.cpp +++ b/intfsyncd/intfsync.cpp @@ -6,7 +6,7 @@ #include "logger.h" #include "netmsg.h" #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "linkcache.h" #include "intfsyncd/intfsync.h" diff --git a/intfsyncd/intfsync.h b/intfsyncd/intfsync.h index ebafee6db8dd..3f8440a771c7 100644 --- a/intfsyncd/intfsync.h +++ b/intfsyncd/intfsync.h @@ -2,7 +2,7 @@ #define __INTFSYNC__ #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "netmsg.h" namespace swss { @@ -17,7 +17,7 @@ class IntfSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); private: - ProducerTable m_intfTable; + ProducerStateTable m_intfTable; }; } diff --git a/neighsyncd/neighsync.cpp b/neighsyncd/neighsync.cpp index 849f0d7bbdc9..7a5a55f204fa 100644 --- a/neighsyncd/neighsync.cpp +++ b/neighsyncd/neighsync.cpp @@ -5,7 +5,7 @@ #include "logger.h" #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "ipaddress.h" #include "netmsg.h" #include "linkcache.h" diff --git a/neighsyncd/neighsync.h b/neighsyncd/neighsync.h index 9578a5edf6c9..05c7d073202c 100644 --- a/neighsyncd/neighsync.h +++ b/neighsyncd/neighsync.h @@ -2,7 +2,7 @@ #define __NEIGHSYNC__ #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "netmsg.h" namespace swss { @@ -17,7 +17,7 @@ class NeighSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); private: - ProducerTable m_neighTable; + ProducerStateTable m_neighTable; }; } diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index 5da6e674cc10..b6e2dcddd274 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -14,7 +14,7 @@ extern PortsOrch *gPortsOrch; Orch::Orch(DBConnector *db, string tableName) : m_db(db) { - Consumer consumer(new ConsumerTable(m_db, tableName)); + Consumer consumer(new ConsumerStateTable(m_db, tableName)); m_consumerMap.insert(ConsumerMapPair(tableName, consumer)); } @@ -23,7 +23,7 @@ Orch::Orch(DBConnector *db, vector &tableNames) : { for(auto it : tableNames) { - Consumer consumer(new ConsumerTable(m_db, it)); + Consumer consumer(new ConsumerStateTable(m_db, it)); m_consumerMap.insert(ConsumerMapPair(it, consumer)); } } @@ -44,7 +44,7 @@ vector Orch::getSelectables() return selectables; } -bool Orch::hasSelectable(ConsumerTable *selectable) const +bool Orch::hasSelectable(ConsumerStateTable *selectable) const { for(auto it : m_consumerMap) { if (it.second.m_consumer == selectable) { @@ -73,6 +73,11 @@ bool Orch::execute(string tableName) string key = kfvKey(new_data); string op = kfvOp(new_data); + // Possible nothing popped, ie. the oparation is already merged with other operations + if (op.empty()) + { + return true; + } dumpTuple(consumer, new_data); diff --git a/orchagent/orch.h b/orchagent/orch.h index bafa03e1778c..296628e79843 100644 --- a/orchagent/orch.h +++ b/orchagent/orch.h @@ -10,8 +10,8 @@ extern "C" { } #include "dbconnector.h" -#include "consumertable.h" -#include "producertable.h" +#include "consumerstatetable.h" +#include "producerstatetable.h" using namespace std; using namespace swss; @@ -40,8 +40,8 @@ typedef pair type_map_pair; typedef map SyncMap; struct Consumer { - Consumer(ConsumerTable* consumer) :m_consumer(consumer) { } - ConsumerTable* m_consumer; + Consumer(ConsumerStateTable* consumer) :m_consumer(consumer) { } + ConsumerStateTable* m_consumer; /* Store the latest 'golden' status */ SyncMap m_toSync; }; @@ -65,7 +65,7 @@ class Orch virtual ~Orch(); vector getSelectables(); - bool hasSelectable(ConsumerTable* s) const; + bool hasSelectable(ConsumerStateTable* s) const; bool execute(string tableName); /* Iterate all consumers in m_consumerMap and run doTask(Consumer) */ diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index 2dcc33419dc7..68bdf81cff76 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -104,12 +104,12 @@ void OrchDaemon::start() continue; } - Orch *o = getOrchByConsumer((ConsumerTable *)s); - o->execute(((ConsumerTable *)s)->getTableName()); + Orch *o = getOrchByConsumer((ConsumerStateTable *)s); + o->execute(((ConsumerStateTable *)s)->getTableName()); } } -Orch *OrchDaemon::getOrchByConsumer(ConsumerTable *c) +Orch *OrchDaemon::getOrchByConsumer(ConsumerStateTable *c) { SWSS_LOG_ENTER(); diff --git a/orchagent/orchdaemon.h b/orchagent/orchdaemon.h index c92b7bdf5a1d..43c0a2a99532 100644 --- a/orchagent/orchdaemon.h +++ b/orchagent/orchdaemon.h @@ -2,7 +2,7 @@ #define SWSS_ORCHDAEMON_H #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "consumertable.h" #include "select.h" @@ -31,7 +31,7 @@ class OrchDaemon std::vector m_orchList; Select *m_select; - Orch *getOrchByConsumer(ConsumerTable *c); + Orch *getOrchByConsumer(ConsumerStateTable *c); }; #endif /* SWSS_ORCHDAEMON_H */ diff --git a/orchagent/routeresync.cpp b/orchagent/routeresync.cpp index 8e2becabcb4c..f8d50da38ec2 100644 --- a/orchagent/routeresync.cpp +++ b/orchagent/routeresync.cpp @@ -2,7 +2,7 @@ #include #include #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "logger.h" using namespace std; @@ -20,7 +20,7 @@ int main(int argc, char **argv) SWSS_LOG_ENTER(); DBConnector db(APPL_DB, "localhost", 6379, 0); - ProducerTable r(&db, APP_ROUTE_TABLE_NAME); + ProducerStateTable r(&db, APP_ROUTE_TABLE_NAME); if (argc != 2) { diff --git a/portsyncd/linksync.cpp b/portsyncd/linksync.cpp index c9a50fe142ec..a4bd9ff33f13 100644 --- a/portsyncd/linksync.cpp +++ b/portsyncd/linksync.cpp @@ -7,7 +7,7 @@ #include "logger.h" #include "netmsg.h" #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "tokenize.h" #include "linkcache.h" diff --git a/portsyncd/linksync.h b/portsyncd/linksync.h index dcb183a0c736..9e351857de0e 100644 --- a/portsyncd/linksync.h +++ b/portsyncd/linksync.h @@ -2,7 +2,7 @@ #define __LINKSYNC__ #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "netmsg.h" #include @@ -19,7 +19,7 @@ class LinkSync : public NetMsg virtual void onMsg(int nlmsg_type, struct nl_object *obj); private: - ProducerTable m_portTableProducer, m_vlanTableProducer, m_lagTableProducer; + ProducerStateTable m_portTableProducer, m_vlanTableProducer, m_lagTableProducer; Table m_portTableConsumer, m_vlanTableConsumer, m_lagTableConsumer; std::map m_ifindexNameMap; diff --git a/portsyncd/portsyncd.cpp b/portsyncd/portsyncd.cpp index 5f93cb026ecf..aa232e307394 100644 --- a/portsyncd/portsyncd.cpp +++ b/portsyncd/portsyncd.cpp @@ -2,7 +2,7 @@ #include "select.h" #include "netdispatcher.h" #include "netlink.h" -#include "producertable.h" +#include "producerstatetable.h" #include "portsyncd/linksync.h" #include @@ -44,7 +44,7 @@ void usage() cout << " default: /etc/network/interfaces.d/vlan_interfaces" << endl; } -void handlePortConfigFile(ProducerTable &p, string file); +void handlePortConfigFile(ProducerStateTable &p, string file); void handleVlanIntfFile(string file); int main(int argc, char **argv) @@ -73,7 +73,7 @@ int main(int argc, char **argv) } DBConnector db(0, "localhost", 6379, 0); - ProducerTable p(&db, APP_PORT_TABLE_NAME); + ProducerStateTable p(&db, APP_PORT_TABLE_NAME); LinkSync sync(&db); NetDispatcher::getInstance().registerMessageHandler(RTM_NEWLINK, &sync); @@ -134,7 +134,7 @@ int main(int argc, char **argv) return 1; } -void handlePortConfigFile(ProducerTable &p, string file) +void handlePortConfigFile(ProducerStateTable &p, string file) { cout << "Read port configuration file..." << endl; diff --git a/swssconfig/swssconfig.cpp b/swssconfig/swssconfig.cpp index 38ba57699d05..f21194cb58ac 100644 --- a/swssconfig/swssconfig.cpp +++ b/swssconfig/swssconfig.cpp @@ -8,7 +8,7 @@ #include "logger.h" #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "json.hpp" using namespace std; @@ -57,7 +57,7 @@ bool write_db_data(vector &db_items) } string table_name = key.substr(0, pos); string key_name = key.substr(pos + 1); - ProducerTable producer(&db, table_name); + ProducerStateTable producer(&db, table_name); if (kfvOp(db_item) == SET_COMMAND) producer.set(key_name, kfvFieldsValues(db_item), SET_COMMAND); diff --git a/teamsyncd/teamsync.cpp b/teamsyncd/teamsync.cpp index 227f1be462d5..85a61f76aa8d 100644 --- a/teamsyncd/teamsync.cpp +++ b/teamsyncd/teamsync.cpp @@ -7,7 +7,7 @@ #include "logger.h" #include "netmsg.h" #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "teamsync.h" using namespace std; @@ -88,7 +88,7 @@ const struct team_change_handler TeamSync::TeamPortSync::gPortChangeHandler = { }; TeamSync::TeamPortSync::TeamPortSync(const string &lagName, int ifindex, - ProducerTable *lagTable) : + ProducerStateTable *lagTable) : m_lagTable(lagTable), m_lagName(lagName), m_ifindex(ifindex) diff --git a/teamsyncd/teamsync.h b/teamsyncd/teamsync.h index ed3b4c8e84fd..bc353e1c7bf9 100644 --- a/teamsyncd/teamsync.h +++ b/teamsyncd/teamsync.h @@ -5,7 +5,7 @@ #include #include #include "dbconnector.h" -#include "producertable.h" +#include "producerstatetable.h" #include "selectable.h" #include "select.h" #include "netmsg.h" @@ -29,7 +29,7 @@ class TeamSync : public NetMsg public: enum { MAX_IFNAME = 64 }; TeamPortSync(const std::string &lagName, int ifindex, - ProducerTable *lagTable); + ProducerStateTable *lagTable); ~TeamPortSync(); virtual void addFd(fd_set *fd); @@ -43,7 +43,7 @@ class TeamSync : public NetMsg team_change_type_mask_t type_mask); static const struct team_change_handler gPortChangeHandler; private: - ProducerTable *m_lagTable; + ProducerStateTable *m_lagTable; struct team_handle *m_team; std::string m_lagName; int m_ifindex; @@ -56,7 +56,7 @@ class TeamSync : public NetMsg private: Select *m_select; - ProducerTable m_lagTable; + ProducerStateTable m_lagTable; std::map > m_teamPorts; };