mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
fix: delete marker discrepancies via DeleteObject() API (#16195)
This commit is contained in:
parent
b03dd1af17
commit
dfe73629a3
2
.github/workflows/vulncheck.yml
vendored
2
.github/workflows/vulncheck.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.x
|
go-version: 1.19
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Get official govulncheck
|
- name: Get official govulncheck
|
||||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
|
@ -1556,13 +1556,24 @@ func (er erasureObjects) DeleteObject(ctx context.Context, bucket, object string
|
|||||||
defer NSUpdated(bucket, object)
|
defer NSUpdated(bucket, object)
|
||||||
|
|
||||||
storageDisks := er.getDisks()
|
storageDisks := er.getDisks()
|
||||||
|
versionFound := true
|
||||||
// Determine whether to mark object deleted for replication
|
objInfo = ObjectInfo{VersionID: opts.VersionID} // version id needed in Delete API response.
|
||||||
var markDelete bool
|
goi, _, gerr := er.getObjectInfoAndQuorum(ctx, bucket, object, opts)
|
||||||
|
if gerr != nil && goi.Name == "" {
|
||||||
|
switch gerr.(type) {
|
||||||
|
case InsufficientReadQuorum:
|
||||||
|
return objInfo, InsufficientWriteQuorum{}
|
||||||
|
}
|
||||||
|
// For delete marker replication, versionID being replicated will not exist on disk
|
||||||
|
if opts.DeleteMarker {
|
||||||
|
versionFound = false
|
||||||
|
} else {
|
||||||
|
return objInfo, gerr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if opts.Expiration.Expire {
|
if opts.Expiration.Expire {
|
||||||
goi, _, err := er.getObjectInfoAndQuorum(ctx, bucket, object, opts)
|
if gerr == nil {
|
||||||
if err == nil {
|
|
||||||
evt := evalActionFromLifecycle(ctx, *lc, rcfg, goi)
|
evt := evalActionFromLifecycle(ctx, *lc, rcfg, goi)
|
||||||
var isErr bool
|
var isErr bool
|
||||||
switch evt.Action {
|
switch evt.Action {
|
||||||
@ -1584,15 +1595,12 @@ func (er erasureObjects) DeleteObject(ctx context.Context, bucket, object string
|
|||||||
Object: object,
|
Object: object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
markDelete = goi.VersionID != ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
versionFound := !(opts.DeleteMarker && opts.VersionID != "")
|
// Determine whether to mark object deleted for replication
|
||||||
|
markDelete := goi.VersionID != ""
|
||||||
|
|
||||||
if !markDelete {
|
|
||||||
markDelete = !opts.DeleteMarker && opts.VersionID != ""
|
|
||||||
}
|
|
||||||
// Default deleteMarker to true if object is under versioning
|
// Default deleteMarker to true if object is under versioning
|
||||||
// versioning suspended means we add `null` version as
|
// versioning suspended means we add `null` version as
|
||||||
// delete marker, if its not decided already.
|
// delete marker, if its not decided already.
|
||||||
@ -1628,11 +1636,10 @@ func (er erasureObjects) DeleteObject(ctx context.Context, bucket, object string
|
|||||||
ExpireRestored: opts.Transition.ExpireRestored,
|
ExpireRestored: opts.Transition.ExpireRestored,
|
||||||
}
|
}
|
||||||
fi.SetTierFreeVersionID(fvID)
|
fi.SetTierFreeVersionID(fvID)
|
||||||
if opts.Versioned {
|
if opts.VersionID != "" {
|
||||||
|
fi.VersionID = opts.VersionID
|
||||||
|
} else if opts.Versioned {
|
||||||
fi.VersionID = mustGetUUID()
|
fi.VersionID = mustGetUUID()
|
||||||
if opts.VersionID != "" {
|
|
||||||
fi.VersionID = opts.VersionID
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// versioning suspended means we add `null` version as
|
// versioning suspended means we add `null` version as
|
||||||
// delete marker. Add delete marker, since we don't have
|
// delete marker. Add delete marker, since we don't have
|
||||||
|
Loading…
Reference in New Issue
Block a user