From d2cd6a6f6e5fe28b141796b31860355a5e8a1e2f Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 15 Jan 2022 19:06:02 -0800 Subject: [PATCH] adjust logs --- weed/filer/reader_at.go | 4 ++-- weed/filesys/filehandle.go | 4 +++- weed/filesys/page_writer.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/weed/filer/reader_at.go b/weed/filer/reader_at.go index b1c15152f..e750656ec 100644 --- a/weed/filer/reader_at.go +++ b/weed/filer/reader_at.go @@ -141,7 +141,7 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) { if chunkStart >= chunkStop { continue } - // glog.V(4).Infof("read [%d,%d), %d/%d chunk %s [%d,%d)", chunkStart, chunkStop, i, len(c.chunkViews), chunk.FileId, chunk.LogicOffset-chunk.Offset, chunk.LogicOffset-chunk.Offset+int64(chunk.Size)) + glog.V(4).Infof("read [%d,%d), %d/%d chunk %s [%d,%d)", chunkStart, chunkStop, i, len(c.chunkViews), chunk.FileId, chunk.LogicOffset-chunk.Offset, chunk.LogicOffset-chunk.Offset+int64(chunk.Size)) var buffer []byte bufferOffset := chunkStart - chunk.LogicOffset + chunk.Offset bufferLength := chunkStop - chunkStart @@ -156,7 +156,7 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) { startOffset, remaining = startOffset+int64(copied), remaining-int64(copied) } - // glog.V(4).Infof("doReadAt [%d,%d), n:%v, err:%v", offset, offset+int64(len(p)), n, err) + glog.V(4).Infof("doReadAt [%d,%d), n:%v, err:%v", offset, offset+int64(len(p)), n, err) if err == nil && remaining > 0 && c.fileSize > startOffset { delta := int(min(remaining, c.fileSize-startOffset)) diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index ab0f58b42..8da49ea06 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -3,6 +3,7 @@ package filesys import ( "context" "fmt" + "github.com/chrislusf/seaweedfs/weed/filesys/page_writer" "io" "math" "net/http" @@ -161,7 +162,8 @@ 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) + page_writer.CheckByteZero(fmt.Sprintf("read %d chunks", len(entry.Chunks)), buff, 0, int64(totalRead)) return int64(totalRead), err } diff --git a/weed/filesys/page_writer.go b/weed/filesys/page_writer.go index 0cdb3c527..58a64bad3 100644 --- a/weed/filesys/page_writer.go +++ b/weed/filesys/page_writer.go @@ -88,7 +88,7 @@ func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64) data = data[readSize:] } - page_writer.CheckByteZero(fmt.Sprintf("page writer read [%d,%d)", originalOffset, originalOffset+int64(len(data))), originalData, 0, maxStop-originalOffset) + page_writer.CheckByteZero(fmt.Sprintf("page writer read [%d,%d)", originalOffset, originalOffset+int64(len(originalData))), originalData, 0, maxStop-originalOffset) return }