mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add debug message when only zeros are copied
This commit is contained in:
parent
fcf5b6cc93
commit
fd83009c05
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue