Skip to content

Commit

Permalink
[orchdaemon]: Fixed sairedis record file rotation
Browse files Browse the repository at this point in the history
What I did
Fix sonic-net/sonic-buildimage#8162

Moved sairedis record file rotation logic out of flush() to fix issue.

Why I did it
Sairedis record file was not releasing the file handle on rotation. This is because the file handle release was inside the flush() which was only being called if a select timeout was triggered. Moved the logic to its own function which is called in the start() loop.

How I verified it
Ran a script to fill log and verified that rotation was happening correctly.

Signed-off-by: Bryan Crossland bryan.crossland@target.com
  • Loading branch information
bacrossland committed Oct 4, 2022
1 parent 54168d7 commit de218ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ void OrchDaemon::logRotate() {
}
}


void OrchDaemon::start()
{
SWSS_LOG_ENTER();
Expand Down
8 changes: 4 additions & 4 deletions tests/mock_tests/orchdaemon_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ namespace orchdaemon_test
};

TEST_F(OrchDaemonTest, logRotate)
{
EXPECT_CALL(mock_sai_switch_, set_switch_attribute( _, _)).WillOnce(Return(SAI_STATUS_SUCCESS));
{
EXPECT_CALL(mock_sai_switch_, set_switch_attribute( _, _)).WillOnce(Return(SAI_STATUS_SUCCESS));

orchd->logRotate();
}
orchd->logRotate();
}
}

0 comments on commit de218ea

Please sign in to comment.