mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add debug zero
This commit is contained in:
parent
fd83009c05
commit
cb25d100b7
|
@ -84,6 +84,8 @@ func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64)
|
|||
data = data[readSize:]
|
||||
}
|
||||
|
||||
checkByteZero("page writer read", p, 0, maxStop-offset)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ func (cw *ChunkedFileWriter) ReadDataAt(p []byte, off int64) (maxStop int64) {
|
|||
glog.Errorf("reading temp file: %v", err)
|
||||
break
|
||||
}
|
||||
checkByteZero("temp file writer read", p, logicStart-off, logicStop-off)
|
||||
maxStop = max(maxStop, logicStop)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package page_writer
|
||||
|
||||
import (
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"github.com/chrislusf/seaweedfs/weed/util/mem"
|
||||
"io"
|
||||
|
@ -82,16 +81,7 @@ func (cw *ChunkedStreamWriter) ReadDataAt(p []byte, off int64) (maxStop int64) {
|
|||
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)
|
||||
}
|
||||
checkByteZero("stream writer read", p, logicStart-off, logicStop-off)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
17
weed/filesys/page_writer/debug_content.go
Normal file
17
weed/filesys/page_writer/debug_content.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package page_writer
|
||||
|
||||
import "github.com/chrislusf/seaweedfs/weed/glog"
|
||||
|
||||
func checkByteZero(message string, p []byte, start, stop int64) {
|
||||
isAllZero := true
|
||||
for i := start; i < stop; i++ {
|
||||
if p[i] != 0 {
|
||||
isAllZero = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if isAllZero {
|
||||
glog.Errorf("%s is all zeros [%d,%d)", message, start, stop)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue