Skip to content

Commit 9ef1856

Browse files
committed
Revert "[counter] Clear counter table when dhcpmon init (sonic-net#14)"
This reverts commit bace2e0.
1 parent f517db8 commit 9ef1856

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

src/dhcp_device.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,6 @@ void update_vlan_mapping(std::shared_ptr<swss::DBConnector> db_conn) {
194194
}
195195
}
196196

197-
198-
/**
199-
* @code clear_counter(std::shared_ptr<swss::DBConnector> state_db);
200-
*
201-
* @brief Clear all counter
202-
*
203-
* @param state_db state_db connector pointer
204-
*
205-
*/
206-
void clear_counter(std::shared_ptr<swss::DBConnector> state_db) {
207-
std::string match_pattern = DB_COUNTER_TABLE + std::string("*");
208-
auto keys = state_db->keys(match_pattern);
209-
210-
for (auto &itr : keys) {
211-
state_db->del(itr);
212-
}
213-
}
214-
215-
216197
/** update ethernet interface to port-channel map
217198
* PORTCHANNEL_MEMBER|PortChannel101|Ethernet112
218199
*/
@@ -284,6 +265,7 @@ void initialize_db_counters(std::string &ifname)
284265
{
285266
auto table_name = DB_COUNTER_TABLE + ifname;
286267
auto init_value = gen_counter_json_str(db_counter);
268+
mStateDbPtr->del(table_name);
287269
mStateDbPtr->hset(table_name, "RX", init_value);
288270
mStateDbPtr->hset(table_name, "TX", init_value);
289271
}
@@ -942,7 +924,6 @@ int dhcp_device_start_capture(size_t snaplen, struct event_base *base, in_addr_t
942924

943925
init_recv_buffers(snaplen);
944926

945-
clear_counter(mStateDbPtr);
946927
update_vlan_mapping(mConfigDbPtr);
947928
update_portchannel_mapping(mConfigDbPtr);
948929
update_mgmt_mapping();

0 commit comments

Comments
 (0)