mirror of
https://github.com/pgsty/minio.git
synced 2026-11-12 02:25:34 +03:00
fix(copy): preserve authoritative content when pools are moving
Bind in-place metadata updates to the same version and pool as reads. Resolve encryption and checksum rewrites before write placement while retaining the SSE-C rewrap fast path and invalid self-copy checks. Add HTTP and object-layer regressions for moving pools, duplicate bodies, null versions, timestamp ties and active-pool rewrites. Refs #343. Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -1708,10 +1708,13 @@ func (z *erasureServerPools) prepareCopyObject(ctx context.Context, srcBucket, s
|
||||
reference := sameObject && !copyRewritesObjectData(srcInfo.metadataOnly && !srcInfo.Legacy, srcOpts, dstOpts)
|
||||
inPlace := reference && (dstOpts.VersionID != "" && srcOpts.VersionID == dstOpts.VersionID || !dstOpts.Versioned && srcOpts.VersionID == "")
|
||||
if inPlace {
|
||||
idx, err := z.getPoolIdxExistingWithOpts(ctx, dstBucket, dstObject, ObjectOptions{
|
||||
VersionID: dstOpts.VersionID, MetadataChg: true, NoLock: true,
|
||||
Transition: dstOpts.Transition, SkipDecommissioned: true, SkipRebalancing: true,
|
||||
})
|
||||
// Metadata must stay with the authoritative source bytes, including
|
||||
// when that pool is draining. Write allocation could select a stale
|
||||
// duplicate and later retire the only current copy.
|
||||
sourceOpts := srcOpts
|
||||
sourceOpts.NoLock = true
|
||||
sourceOpts.Transition = dstOpts.Transition
|
||||
_, idx, err := z.getLatestObjectInfoWithIdx(ctx, srcBucket, srcObject, sourceOpts)
|
||||
return copyObjectPlan{poolIdx: idx}, err
|
||||
}
|
||||
idx, err := z.getPoolIdxNoLock(ctx, dstBucket, dstObject, srcInfo.Size)
|
||||
|
||||
Reference in New Issue
Block a user