remove unused DiskMTime (#18965)

This commit is contained in:
Harshavardhana 2024-02-05 01:04:26 -08:00 committed by GitHub
parent 100c35c281
commit fec13b0ec1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 84 deletions

View File

@ -1054,8 +1054,6 @@ func TestHealObjectCorruptedPools(t *testing.T) {
t.Fatalf("Failed to getLatestFileInfo - %v", err)
}
fi.DiskMTime = time.Time{}
nfi.DiskMTime = time.Time{}
if !reflect.DeepEqual(fi, nfi) {
t.Fatalf("FileInfo not equal after healing: %v != %v", fi, nfi)
}
@ -1085,8 +1083,6 @@ func TestHealObjectCorruptedPools(t *testing.T) {
t.Fatalf("Failed to getLatestFileInfo - %v", err)
}
fi.DiskMTime = time.Time{}
nfi.DiskMTime = time.Time{}
if !reflect.DeepEqual(fi, nfi) {
t.Fatalf("FileInfo not equal after healing: %v != %v", fi, nfi)
}
@ -1212,8 +1208,6 @@ func TestHealObjectCorruptedXLMeta(t *testing.T) {
t.Fatalf("Failed to getLatestFileInfo - %v", err)
}
fi.DiskMTime = time.Time{}
nfi1.DiskMTime = time.Time{}
if !reflect.DeepEqual(fi, nfi1) {
t.Fatalf("FileInfo not equal after healing")
}
@ -1235,8 +1229,6 @@ func TestHealObjectCorruptedXLMeta(t *testing.T) {
t.Fatalf("Failed to getLatestFileInfo - %v", err)
}
fi.DiskMTime = time.Time{}
nfi2.DiskMTime = time.Time{}
if !reflect.DeepEqual(fi, nfi2) {
t.Fatalf("FileInfo not equal after healing")
}

View File

@ -574,7 +574,6 @@ func fileInfoFromRaw(ri RawFileInfo, bucket, object string, readData, inclFreeVe
fileInfo.Data = xl.data.find(versionID)
}
fileInfo.DiskMTime = ri.DiskMTime
return fileInfo, nil
}
@ -625,9 +624,7 @@ func pickLatestQuorumFilesInfo(ctx context.Context, rawFileInfos []RawFileInfo,
continue
}
metadataArray[index] = &xl
metaFileInfos[index] = FileInfo{
DiskMTime: rf.DiskMTime,
}
metaFileInfos[index] = FileInfo{}
}
for index := range metadataArray {
@ -667,7 +664,6 @@ func pickLatestQuorumFilesInfo(ctx context.Context, rawFileInfos []RawFileInfo,
}
// make sure to preserve this for diskmtime based healing bugfix.
diskMTime := metaFileInfos[index].DiskMTime
metaFileInfos[index], errs[index] = metadataArray[index].ToFileInfo(bucket, object, versionID, inclFreeVers, allParts)
if errs[index] != nil {
continue
@ -676,7 +672,6 @@ func pickLatestQuorumFilesInfo(ctx context.Context, rawFileInfos []RawFileInfo,
if readData {
metaFileInfos[index].Data = metadataArray[index].data.find(versionID)
}
metaFileInfos[index].DiskMTime = diskMTime
}
if !readData {
for i := range v2bufs {

View File

@ -163,11 +163,6 @@ func (f *FileInfoVersions) findVersionIndex(v string) int {
type RawFileInfo struct {
// Content of entire xl.meta (may contain data depending on what was requested by the caller.
Buf []byte `msg:"b,allownil"`
// DiskMTime indicates the mtime of the xl.meta on disk
// This is mainly used for detecting a particular issue
// reported in https://github.com/minio/minio/pull/13803
DiskMTime time.Time `msg:"dmt"`
}
// FileInfo - represents file stat information.
@ -248,11 +243,6 @@ type FileInfo struct {
// usage in other calls in undefined please avoid.
Idx int `msg:"i"`
// DiskMTime indicates the mtime of the xl.meta on disk
// This is mainly used for detecting a particular issue
// reported in https://github.com/minio/minio/pull/13803
DiskMTime time.Time `msg:"dmt"`
// Combined checksum when object was uploaded.
Checksum []byte `msg:"cs,allownil"`

View File

@ -1834,8 +1834,8 @@ func (z *FileInfo) DecodeMsg(dc *msgp.Reader) (err error) {
err = msgp.WrapError(err)
return
}
if zb0001 != 29 {
err = msgp.ArrayError{Wanted: 29, Got: zb0001}
if zb0001 != 28 {
err = msgp.ArrayError{Wanted: 28, Got: zb0001}
return
}
z.Volume, err = dc.ReadString()
@ -2014,11 +2014,6 @@ func (z *FileInfo) DecodeMsg(dc *msgp.Reader) (err error) {
err = msgp.WrapError(err, "Idx")
return
}
z.DiskMTime, err = dc.ReadTime()
if err != nil {
err = msgp.WrapError(err, "DiskMTime")
return
}
if dc.IsNil() {
err = dc.ReadNil()
if err != nil {
@ -2043,8 +2038,8 @@ func (z *FileInfo) DecodeMsg(dc *msgp.Reader) (err error) {
// EncodeMsg implements msgp.Encodable
func (z *FileInfo) EncodeMsg(en *msgp.Writer) (err error) {
// array header, size 29
err = en.Append(0xdc, 0x0, 0x1d)
// array header, size 28
err = en.Append(0xdc, 0x0, 0x1c)
if err != nil {
return
}
@ -2204,11 +2199,6 @@ func (z *FileInfo) EncodeMsg(en *msgp.Writer) (err error) {
err = msgp.WrapError(err, "Idx")
return
}
err = en.WriteTime(z.DiskMTime)
if err != nil {
err = msgp.WrapError(err, "DiskMTime")
return
}
if z.Checksum == nil { // allownil: if nil
err = en.WriteNil()
if err != nil {
@ -2232,8 +2222,8 @@ func (z *FileInfo) EncodeMsg(en *msgp.Writer) (err error) {
// MarshalMsg implements msgp.Marshaler
func (z *FileInfo) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// array header, size 29
o = append(o, 0xdc, 0x0, 0x1d)
// array header, size 28
o = append(o, 0xdc, 0x0, 0x1c)
o = msgp.AppendString(o, z.Volume)
o = msgp.AppendString(o, z.Name)
o = msgp.AppendString(o, z.VersionID)
@ -2283,7 +2273,6 @@ func (z *FileInfo) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.AppendTime(o, z.SuccessorModTime)
o = msgp.AppendBool(o, z.Fresh)
o = msgp.AppendInt(o, z.Idx)
o = msgp.AppendTime(o, z.DiskMTime)
if z.Checksum == nil { // allownil: if nil
o = msgp.AppendNil(o)
} else {
@ -2301,8 +2290,8 @@ func (z *FileInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
err = msgp.WrapError(err)
return
}
if zb0001 != 29 {
err = msgp.ArrayError{Wanted: 29, Got: zb0001}
if zb0001 != 28 {
err = msgp.ArrayError{Wanted: 28, Got: zb0001}
return
}
z.Volume, bts, err = msgp.ReadStringBytes(bts)
@ -2477,11 +2466,6 @@ func (z *FileInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
err = msgp.WrapError(err, "Idx")
return
}
z.DiskMTime, bts, err = msgp.ReadTimeBytes(bts)
if err != nil {
err = msgp.WrapError(err, "DiskMTime")
return
}
if msgp.IsNil(bts) {
bts = bts[1:]
z.Checksum = nil
@ -2514,7 +2498,7 @@ func (z *FileInfo) Msgsize() (s int) {
for za0003 := range z.Parts {
s += z.Parts[za0003].Msgsize()
}
s += z.Erasure.Msgsize() + msgp.BoolSize + z.ReplicationState.Msgsize() + msgp.BytesPrefixSize + len(z.Data) + msgp.IntSize + msgp.TimeSize + msgp.BoolSize + msgp.IntSize + msgp.TimeSize + msgp.BytesPrefixSize + len(z.Checksum) + msgp.BoolSize
s += z.Erasure.Msgsize() + msgp.BoolSize + z.ReplicationState.Msgsize() + msgp.BytesPrefixSize + len(z.Data) + msgp.IntSize + msgp.TimeSize + msgp.BoolSize + msgp.IntSize + msgp.BytesPrefixSize + len(z.Checksum) + msgp.BoolSize
return
}
@ -3374,12 +3358,6 @@ func (z *RawFileInfo) DecodeMsg(dc *msgp.Reader) (err error) {
return
}
}
case "dmt":
z.DiskMTime, err = dc.ReadTime()
if err != nil {
err = msgp.WrapError(err, "DiskMTime")
return
}
default:
err = dc.Skip()
if err != nil {
@ -3393,9 +3371,9 @@ func (z *RawFileInfo) DecodeMsg(dc *msgp.Reader) (err error) {
// EncodeMsg implements msgp.Encodable
func (z *RawFileInfo) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 2
// map header, size 1
// write "b"
err = en.Append(0x82, 0xa1, 0x62)
err = en.Append(0x81, 0xa1, 0x62)
if err != nil {
return
}
@ -3411,33 +3389,20 @@ func (z *RawFileInfo) EncodeMsg(en *msgp.Writer) (err error) {
return
}
}
// write "dmt"
err = en.Append(0xa3, 0x64, 0x6d, 0x74)
if err != nil {
return
}
err = en.WriteTime(z.DiskMTime)
if err != nil {
err = msgp.WrapError(err, "DiskMTime")
return
}
return
}
// MarshalMsg implements msgp.Marshaler
func (z *RawFileInfo) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 2
// map header, size 1
// string "b"
o = append(o, 0x82, 0xa1, 0x62)
o = append(o, 0x81, 0xa1, 0x62)
if z.Buf == nil { // allownil: if nil
o = msgp.AppendNil(o)
} else {
o = msgp.AppendBytes(o, z.Buf)
}
// string "dmt"
o = append(o, 0xa3, 0x64, 0x6d, 0x74)
o = msgp.AppendTime(o, z.DiskMTime)
return
}
@ -3470,12 +3435,6 @@ func (z *RawFileInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
return
}
}
case "dmt":
z.DiskMTime, bts, err = msgp.ReadTimeBytes(bts)
if err != nil {
err = msgp.WrapError(err, "DiskMTime")
return
}
default:
bts, err = msgp.Skip(bts)
if err != nil {
@ -3490,7 +3449,7 @@ func (z *RawFileInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *RawFileInfo) Msgsize() (s int) {
s = 1 + 2 + msgp.BytesPrefixSize + len(z.Buf) + 4 + msgp.TimeSize
s = 1 + 2 + msgp.BytesPrefixSize + len(z.Buf)
return
}

View File

@ -1525,10 +1525,9 @@ func (s *xlStorage) ReadXL(ctx context.Context, volume, path string, readData bo
return RawFileInfo{}, err
}
buf, dmTime, err := s.readRaw(ctx, volume, volumeDir, filePath, readData)
buf, _, err := s.readRaw(ctx, volume, volumeDir, filePath, readData)
return RawFileInfo{
Buf: buf,
DiskMTime: dmTime,
Buf: buf,
}, err
}
@ -1569,7 +1568,7 @@ func (s *xlStorage) ReadVersion(ctx context.Context, origvolume, volume, path, v
readData := opts.ReadData
buf, dmTime, err := s.readRaw(ctx, volume, volumeDir, filePath, readData)
buf, _, err := s.readRaw(ctx, volume, volumeDir, filePath, readData)
if err != nil {
if err == errFileNotFound {
if versionID != "" {
@ -1583,7 +1582,6 @@ func (s *xlStorage) ReadVersion(ctx context.Context, origvolume, volume, path, v
if err != nil {
return fi, err
}
fi.DiskMTime = dmTime
if len(fi.Data) == 0 {
// We did not read inline data, so we have no references.