IMPALA-11184: Use ProgramInvocationShortName for log glob pattern

Impala uses FLAGS_log_filename as log symlink name and as part of the
glob pattern during log rotation. The user will not set this flag in
most cases, and it will default to google::ProgramInvocationShortName().
But if the user sets a custom value to this flag, the glob pattern will
mistakenly target the symlink instead of the actual log files. This
leads to a wrong behavior of DeleteOldLogs() and
GetLatestCanonicalLogPath().

This patch replace FLAGS_log_filename with
google::ProgramInvocationShortName() in glob pattern.

Testing:
- Pass simple-logger-test
- Pass exhaustive test_breakpad.py::TestLogging

Change-Id: I6c71bdb67f70c571d18fb8630d4a816ab75686fa
Reviewed-on: http://gerrit.cloudera.org:8080/18326
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Riza Suminto
2022-03-16 14:13:26 -07:00
committed by Impala Public Jenkins
parent 9149345f1f
commit 87f3dc294f
4 changed files with 28 additions and 10 deletions

View File

@@ -476,7 +476,7 @@ class TestLogging(TestBreakpadBase):
time.sleep(1)
self.assert_logs(daemon, expected_log_max_count, expected_log_max_bytes)
if (remove_symlink):
pattern = self.tmp_dir + '/' + daemon + '*.'
pattern = self.tmp_dir + '/' + daemon + '*'
symlinks = glob.glob(pattern + '.INFO') + glob.glob(pattern + '.ERROR')
for symlink in symlinks:
self.silent_remove(symlink)