mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(datanode): The contents on which the CRC check depends are inconsistent with each other
Update the crc check output from error to warn, the inconsistent may be false report and require more output and make a jugement. The applyId and crc cann't be atomic under the architecture and are not necessary for performance. Signed-off-by: leonrayang <chl696@sina.com>
This commit is contained in:
parent
c9611557a2
commit
5c82a084f1
@ -205,4 +205,5 @@ func (dp *DataPartition) Del(key interface{}) (interface{}, error) {
|
||||
func (dp *DataPartition) uploadApplyID(applyID uint64) {
|
||||
log.LogDebugf("[uploadApplyID] dp(%v) upload apply id(%v)", dp.partitionID, applyID)
|
||||
atomic.StoreUint64(&dp.appliedID, applyID)
|
||||
atomic.StoreUint64(&dp.extentStore.ApplyId, applyID)
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ type ExtentInfo struct {
|
||||
SnapshotDataOff uint64 `json:"snapSize"`
|
||||
SnapPreAllocDataOff uint64 `json:"snapPreAllocSize"`
|
||||
ApplyID uint64 `json:"applyID"`
|
||||
ApplySize int64 `json:"ApplySize"`
|
||||
}
|
||||
|
||||
func (ei *ExtentInfo) TotalSize() uint64 {
|
||||
@ -577,12 +578,8 @@ func (e *Extent) GetCrc(blockNo int64) uint32 {
|
||||
return binary.BigEndian.Uint32(e.header[blockNo*util.PerBlockCrcSize : (blockNo+1)*util.PerBlockCrcSize])
|
||||
}
|
||||
|
||||
func (e *Extent) autoComputeExtentCrc(crcFunc UpdateCrcFunc) (crc uint32, err error) {
|
||||
func (e *Extent) autoComputeExtentCrc(extSize int64, crcFunc UpdateCrcFunc) (crc uint32, err error) {
|
||||
var blockCnt int
|
||||
extSize := e.Size()
|
||||
if e.snapshotDataOff > util.ExtentSize {
|
||||
extSize = int64(e.snapshotDataOff)
|
||||
}
|
||||
blockCnt = int(extSize / util.BlockSize)
|
||||
if extSize%util.BlockSize != 0 {
|
||||
blockCnt += 1
|
||||
|
||||
@ -149,7 +149,6 @@ type ExtentStore struct {
|
||||
extentLock bool
|
||||
stopMutex sync.RWMutex
|
||||
stopC chan interface{}
|
||||
ApplyIdMutex sync.RWMutex
|
||||
ApplyId uint64
|
||||
}
|
||||
|
||||
@ -1541,9 +1540,7 @@ func (s *ExtentStore) autoComputeExtentCrc() {
|
||||
sort.Sort(ExtentInfoArr(extentInfos))
|
||||
|
||||
for _, ei := range extentInfos {
|
||||
s.ApplyIdMutex.RLock()
|
||||
if ei == nil {
|
||||
s.ApplyIdMutex.RUnlock()
|
||||
continue
|
||||
}
|
||||
|
||||
@ -1553,22 +1550,22 @@ func (s *ExtentStore) autoComputeExtentCrc() {
|
||||
e, err := s.extentWithHeader(ei)
|
||||
if err != nil {
|
||||
log.LogWarnf("[autoComputeExtentCrc] get extent error:%+v", err)
|
||||
s.ApplyIdMutex.RUnlock()
|
||||
continue
|
||||
}
|
||||
|
||||
extentCrc, err := e.autoComputeExtentCrc(s.PersistenceBlockCrc)
|
||||
extSize := e.Size()
|
||||
if e.snapshotDataOff > util.ExtentSize {
|
||||
extSize = int64(e.snapshotDataOff)
|
||||
}
|
||||
extentCrc, err := e.autoComputeExtentCrc(extSize, s.PersistenceBlockCrc)
|
||||
if err != nil {
|
||||
log.LogError("[autoComputeExtentCrc] compute crc fail", err)
|
||||
s.ApplyIdMutex.RUnlock()
|
||||
continue
|
||||
}
|
||||
|
||||
ei.ApplySize = extSize
|
||||
ei.UpdateExtentInfo(e, extentCrc)
|
||||
ei.ApplyID = s.ApplyId
|
||||
atomic.StoreUint64(&ei.ApplyID, s.ApplyId)
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
}
|
||||
s.ApplyIdMutex.RUnlock()
|
||||
}
|
||||
|
||||
time.Sleep(time.Second)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user