ilm: Remove a 'null' version if not latest (#10494)

If the ILM document requires removing noncurrent versions, the 
the server should be able to remove 'null' versions as well. 
'null' versions are created when versioning is not enabled 
or suspended.
This commit is contained in:
Anis Elleuch 2020-09-16 18:21:50 +01:00 committed by GitHub
parent b2536476c9
commit 24cab7f9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -103,11 +103,17 @@ func (fi FileInfo) ToObjectInfo(bucket, object string) ObjectInfo {
IsDir: true,
}
}
versionID := fi.VersionID
if globalBucketVersioningSys.Enabled(bucket) && versionID == "" {
versionID = nullVersionID
}
objInfo := ObjectInfo{
IsDir: false,
Bucket: bucket,
Name: object,
VersionID: fi.VersionID,
VersionID: versionID,
IsLatest: fi.IsLatest,
DeleteMarker: fi.Deleted,
Size: fi.Size,