Skip to content

Commit

Permalink
modify bug : clean cache in Alluxio due to unknown linux release vers…
Browse files Browse the repository at this point in the history
…ion (#1487)

* remove duplicates in Makefile

Signed-off-by: wangxu <[email protected]>

* deal with issue 1476

Signed-off-by: wangxu <[email protected]>

Co-authored-by: wangxu <[email protected]>
  • Loading branch information
haoeeeee and wangxu authored Mar 2, 2022
1 parent 2727bc7 commit 3d66068
Showing 1 changed file with 2 additions and 15 deletions.
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

0 comments on commit 3d66068

Please sign in to comment.