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

modify bug : clean cache in Alluxio due to unknown linux release version #1487

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions pkg/ddc/alluxio/operations/cached.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,13 @@ func (a AlluxioFileUtils) CachedState() (cached int64, err error) {
// clean cache with a preset timeout of 60s
func (a AlluxioFileUtils) CleanCache(path string) (err error) {
var (
releaseVersion = []string{"cat", "/etc/issue"}
command = []string{"60", "alluxio", "fs", "free", "-f", path}
stdout string
stderr string
)

stdout, stderr, err = a.exec(releaseVersion, false)
if err != nil {
err = fmt.Errorf("execute command %v with expectedErr: %v stdout %s and stderr %s", releaseVersion, err, stdout, stderr)
return
}

if strings.Contains(stdout, "Ubuntu") {
command = append([]string{"timeout"}, command...)
} else if strings.Contains(stdout, "Alpine") {
command = append([]string{"timeout", "-t"}, command...)
} else {
err = fmt.Errorf("unknow release version for linux")
return
}
//TODO : find solution to use "timeout" or "timeout -t" in different linux release
command = append([]string{"timeout"}, command...)

stdout, stderr, err = a.exec(command, false)
if err != nil {
Expand Down