mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix checking
This commit is contained in:
parent
4d06e18554
commit
ab61386d29
|
@ -1,6 +1,7 @@
|
||||||
package filesys
|
package filesys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/chrislusf/seaweedfs/weed/filesys/page_writer"
|
"github.com/chrislusf/seaweedfs/weed/filesys/page_writer"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
)
|
)
|
||||||
|
@ -69,22 +70,24 @@ func (pw *PageWriter) FlushData() error {
|
||||||
func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64) {
|
func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64) {
|
||||||
glog.V(4).Infof("ReadDirtyDataAt %v [%d, %d)", pw.f.fullpath(), offset, offset+int64(len(data)))
|
glog.V(4).Infof("ReadDirtyDataAt %v [%d, %d)", pw.f.fullpath(), offset, offset+int64(len(data)))
|
||||||
|
|
||||||
|
dataSlice := data
|
||||||
|
|
||||||
chunkIndex := offset / pw.chunkSize
|
chunkIndex := offset / pw.chunkSize
|
||||||
for i := chunkIndex; len(data) > 0; i++ {
|
for i := chunkIndex; len(dataSlice) > 0; i++ {
|
||||||
readSize := min(int64(len(data)), (i+1)*pw.chunkSize-offset)
|
readSize := min(int64(len(dataSlice)), (i+1)*pw.chunkSize-offset)
|
||||||
|
|
||||||
if pw.streamWriter != nil {
|
if pw.streamWriter != nil {
|
||||||
m1 := pw.streamWriter.ReadDirtyDataAt(data[:readSize], offset)
|
m1 := pw.streamWriter.ReadDirtyDataAt(dataSlice[:readSize], offset)
|
||||||
maxStop = max(maxStop, m1)
|
maxStop = max(maxStop, m1)
|
||||||
}
|
}
|
||||||
m2 := pw.randomWriter.ReadDirtyDataAt(data[:readSize], offset)
|
m2 := pw.randomWriter.ReadDirtyDataAt(dataSlice[:readSize], offset)
|
||||||
maxStop = max(maxStop, m2)
|
maxStop = max(maxStop, m2)
|
||||||
|
|
||||||
offset += readSize
|
offset += readSize
|
||||||
data = data[readSize:]
|
data = dataSlice[readSize:]
|
||||||
}
|
}
|
||||||
|
|
||||||
page_writer.CheckByteZero("page writer read", data, 0, maxStop-offset)
|
page_writer.CheckByteZero(fmt.Sprintf("page writer read [%d,%d)", offset, offset+int64(len(data))), data, 0, maxStop-offset)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue