From 3e196fa7b39ea9dcc8b28fdc06fd67cd36c8f614 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 14 Jul 2023 16:42:35 -0700 Subject: [PATCH] fix: ILM newer noncurrent version limit must return correct versions (#17652) objects/versions that are not expired via NewerNoncurrentVersions must be properly returned to be applied under further ILM actions. this would cause legitimately expired objects to be missed from expiration. --- .github/workflows/mint.yml | 20 ++++++++++++++------ .github/workflows/run-mint.sh | 9 +++++++-- cmd/data-scanner.go | 6 +++--- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/mint.yml b/.github/workflows/mint.yml index b6b6a154f..c454bb9d2 100644 --- a/.github/workflows/mint.yml +++ b/.github/workflows/mint.yml @@ -3,7 +3,7 @@ name: Mint Tests on: pull_request: branches: - - master + - master # This ensures that previous jobs for the PR are canceled when the PR is # updated. @@ -37,8 +37,7 @@ jobs: - name: build-minio run: | - make install - docker build . -t "minio/minio:${{ steps.vars.outputs.sha_short }}" + TAG="minio/minio:${{ steps.vars.outputs.sha_short }}" make docker - name: compress and encrypt run: | @@ -51,7 +50,16 @@ jobs: - name: standalone erasure run: | ${GITHUB_WORKSPACE}/.github/workflows/run-mint.sh "erasure" "minio" "minio123" "${{ steps.vars.outputs.sha_short }}" + + - name: The job must cleanup + if: ${{ always() }} + run: | + export JOB_NAME=${{ steps.vars.outputs.sha_short }} + for mode in $(echo compress-encrypt pools erasure); do + docker-compose -f ${GITHUB_WORKSPACE}/.github/workflows/mint/minio-${mode}.yaml down || true + docker-compose -f ${GITHUB_WORKSPACE}/.github/workflows/mint/minio-${mode}.yaml rm || true + done docker rmi -f minio/minio:${{ steps.vars.outputs.sha_short }} - - - + docker system prune -f || true + docker volume prune -f || true + docker volume rm $(docker volume ls -q -f dangling=true) || true diff --git a/.github/workflows/run-mint.sh b/.github/workflows/run-mint.sh index e1ecaad8d..90469058b 100755 --- a/.github/workflows/run-mint.sh +++ b/.github/workflows/run-mint.sh @@ -18,8 +18,13 @@ cd .github/workflows/mint docker-compose -f minio-${MODE}.yaml up -d sleep 5m +docker system prune -f || true +docker volume prune -f || true +docker volume rm $(docker volume ls -q -f dangling=true) || true + # Stop two nodes, one of each pool, to check that all S3 calls work while quorum is still there -[ "${MODE}" == "pools" ] && docker-compose -f minio-${MODE}.yaml stop minio{2,6} +[ "${MODE}" == "pools" ] && docker-compose -f minio-${MODE}.yaml stop minio2 +[ "${MODE}" == "pools" ] && docker-compose -f minio-${MODE}.yaml stop minio6 docker run --rm --net=mint_default \ --name="mint-${MODE}-${JOB_NAME}" \ @@ -35,7 +40,7 @@ sleep 10s docker system prune -f || true docker volume prune -f || true -docker volume rm $(docker volume ls -f dangling=true) || true +docker volume rm $(docker volume ls -q -f dangling=true) || true ## change working directory cd ../../../ diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index a87f404f4..67f1ff220 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -403,7 +403,7 @@ func (f *folderScanner) scanFolder(ctx context.Context, folder cachedFolder, int abandonedChildren = f.oldCache.findChildrenCopy(thisHash) } - // If there are lifecycle rules for the prefix, remove the filter. + // If there are lifecycle rules for the prefix. _, prefix := path2BucketObjectWithBasePath(f.root, folder.name) var activeLifeCycle *lifecycle.Lifecycle if f.oldCache.Info.lifeCycle != nil && f.oldCache.Info.lifeCycle.HasActiveRules(prefix) { @@ -412,7 +412,7 @@ func (f *folderScanner) scanFolder(ctx context.Context, folder cachedFolder, int } activeLifeCycle = f.oldCache.Info.lifeCycle } - // If there are replication rules for the prefix, remove the filter. + // If there are replication rules for the prefix. var replicationCfg replicationConfig if !f.oldCache.Info.replication.Empty() && f.oldCache.Info.replication.Config.HasActiveRules(prefix, true) { replicationCfg = f.oldCache.Info.replication @@ -1044,7 +1044,7 @@ func (i *scannerItem) applyNewerNoncurrentVersionLimit(ctx context.Context, _ Ob if time.Now().UTC().Before(lifecycle.ExpectedExpiryTime(obj.SuccessorModTime, event.NoncurrentDays)) { // add this version back to remaining versions for // subsequent lifecycle policy applications - fivs = append(fivs, fi) + objectInfos = append(objectInfos, obj) continue }