mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-12 02:56:10 +00:00
add debug message when only zeros are copied
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package page_writer
|
||||
|
||||
import (
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/util/mem"
|
||||
"io"
|
||||
@@ -80,6 +81,18 @@ func (cw *ChunkedStreamWriter) ReadDataAt(p []byte, off int64) (maxStop int64) {
|
||||
if logicStart < logicStop {
|
||||
copy(p[logicStart-off:logicStop-off], memChunk.buf[logicStart-memChunkBaseOffset:logicStop-memChunkBaseOffset])
|
||||
maxStop = max(maxStop, logicStop)
|
||||
|
||||
isAllZero := true
|
||||
for i := logicStart - off; i < logicStop-off; i++ {
|
||||
if p[i] != 0 {
|
||||
isAllZero = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if isAllZero {
|
||||
glog.Errorf("Copied content is all Zero [%d,%d)", logicStart-off, logicStop-off)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
@@ -111,6 +124,9 @@ func (cw *ChunkedStreamWriter) saveOneChunk(memChunk *MemChunk, logicChunkIndex
|
||||
|
||||
// Destroy releases used resources
|
||||
func (cw *ChunkedStreamWriter) Destroy() {
|
||||
cw.Lock()
|
||||
defer cw.Unlock()
|
||||
|
||||
for t, memChunk := range cw.activeChunks {
|
||||
mem.Free(memChunk.buf)
|
||||
delete(cw.activeChunks, t)
|
||||
|
||||
Reference in New Issue
Block a user