mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
xl: Delete older data-dir when replacing an existing version-id (#16176)
This commit is contained in:
parent
932d2c3c62
commit
1bae32dc96
@ -2329,35 +2329,42 @@ func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath string, f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldDstDataPath string
|
var oldDstDataPath, reqVID string
|
||||||
|
|
||||||
if fi.VersionID == "" {
|
if fi.VersionID == "" {
|
||||||
// return the latest "null" versionId info
|
reqVID = nullVersionID
|
||||||
ofi, err := xlMeta.ToFileInfo(dstVolume, dstPath, nullVersionID)
|
} else {
|
||||||
if err == nil && !ofi.Deleted {
|
reqVID = fi.VersionID
|
||||||
if xlMeta.SharedDataDirCountStr(nullVersionID, ofi.DataDir) == 0 {
|
}
|
||||||
// Purge the destination path as we are not preserving anything
|
|
||||||
// versioned object was not requested.
|
// Replace the data of null version or any other existing version-id
|
||||||
oldDstDataPath = pathJoin(dstVolumeDir, dstPath, ofi.DataDir)
|
ofi, err := xlMeta.ToFileInfo(dstVolume, dstPath, reqVID)
|
||||||
// if old destination path is same as new destination path
|
if err == nil && !ofi.Deleted {
|
||||||
// there is nothing to purge, this is true in case of healing
|
if xlMeta.SharedDataDirCountStr(reqVID, ofi.DataDir) == 0 {
|
||||||
// avoid setting oldDstDataPath at that point.
|
// Purge the destination path as we are not preserving anything
|
||||||
if oldDstDataPath == dstDataPath {
|
// versioned object was not requested.
|
||||||
oldDstDataPath = ""
|
oldDstDataPath = pathJoin(dstVolumeDir, dstPath, ofi.DataDir)
|
||||||
}
|
// if old destination path is same as new destination path
|
||||||
xlMeta.data.remove(nullVersionID, ofi.DataDir)
|
// there is nothing to purge, this is true in case of healing
|
||||||
|
// avoid setting oldDstDataPath at that point.
|
||||||
|
if oldDstDataPath == dstDataPath {
|
||||||
|
oldDstDataPath = ""
|
||||||
|
} else {
|
||||||
|
xlMeta.data.remove(reqVID, ofi.DataDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Empty fi.VersionID indicates that versioning is either
|
}
|
||||||
// suspended or disabled on this bucket. RenameData will replace
|
|
||||||
// the 'null' version. We add a free-version to track its tiered
|
// Empty fi.VersionID indicates that versioning is either
|
||||||
// content for asynchronous deletion.
|
// suspended or disabled on this bucket. RenameData will replace
|
||||||
if !fi.IsRestoreObjReq() {
|
// the 'null' version. We add a free-version to track its tiered
|
||||||
// Note: Restore object request reuses PutObject/Multipart
|
// content for asynchronous deletion.
|
||||||
// upload to copy back its data from the remote tier. This
|
if fi.VersionID == "" && !fi.IsRestoreObjReq() {
|
||||||
// doesn't replace the existing version, so we don't need to add
|
// Note: Restore object request reuses PutObject/Multipart
|
||||||
// a free-version.
|
// upload to copy back its data from the remote tier. This
|
||||||
xlMeta.AddFreeVersion(fi)
|
// doesn't replace the existing version, so we don't need to add
|
||||||
}
|
// a free-version.
|
||||||
|
xlMeta.AddFreeVersion(fi)
|
||||||
}
|
}
|
||||||
|
|
||||||
// indicates if RenameData() is called by healing.
|
// indicates if RenameData() is called by healing.
|
||||||
|
Loading…
Reference in New Issue
Block a user