You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2018/10/15 20:35:59 UTC
[trafficserver] branch master updated: Fix logging log file roll
issue (#2544).
This is an automated email from the ASF dual-hosted git repository.
amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 6714846 Fix logging log file roll issue (#2544).
6714846 is described below
commit 67148468717b7116019a991d9c0f41a892bdbe05
Author: Peter Chou <pb...@labs.att.com>
AuthorDate: Thu Oct 4 22:08:31 2018 -0700
Fix logging log file roll issue (#2544).
Perform the BaseLogFile::close_file() operation when rolling log files generated by the logging system.
Do not perform this operation for diagnostic log files (this was removed by commit 346b419).
---
proxy/logging/LogFile.cc | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/proxy/logging/LogFile.cc b/proxy/logging/LogFile.cc
index efb8f12..7d70bbd 100644
--- a/proxy/logging/LogFile.cc
+++ b/proxy/logging/LogFile.cc
@@ -247,7 +247,20 @@ int
LogFile::roll(long interval_start, long interval_end)
{
if (m_log) {
- return m_log->roll(interval_start, interval_end);
+ // Due to commit 346b419 the BaseLogFile::close_file() is no longer called within BaseLogFile::roll().
+ // For diagnostic log files, the rolling is implemented by renaming and destroying the BaseLogFile object
+ // and then creating a new BaseLogFile object with the original filename. Due to possible race conditions
+ // the old/new object swap happens within lock/unlock calls within Diags.cc.
+ // For logging log files, the rolling is implemented by renaming the original file and closing it.
+ // Afterwards, the LogFile object will re-open a new file with the original file name using the original object.
+ // There is no need to protect against contention since the open/close/writes are all executed under a
+ // single log flush thread.
+ // Since these two methods of using BaseLogFile are not compatible, we perform the logging log file specific
+ // close file operation here within the containing LogFile object.
+ if (m_log->roll(interval_start, interval_end)) {
+ m_log->close_file();
+ return 1;
+ }
}
return 0;