adjust logging

This commit is contained in:
chrislu 2022-01-15 18:48:05 -08:00
parent cbffbd9025
commit 50d9383c3b
3 changed files with 10 additions and 9 deletions

View file

@ -161,7 +161,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
glog.Errorf("file handle read %s: %v", fileFullPath, err)
}
// glog.V(4).Infof("file handle read %s [%d,%d] %d : %v", fileFullPath, offset, offset+int64(totalRead), totalRead, err)
glog.V(4).Infof("file handle read %s [%d,%d] %d : %v", fileFullPath, offset, offset+int64(totalRead), totalRead, err)
return int64(totalRead), err
}

View file

@ -70,24 +70,25 @@ func (pw *PageWriter) FlushData() error {
func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64) {
glog.V(4).Infof("ReadDirtyDataAt %v [%d, %d)", pw.f.fullpath(), offset, offset+int64(len(data)))
dataSlice := data
originalData := data
originalOffset := offset
chunkIndex := offset / pw.chunkSize
for i := chunkIndex; len(dataSlice) > 0; i++ {
readSize := min(int64(len(dataSlice)), (i+1)*pw.chunkSize-offset)
for i := chunkIndex; len(data) > 0; i++ {
readSize := min(int64(len(data)), (i+1)*pw.chunkSize-offset)
if pw.streamWriter != nil {
m1 := pw.streamWriter.ReadDirtyDataAt(dataSlice[:readSize], offset)
m1 := pw.streamWriter.ReadDirtyDataAt(data[:readSize], offset)
maxStop = max(maxStop, m1)
}
m2 := pw.randomWriter.ReadDirtyDataAt(dataSlice[:readSize], offset)
m2 := pw.randomWriter.ReadDirtyDataAt(data[:readSize], offset)
maxStop = max(maxStop, m2)
offset += readSize
dataSlice = dataSlice[readSize:]
data = data[readSize:]
}
page_writer.CheckByteZero(fmt.Sprintf("page writer read [%d,%d)", offset, offset+int64(len(data))), data, 0, maxStop-offset)
page_writer.CheckByteZero(fmt.Sprintf("page writer read [%d,%d)", originalOffset, originalOffset+int64(len(data))), originalData, 0, maxStop-originalOffset)
return
}

View file

@ -10,7 +10,7 @@ func CheckByteZero(message string, p []byte, start, stop int64) {
break
}
}
if isAllZero {
if isAllZero && start != stop {
glog.Errorf("%s is all zeros [%d,%d)", message, start, stop)
}