diff --git a/cmd/batch-authz-review6_test.go b/cmd/batch-authz-review6_test.go index 90259f3cb..7fefe6f74 100644 --- a/cmd/batch-authz-review6_test.go +++ b/cmd/batch-authz-review6_test.go @@ -269,7 +269,6 @@ func TestBatchReviewRotationLeavesMovingSource(t *testing.T) { if !ri.Complete || ri.Failed || ri.PausedReason != "" || ri.Objects != 1 { t.Fatalf("resumed rotation: %+v", ri) } - } // Once a move copied a version, the rotation leaves it to a later run, so the diff --git a/cmd/batch-retry.go b/cmd/batch-retry.go index 97bc71a5b..16595cbcd 100644 --- a/cmd/batch-retry.go +++ b/cmd/batch-retry.go @@ -33,10 +33,13 @@ func batchUnavailable(reason string, err error) error { } return batchJobUnavailableError{reason: reason, err: err} } + func isBatchJobUnavailable(err error) bool { var e batchJobUnavailableError; return errors.As(err, &e) } + func isBatchJobStopped(err error) bool { return isBatchJobAuthzError(err) || isBatchJobUnavailable(err) } + func batchListingError(err error) error { if isErrBucketNotFound(err) { return err @@ -54,6 +57,7 @@ func (ri *batchJobInfo) pause(err error) { ri.Complete, ri.Failed = false, false ri.PausedReason = err.Error() } + func (ri *batchJobInfo) savePaused(ctx context.Context, api ObjectLayer, job BatchJobRequest, err error) error { ri.pause(err) globalBatchJobsMetrics.save(job.ID, ri) @@ -83,8 +87,10 @@ func validateBatchJobAdminReq(ctx context.Context, w http.ResponseWriter, r *htt var principal batchJobPrincipal principal, err = submitter.principal(ctx) if err == nil { - err = principal.authorizeArgs(policy.Args{AccountName: cred.AccessKey, Groups: cred.Groups, - Action: policy.Action(policy.StartBatchJobAction), ConditionValues: getConditionValues(r, "", cred), IsOwner: owner, Claims: principal.claims}, nil) + err = principal.authorizeArgs(policy.Args{ + AccountName: cred.AccessKey, Groups: cred.Groups, + Action: policy.Action(policy.StartBatchJobAction), ConditionValues: getConditionValues(r, "", cred), IsOwner: owner, Claims: principal.claims, + }, nil) } } if err != nil { @@ -119,6 +125,7 @@ func (j *BatchJobPool) beginJob(job *BatchJobRequest) bool { o.state = "running" return true } + func (j *BatchJobPool) finishJob(job *BatchJobRequest, err error) { j.jmu.Lock() defer j.jmu.Unlock() @@ -156,6 +163,7 @@ func (j *BatchJobPool) retryDue(now time.Time) { } } } + func (j *BatchJobPool) retryLoop() { ticker := time.NewTicker(time.Second) defer ticker.Stop() diff --git a/cmd/erasure-server-pool-lifecycle-authority_test.go b/cmd/erasure-server-pool-lifecycle-authority_test.go index 3c3f3e5d5..6bfbd563c 100644 --- a/cmd/erasure-server-pool-lifecycle-authority_test.go +++ b/cmd/erasure-server-pool-lifecycle-authority_test.go @@ -634,7 +634,6 @@ func TestPoolsLifecycleMissingVersion(t *testing.T) { // The completeness checks also hold where a set has fewer answering drives // than a read quorum or no version reaches one. func TestPoolsLifecycleHistoryEarlyReturns(t *testing.T) { - // Seven drives hold the key, the other nine do not have it at all. t.Run("minority-copy-only", func(t *testing.T) { s := newSplitILM(t, versioning.Enabled, splitILMRules) @@ -1245,14 +1244,6 @@ func TestPoolsLifecycleNullGenerations(t *testing.T) { } } -// authoritySideEffects collects the version IDs that removal notifications -// and ILM expiry audit traces report. -func authoritySideEffects(t *testing.T, run func()) (notified, traced []string) { - t.Helper() - notified, traced, _ = authoritySideEffectsAll(t, run) - return notified, traced -} - // authoritySideEffectsAll also returns, by version ID, the result an ILM // trace reports for an expiry that did not remove its version: "refused" or // "failed". Such traces are not removal traces. diff --git a/cmd/erasure-server-pool-tier-ownership.go b/cmd/erasure-server-pool-tier-ownership.go index 4facddaf4..17ac7edc4 100644 --- a/cmd/erasure-server-pool-tier-ownership.go +++ b/cmd/erasure-server-pool-tier-ownership.go @@ -195,9 +195,11 @@ func (z *erasureServerPools) deleteTierTupleLocked(ctx context.Context, bucket, // also checks the free marker and tuple, so a stale cleanup cannot remove // a different revision with the same local version ID. for _, record := range records { - fi := FileInfo{VersionID: record.info.VersionID, + fi := FileInfo{ + VersionID: record.info.VersionID, TransitionTier: tuple.Tier, TransitionedObjName: tuple.Object, - TransitionVersionID: tuple.VersionID} + TransitionVersionID: tuple.VersionID, + } fi.SetTierFreeVersion() err := record.disk.DeleteVersion(ctx, bucket, object, fi, false, DeleteOptions{}) if err != nil && !errors.Is(err, errFileNotFound) && !errors.Is(err, errFileVersionNotFound) { diff --git a/cmd/logging.go b/cmd/logging.go index 9c24ae22d..22109276e 100644 --- a/cmd/logging.go +++ b/cmd/logging.go @@ -140,10 +140,6 @@ func scannerLogOnceIf(ctx context.Context, err error, id string, errKind ...any) logger.LogOnceIf(ctx, "scanner", err, id, errKind...) } -func ilmLogIf(ctx context.Context, err error, errKind ...any) { - logger.LogIf(ctx, "ilm", err, errKind...) -} - func ilmLogOnceIf(ctx context.Context, err error, id string, errKind ...any) { logger.LogOnceIf(ctx, "ilm", err, id, errKind...) } diff --git a/internal/config/policy/plugin/config_test.go b/internal/config/policy/plugin/config_test.go index a32b9a883..bd3e51016 100644 --- a/internal/config/policy/plugin/config_test.go +++ b/internal/config/policy/plugin/config_test.go @@ -19,11 +19,18 @@ func TestAuthZPluginExplicitDecision(t *testing.T) { status int allow, fail bool }{ - {`{"result":true}`, 200, true, false}, {`{"result":false}`, 200, false, false}, - {`{"result":{"allow":true}}`, 200, true, false}, {`{"result":{"allow":false}}`, 200, false, false}, - {`{"result":true}`, 503, false, true}, {`{"result":true}`, 403, false, true}, - {`{}`, 200, false, true}, {`{"error":"unavailable"}`, 200, false, true}, {`{"result":null}`, 200, false, true}, - {`{"result":{}}`, 200, false, true}, {`{"result":{"allow":null}}`, 200, false, true}, {`{"result":"true"}`, 200, false, true}, + {`{"result":true}`, 200, true, false}, + {`{"result":false}`, 200, false, false}, + {`{"result":{"allow":true}}`, 200, true, false}, + {`{"result":{"allow":false}}`, 200, false, false}, + {`{"result":true}`, 503, false, true}, + {`{"result":true}`, 403, false, true}, + {`{}`, 200, false, true}, + {`{"error":"unavailable"}`, 200, false, true}, + {`{"result":null}`, 200, false, true}, + {`{"result":{}}`, 200, false, true}, + {`{"result":{"allow":null}}`, 200, false, true}, + {`{"result":"true"}`, 200, false, true}, {`{"result":true} garbage`, 200, false, true}, } { t.Run(tc.body+http.StatusText(tc.status), func(t *testing.T) {