mirror of https://github.com/minio/minio.git
Filter out tiering metadata during CopyObject (#15936)
This commit is contained in:
parent
1633b30979
commit
0c34e51a75
|
@ -909,6 +909,11 @@ func getCpObjMetadataFromHeader(ctx context.Context, r *http.Request, userMeta m
|
||||||
// to change the original one.
|
// to change the original one.
|
||||||
defaultMeta := make(map[string]string, len(userMeta))
|
defaultMeta := make(map[string]string, len(userMeta))
|
||||||
for k, v := range userMeta {
|
for k, v := range userMeta {
|
||||||
|
// skip tier metadata when copying metadata from source object
|
||||||
|
switch k {
|
||||||
|
case metaTierName, metaTierStatus, metaTierObjName, metaTierVersionID:
|
||||||
|
continue
|
||||||
|
}
|
||||||
defaultMeta[k] = v
|
defaultMeta[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,9 +456,9 @@ func (j xlMetaV2DeleteMarker) ToFileInfo(volume, path string) (FileInfo, error)
|
||||||
fi.ReplicationState = GetInternalReplicationState(j.MetaSys)
|
fi.ReplicationState = GetInternalReplicationState(j.MetaSys)
|
||||||
if j.FreeVersion() {
|
if j.FreeVersion() {
|
||||||
fi.SetTierFreeVersion()
|
fi.SetTierFreeVersion()
|
||||||
fi.TransitionTier = string(j.MetaSys[ReservedMetadataPrefixLower+TransitionTier])
|
fi.TransitionTier = string(j.MetaSys[metaTierName])
|
||||||
fi.TransitionedObjName = string(j.MetaSys[ReservedMetadataPrefixLower+TransitionedObjectName])
|
fi.TransitionedObjName = string(j.MetaSys[metaTierObjName])
|
||||||
fi.TransitionVersionID = string(j.MetaSys[ReservedMetadataPrefixLower+TransitionedVersionID])
|
fi.TransitionVersionID = string(j.MetaSys[metaTierVersionID])
|
||||||
}
|
}
|
||||||
|
|
||||||
return fi, nil
|
return fi, nil
|
||||||
|
@ -487,7 +487,7 @@ func (j *xlMetaV2DeleteMarker) Signature() [4]byte {
|
||||||
// its contents and false otherwise.
|
// its contents and false otherwise.
|
||||||
func (j xlMetaV2Object) UsesDataDir() bool {
|
func (j xlMetaV2Object) UsesDataDir() bool {
|
||||||
// Skip if this version is not transitioned, i.e it uses its data directory.
|
// Skip if this version is not transitioned, i.e it uses its data directory.
|
||||||
if !bytes.Equal(j.MetaSys[ReservedMetadataPrefixLower+TransitionStatus], []byte(lifecycle.TransitionComplete)) {
|
if !bytes.Equal(j.MetaSys[metaTierStatus], []byte(lifecycle.TransitionComplete)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,11 +503,18 @@ func (j xlMetaV2Object) InlineData() bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
metaTierStatus = ReservedMetadataPrefixLower + TransitionStatus
|
||||||
|
metaTierObjName = ReservedMetadataPrefixLower + TransitionedObjectName
|
||||||
|
metaTierVersionID = ReservedMetadataPrefixLower + TransitionedVersionID
|
||||||
|
metaTierName = ReservedMetadataPrefixLower + TransitionTier
|
||||||
|
)
|
||||||
|
|
||||||
func (j *xlMetaV2Object) SetTransition(fi FileInfo) {
|
func (j *xlMetaV2Object) SetTransition(fi FileInfo) {
|
||||||
j.MetaSys[ReservedMetadataPrefixLower+TransitionStatus] = []byte(fi.TransitionStatus)
|
j.MetaSys[metaTierStatus] = []byte(fi.TransitionStatus)
|
||||||
j.MetaSys[ReservedMetadataPrefixLower+TransitionedObjectName] = []byte(fi.TransitionedObjName)
|
j.MetaSys[metaTierObjName] = []byte(fi.TransitionedObjName)
|
||||||
j.MetaSys[ReservedMetadataPrefixLower+TransitionedVersionID] = []byte(fi.TransitionVersionID)
|
j.MetaSys[metaTierVersionID] = []byte(fi.TransitionVersionID)
|
||||||
j.MetaSys[ReservedMetadataPrefixLower+TransitionTier] = []byte(fi.TransitionTier)
|
j.MetaSys[metaTierName] = []byte(fi.TransitionTier)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *xlMetaV2Object) RemoveRestoreHdrs() {
|
func (j *xlMetaV2Object) RemoveRestoreHdrs() {
|
||||||
|
@ -626,16 +633,16 @@ func (j xlMetaV2Object) ToFileInfo(volume, path string) (FileInfo, error) {
|
||||||
}
|
}
|
||||||
fi.DataDir = uuid.UUID(j.DataDir).String()
|
fi.DataDir = uuid.UUID(j.DataDir).String()
|
||||||
|
|
||||||
if st, ok := j.MetaSys[ReservedMetadataPrefixLower+TransitionStatus]; ok {
|
if st, ok := j.MetaSys[metaTierStatus]; ok {
|
||||||
fi.TransitionStatus = string(st)
|
fi.TransitionStatus = string(st)
|
||||||
}
|
}
|
||||||
if o, ok := j.MetaSys[ReservedMetadataPrefixLower+TransitionedObjectName]; ok {
|
if o, ok := j.MetaSys[metaTierObjName]; ok {
|
||||||
fi.TransitionedObjName = string(o)
|
fi.TransitionedObjName = string(o)
|
||||||
}
|
}
|
||||||
if rv, ok := j.MetaSys[ReservedMetadataPrefixLower+TransitionedVersionID]; ok {
|
if rv, ok := j.MetaSys[metaTierVersionID]; ok {
|
||||||
fi.TransitionVersionID = string(rv)
|
fi.TransitionVersionID = string(rv)
|
||||||
}
|
}
|
||||||
if sc, ok := j.MetaSys[ReservedMetadataPrefixLower+TransitionTier]; ok {
|
if sc, ok := j.MetaSys[metaTierName]; ok {
|
||||||
fi.TransitionTier = string(sc)
|
fi.TransitionTier = string(sc)
|
||||||
}
|
}
|
||||||
if crcs := j.MetaSys[ReservedMetadataPrefixLower+"crc"]; len(crcs) > 0 {
|
if crcs := j.MetaSys[ReservedMetadataPrefixLower+"crc"]; len(crcs) > 0 {
|
||||||
|
@ -1528,16 +1535,16 @@ func (x *xlMetaV2) AddVersion(fi FileInfo) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if fi.TransitionStatus != "" {
|
if fi.TransitionStatus != "" {
|
||||||
ventry.ObjectV2.MetaSys[ReservedMetadataPrefixLower+TransitionStatus] = []byte(fi.TransitionStatus)
|
ventry.ObjectV2.MetaSys[metaTierStatus] = []byte(fi.TransitionStatus)
|
||||||
}
|
}
|
||||||
if fi.TransitionedObjName != "" {
|
if fi.TransitionedObjName != "" {
|
||||||
ventry.ObjectV2.MetaSys[ReservedMetadataPrefixLower+TransitionedObjectName] = []byte(fi.TransitionedObjName)
|
ventry.ObjectV2.MetaSys[metaTierObjName] = []byte(fi.TransitionedObjName)
|
||||||
}
|
}
|
||||||
if fi.TransitionVersionID != "" {
|
if fi.TransitionVersionID != "" {
|
||||||
ventry.ObjectV2.MetaSys[ReservedMetadataPrefixLower+TransitionedVersionID] = []byte(fi.TransitionVersionID)
|
ventry.ObjectV2.MetaSys[metaTierVersionID] = []byte(fi.TransitionVersionID)
|
||||||
}
|
}
|
||||||
if fi.TransitionTier != "" {
|
if fi.TransitionTier != "" {
|
||||||
ventry.ObjectV2.MetaSys[ReservedMetadataPrefixLower+TransitionTier] = []byte(fi.TransitionTier)
|
ventry.ObjectV2.MetaSys[metaTierName] = []byte(fi.TransitionTier)
|
||||||
}
|
}
|
||||||
if len(fi.Checksum) > 0 {
|
if len(fi.Checksum) > 0 {
|
||||||
ventry.ObjectV2.MetaSys[ReservedMetadataPrefixLower+"crc"] = fi.Checksum
|
ventry.ObjectV2.MetaSys[ReservedMetadataPrefixLower+"crc"] = fi.Checksum
|
||||||
|
|
Loading…
Reference in New Issue