Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent log purging of symlinks #5154

Merged
merged 1 commit into from
Sep 5, 2019
Merged

Conversation

adsr
Copy link
Collaborator

@adsr adsr commented Sep 3, 2019

This prevents purging of current log files, i.e., logs that are pointed to by a symlink such as vttablet.INFO. Previously we were allowed to delete the current log file if the underlying log file was low volume and had an mtime that put it beyond the retention period.

Signed-off-by: Adam Saponara as@php.net

@adsr adsr requested a review from sougou as a code owner September 3, 2019 21:44
@adsr adsr closed this Sep 4, 2019
@adsr adsr reopened this Sep 4, 2019
for _, level := range levels {
c, err := filepath.EvalSymlinks(path.Join(dir, fmt.Sprintf("%s.%s", program, level)))
symPath := path.Join(dir, fmt.Sprintf("%s.%s", program, level))
hardPath, err := filepath.EvalSymlinks(symPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

This example from the os package may be a more reliable way to test for symlink: https://play.golang.org/p/VHdX7KlARqI. In fact, you should probably do check for a mode.IsRegular(), which will take care of other weird things like directory, etc.

Signed-off-by: Adam Saponara <as@php.net>
@sougou sougou merged commit ed6d0dd into vitessio:master Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants