Skip to content

Commit

Permalink
Refactor Orch class to separate recorder implementation (sonic-net#2837)
Browse files Browse the repository at this point in the history
**What I did**

1) Removed the recorder implementation from the Orch class and added a new Recorder Interface
2) Removed the exposure of recorder related global variables from the CfgMgrs and Orchagent
3) Writing the Kfv tuple to the Rec file was moved from the Orch class into the ConsumerBase
4) Moved the gBatchSize declaration into the Orch and thereby removing the need to explicitly declare the global variable in CfgMgrs

**Why I did it**

Recorder implementation should not be tied to Orchagent

**How I verified it**

Install the swss on the switch and verified

```
root@r-lionfish-16:/home/admin# show logging | grep Recorder
Jun 23 19:26:15.741815 sonic NOTICE swss#orchagent: :- startRec: SwSS Recorder: Recording started at /var/log/swss/swss.rec
Jun 23 19:29:09.514177 sonic INFO swss#orchagent: :- logfileReopen: SwSS Recorder: LogRotate request handled
```

**Verify Logrotate:**

```
root@r-lionfish-16:/home/admin# ls -l /var/log/swss/
total 2752
-rw-r--r-- 1 root root  999877 Jun 23 19:26 sairedis.rec
-rw-r--r-- 1 root root 1559947 Jun 23 19:11 sairedis.rec.1
-rw-r--r-- 1 root root  110563 Jun 23 19:27 swss.rec
-rw-r--r-- 1 root root  141713 Jun 23 19:16 swss.rec.1


root@r-lionfish-16:/home/admin# logrotate -f /etc/logrotate.conf  (Force Logrotate)

root@r-lionfish-16:/home/admin# ls -l /var/log/swss/
total 1232
-rw-r--r-- 1 root root    140 Jun 23 19:28 sairedis.rec
-rw-r--r-- 1 root root 999877 Jun 23 19:26 sairedis.rec.1
-rw-r--r-- 1 root root 126798 Jun 23 19:11 sairedis.rec.2.gz
-rw-r--r-- 1 root root      0 Jun 23 19:28 swss.rec
-rw-r--r-- 1 root root 110563 Jun 23 19:27 swss.rec.1
-rw-r--r-- 1 root root  13089 Jun 23 19:16 swss.rec.2.gz

<After some time>

root@r-lionfish-16:/home/admin# ls -l /var/log/swss/
total 1476
-rw-r--r-- 1 root root 242404 Jun 23 19:29 sairedis.rec
-rw-r--r-- 1 root root 999877 Jun 23 19:26 sairedis.rec.1
-rw-r--r-- 1 root root 126798 Jun 23 19:11 sairedis.rec.2.gz
-rw-r--r-- 1 root root   1764 Jun 23 19:29 swss.rec
-rw-r--r-- 1 root root 110645 Jun 23 19:29 swss.rec.1
-rw-r--r-- 1 root root  13089 Jun 23 19:16 swss.rec.2.gz
```
  • Loading branch information
vivekrnv authored and theasianpianist committed Jul 21, 2023
1 parent df04802 commit 02ecf1d
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions orchagent/orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,6 @@ Orch::Orch()
{
}

ZmqOrch::ZmqOrch(DBConnector *db, const string tableName, int pri, ZmqServer *zmqServer)
: Orch()
{
addConsumer(db, tableName, pri, zmqServer);
}

ZmqOrch::ZmqOrch(DBConnector *db, const vector<string> &tableNames, ZmqServer *zmqServer)
: Orch()
{
for (auto it : tableNames)
{
addConsumer(db, it, default_orch_pri, zmqServer);
}
}

ZmqOrch::ZmqOrch(DBConnector *db, const vector<table_name_with_pri_t> &tableNames_with_pri, ZmqServer *zmqServer)
: Orch()
{
for (const auto& it : tableNames_with_pri)
{
addConsumer(db, it.first, it.second, zmqServer);
}
}

vector<Selectable *> Orch::getSelectables()
{
vector<Selectable *> selectables;
Expand Down

0 comments on commit 02ecf1d

Please sign in to comment.