mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 10:06:14 +00:00
refactor(fsck): Ignore timestamp validation and support compatibility with older versions. #22911241
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
bb1eb1ebbe
commit
ee3172e8cf
@ -49,6 +49,11 @@ var (
|
||||
legacyReplicaStorageClass uint32 // for compatibility when older version upgrade to hybrid cloud
|
||||
)
|
||||
|
||||
// only used for mp check
|
||||
func SetLegacyType(t uint32) {
|
||||
legacyReplicaStorageClass = t
|
||||
}
|
||||
|
||||
// The MetaNode manages the dentry and inode information of the meta partitions on a meta node.
|
||||
// The data consistency is ensured by Raft.
|
||||
type MetaNode struct {
|
||||
|
||||
@ -30,6 +30,7 @@ import (
|
||||
|
||||
"github.com/cubefs/cubefs/metanode"
|
||||
"github.com/cubefs/cubefs/proto"
|
||||
"github.com/cubefs/cubefs/sdk/master"
|
||||
"github.com/cubefs/cubefs/util/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@ -229,6 +230,18 @@ func CheckMP() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
mc := master.NewMasterClient([]string{MasterAddr}, false)
|
||||
volInfo, err := mc.AdminAPI().GetVolumeSimpleInfo(VolName)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("get vol name failed, name %s, err %s", VolName, err.Error()))
|
||||
}
|
||||
|
||||
storageClass := proto.MediaType_HDD
|
||||
if proto.IsValidMediaType(volInfo.VolStorageClass) {
|
||||
storageClass = volInfo.VolStorageClass
|
||||
}
|
||||
metanode.SetLegacyType(storageClass)
|
||||
|
||||
mps, err := getMetaPartitions(MasterAddr, VolName)
|
||||
if err != nil {
|
||||
return
|
||||
@ -506,12 +519,12 @@ func compareInodes(i1 *metanode.Inode, i2 *metanode.Inode) *bytes.Buffer {
|
||||
if i1.CreateTime != i2.CreateTime {
|
||||
buffer.WriteString(fmt.Sprintf("CreateTime: %v != %v ", i1.CreateTime, i2.CreateTime))
|
||||
}
|
||||
if i1.AccessTime != i2.AccessTime {
|
||||
buffer.WriteString(fmt.Sprintf("AccessTime: %v != %v ", i1.AccessTime, i2.AccessTime))
|
||||
}
|
||||
if i1.ModifyTime != i2.ModifyTime {
|
||||
buffer.WriteString(fmt.Sprintf("ModifyTime: %v != %v ", i1.ModifyTime, i2.ModifyTime))
|
||||
}
|
||||
// if i1.AccessTime != i2.AccessTime {
|
||||
// buffer.WriteString(fmt.Sprintf("AccessTime: %v != %v ", i1.AccessTime, i2.AccessTime))
|
||||
// }
|
||||
// if i1.ModifyTime != i2.ModifyTime {
|
||||
// buffer.WriteString(fmt.Sprintf("ModifyTime: %v != %v ", i1.ModifyTime, i2.ModifyTime))
|
||||
// }
|
||||
if !bytes.Equal(i1.LinkTarget, i2.LinkTarget) {
|
||||
buffer.WriteString(fmt.Sprintf("LinkTarget: %v != %v ", i1.LinkTarget, i2.LinkTarget))
|
||||
}
|
||||
@ -521,9 +534,9 @@ func compareInodes(i1 *metanode.Inode, i2 *metanode.Inode) *bytes.Buffer {
|
||||
if i1.Flag != i2.Flag {
|
||||
buffer.WriteString(fmt.Sprintf("Flag: %v != %v ", i1.Flag, i2.Flag))
|
||||
}
|
||||
if i1.Reserved != i2.Reserved {
|
||||
buffer.WriteString(fmt.Sprintf("Reserved: %v != %v ", i1.Reserved, i2.Reserved))
|
||||
}
|
||||
// if i1.Reserved != i2.Reserved {
|
||||
// buffer.WriteString(fmt.Sprintf("Reserved: %v != %v ", i1.Reserved, i2.Reserved))
|
||||
// }
|
||||
|
||||
if !i1.Extents.Equals(i2.Extents) {
|
||||
buffer.WriteString(fmt.Sprintf("Extents [%v] != [%v] ", i1.Extents, i2.Extents))
|
||||
@ -585,9 +598,9 @@ func compareInodes(i1 *metanode.Inode, i2 *metanode.Inode) *bytes.Buffer {
|
||||
buffer.WriteString(fmt.Sprintf("ClientID: %v != %v ", i1.ClientID, i2.ClientID))
|
||||
}
|
||||
|
||||
if i1.LeaseExpireTime != i2.LeaseExpireTime {
|
||||
buffer.WriteString(fmt.Sprintf("LeaseExpireTime : %v != %v ", i1.LeaseExpireTime, i2.LeaseExpireTime))
|
||||
}
|
||||
// if i1.LeaseExpireTime != i2.LeaseExpireTime {
|
||||
// buffer.WriteString(fmt.Sprintf("LeaseExpireTime : %v != %v ", i1.LeaseExpireTime, i2.LeaseExpireTime))
|
||||
// }
|
||||
|
||||
return &buffer
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user