|
|
@ -53,14 +53,14 @@ func doLoading(file *os.File, nm *NeedleMap) (*NeedleMap, error) { |
|
|
|
nm.FileCounter++ |
|
|
|
nm.FileByteCounter = nm.FileByteCounter + uint64(size) |
|
|
|
oldOffset, oldSize := nm.m.Set(needle.Key(key), offset, size) |
|
|
|
glog.V(3).Infoln("reading key", key, "offset", offset*NeedlePaddingSize, "size", size, "oldSize", oldSize) |
|
|
|
// glog.V(3).Infoln("reading key", key, "offset", offset*NeedlePaddingSize, "size", size, "oldSize", oldSize)
|
|
|
|
if oldOffset > 0 && oldSize != TombstoneFileSize { |
|
|
|
nm.DeletionCounter++ |
|
|
|
nm.DeletionByteCounter = nm.DeletionByteCounter + uint64(oldSize) |
|
|
|
} |
|
|
|
} else { |
|
|
|
oldSize := nm.m.Delete(needle.Key(key)) |
|
|
|
glog.V(3).Infoln("removing key", key, "offset", offset*NeedlePaddingSize, "size", size, "oldSize", oldSize) |
|
|
|
// glog.V(3).Infoln("removing key", key, "offset", offset*NeedlePaddingSize, "size", size, "oldSize", oldSize)
|
|
|
|
nm.DeletionCounter++ |
|
|
|
nm.DeletionByteCounter = nm.DeletionByteCounter + uint64(oldSize) |
|
|
|
} |
|
|
@ -86,7 +86,7 @@ func WalkIndexFile(r *os.File, fn func(key uint64, offset, size uint32) error) e |
|
|
|
|
|
|
|
for count > 0 && e == nil || e == io.EOF { |
|
|
|
for i = 0; i+16 <= count; i += 16 { |
|
|
|
key, offset, size = idxFileEntry(bytes[i : i+16]) |
|
|
|
key, offset, size = idxFileEntry(bytes[i: i+16]) |
|
|
|
if e = fn(key, offset, size); e != nil { |
|
|
|
return e |
|
|
|
} |
|
|
|