add debug zero

This commit is contained in:
chrislu 2022-01-15 14:49:59 -08:00
parent fd83009c05
commit cb25d100b7
4 changed files with 21 additions and 11 deletions

View file

@ -84,6 +84,8 @@ func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64)
data = data[readSize:] data = data[readSize:]
} }
checkByteZero("page writer read", p, 0, maxStop-offset)
return return
} }

View file

@ -73,6 +73,7 @@ func (cw *ChunkedFileWriter) ReadDataAt(p []byte, off int64) (maxStop int64) {
glog.Errorf("reading temp file: %v", err) glog.Errorf("reading temp file: %v", err)
break break
} }
checkByteZero("temp file writer read", p, logicStart-off, logicStop-off)
maxStop = max(maxStop, logicStop) maxStop = max(maxStop, logicStop)
} }
} }

View file

@ -1,7 +1,6 @@
package page_writer package page_writer
import ( import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/util/mem" "github.com/chrislusf/seaweedfs/weed/util/mem"
"io" "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]) copy(p[logicStart-off:logicStop-off], memChunk.buf[logicStart-memChunkBaseOffset:logicStop-memChunkBaseOffset])
maxStop = max(maxStop, logicStop) maxStop = max(maxStop, logicStop)
isAllZero := true checkByteZero("stream writer read", p, logicStart-off, logicStop-off)
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)
}
} }
} }

View 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)
}
}