mirror of
https://github.com/minio/minio.git
synced 2025-02-04 10:26:01 -05:00
replication: Pass metadata timestamps in CopyObject call (#18647)
Regression from #18285. CopyObject options were inheriting source MTime for metadata timestamps if unspecified, removing this prevented metadata updates from being applied on target.
This commit is contained in:
parent
e79b289325
commit
3781a0f9ad
@ -1468,6 +1468,24 @@ func (ri ReplicateObjectInfo) replicateAll(ctx context.Context, objectAPI Object
|
|||||||
ReplicationRequest: true, // always set this to distinguish between `mc mirror` replication and serverside
|
ReplicationRequest: true, // always set this to distinguish between `mc mirror` replication and serverside
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if tagTmStr, ok := objInfo.UserDefined[ReservedMetadataPrefixLower+TaggingTimestamp]; ok {
|
||||||
|
ondiskTimestamp, err := time.Parse(time.RFC3339, tagTmStr)
|
||||||
|
if err == nil {
|
||||||
|
dstOpts.Internal.TaggingTimestamp = ondiskTimestamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if retTmStr, ok := objInfo.UserDefined[ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp]; ok {
|
||||||
|
ondiskTimestamp, err := time.Parse(time.RFC3339, retTmStr)
|
||||||
|
if err == nil {
|
||||||
|
dstOpts.Internal.RetentionTimestamp = ondiskTimestamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if lholdTmStr, ok := objInfo.UserDefined[ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp]; ok {
|
||||||
|
ondiskTimestamp, err := time.Parse(time.RFC3339, lholdTmStr)
|
||||||
|
if err == nil {
|
||||||
|
dstOpts.Internal.LegalholdTimestamp = ondiskTimestamp
|
||||||
|
}
|
||||||
|
}
|
||||||
if _, rinfo.Err = c.CopyObject(ctx, tgt.Bucket, object, tgt.Bucket, object, getCopyObjMetadata(objInfo, tgt.StorageClass), srcOpts, dstOpts); rinfo.Err != nil {
|
if _, rinfo.Err = c.CopyObject(ctx, tgt.Bucket, object, tgt.Bucket, object, getCopyObjMetadata(objInfo, tgt.StorageClass), srcOpts, dstOpts); rinfo.Err != nil {
|
||||||
rinfo.ReplicationStatus = replication.Failed
|
rinfo.ReplicationStatus = replication.Failed
|
||||||
logger.LogIf(ctx, fmt.Errorf("unable to replicate metadata for object %s/%s(%s): %s", bucket, objInfo.Name, objInfo.VersionID, rinfo.Err))
|
logger.LogIf(ctx, fmt.Errorf("unable to replicate metadata for object %s/%s(%s): %s", bucket, objInfo.Name, objInfo.VersionID, rinfo.Err))
|
||||||
|
@ -253,7 +253,11 @@ if [ $? -ne 0 ]; then
|
|||||||
exit_1
|
exit_1
|
||||||
fi
|
fi
|
||||||
sleep 5
|
sleep 5
|
||||||
|
val=$(./mc tag list minio1/newbucket/README.md --version-id "${vID}" --json | jq -r .tagset.key)
|
||||||
|
if [ "${val}" != "val" ]; then
|
||||||
|
echo "expected bucket tag to have replicated, exiting..."
|
||||||
|
exit_1
|
||||||
|
fi
|
||||||
./mc tag remove --version-id "${vID}" minio2/newbucket/README.md
|
./mc tag remove --version-id "${vID}" minio2/newbucket/README.md
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "expecting tag removal to be successful. exiting.."
|
echo "expecting tag removal to be successful. exiting.."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user