Skip to content

Commit

Permalink
chore(deps): improve the way of locar to delete multi-depth directori…
Browse files Browse the repository at this point in the history
…es (#422)
  • Loading branch information
sergeyberezansky authored Jan 15, 2025
2 parents 074966c + f2ffff9 commit 75e4890
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ FROM registry.access.redhat.com/ubi9/ubi:${UBI_HASH}
LABEL maintainers="WekaIO, LTD"
LABEL description="Weka CSI Driver"

RUN dnf install -y util-linux libselinux-utils pciutils binutils jq
RUN dnf install -y util-linux libselinux-utils pciutils binutils jq procps less
RUN mkdir -p /licenses
COPY LICENSE /licenses
COPY --from=kubectl /bin/kubectl /bin/kubectl
Expand Down
6 changes: 4 additions & 2 deletions pkg/wekafs/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ func (gc *innerPathVolGc) purgeLeftovers(ctx context.Context, fs string, apiClie

if fileExists("/locar") {
logger.Debug().Msg("Using locar for fast deletion")
deleteCmd := exec.Command("bash", "-c", fmt.Sprintf("/locar --type dir %s | /usr/bin/xargs -P32 -n128 rm -rf", volumeTrashLoc))
deleteCmd := exec.Command("bash", "-c",
fmt.Sprintf("/locar --type file %s | xargs -P128 -n128 rm -f 2>&1 | wc -l; /locar --type dir %s | /usr/bin/xargs -P128 -n128 rm -rf 2>&1 | wc -l", volumeTrashLoc, volumeTrashLoc),
)
output, err := deleteCmd.CombinedOutput()
if err != nil {
logger.Error().Err(err).Msg("Error running locar")
logger.Trace().Str("output", string(output)).Msg("Locar output")
}
logger.Trace().Str("output", string(output)).Msg("Locar output")
} else {
logger.Debug().Msg("Using default deletion method")
if err := os.RemoveAll(volumeTrashLoc); err != nil {
Expand Down

0 comments on commit 75e4890

Please sign in to comment.