Skip to content

Fixing log cleanup candidate selection and adding a test for it. - #6096

Merged
bryancall merged 1 commit into
apache:masterfrom
bneradt:fix_log_retention
Oct 30, 2019
Merged

bryancall merged 1 commit into
apache:masterfrom
bneradt:fix_log_retention

Conversation

@bneradt

@bneradt bneradt commented Oct 29, 2019

Copy link
Copy Markdown
Contributor

I added comments which I hope make it clear what the change fixes. We were not determining the base (pre-rolled) log file name correctly when trying to derive the deleting_info key. This broke log cleanup because the rolled candidates list for deletion options never got populated.

This also adds a log retention test that verifies this fix.

@bryancall bryancall added this to the 10.0.0 milestone Oct 29, 2019
@bryancall
bryancall merged commit c9c8855 into apache:master Oct 30, 2019
@ywkaras

ywkaras commented Oct 30, 2019

Copy link
Copy Markdown

Would be nice, in a follow-on PR, if the gold test checked whether deletion occurred and brought space used by log files below the configured maximum.

tr = Test.AddTestRun()
# At 5K a log entry, we need a lot of curl'd requests to get to the 10 MB roll
# minimum.
curl_commands = 'for i in {{1..2500}}; do curl "http://127.1.1.1:{0}" --verbose; done'.format(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: you don't need the double braces here:

$ echo {1..2} {{1..2}}
1 2 {1} {2}

I think using the while loop in my original suggestion might be more portable. Generating a string with more than 10,000 characters may exceeded internal buffer limitations of some bash implementations.

curl_commands = 'for i in {{1..2500}}; do curl "http://127.1.1.1:{0}" --verbose; done'.format(
ts.Variables.port)
tr.Processes.Default.Command = curl_commands
tr.Processes.Default.ReturnCode = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran this test:

wkaras ~/REPOS/TS2
M$ for i in 1 2 ; do \rm not-there ; echo x ; done ; echo $?
rm: not-there: No such file or directory
x
rm: not-there: No such file or directory
x
0
wkaras ~/REPOS/TS2
M$ for i in 1 2 ; do \rm not-there ; done ; echo $?
rm: not-there: No such file or directory
rm: not-there: No such file or directory
1
wkaras ~/REPOS/TS2
M$

This indicates that we would only have to worry about the last curl command failing and causing a non-zero return code. But if Jason is correct that the curl command is flakey, then checking the return code does seem to create some risk of occasional spurious failures of this gold test.

@zwoop

zwoop commented Nov 4, 2019

Copy link
Copy Markdown
Contributor

Cherry-picked to v9.0.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants