adjust log printing

This commit is contained in:
chrislusf 2015-03-08 23:49:36 -07:00
parent d5d7ea59a1
commit 9d8a6d2562
3 changed files with 10 additions and 11 deletions

View file

@ -60,14 +60,14 @@ func LoadNeedleMap(file *os.File) (*NeedleMap, error) {
nm.FileByteCounter = nm.FileByteCounter + uint64(size)
if offset > 0 {
oldSize := nm.m.Set(Key(key), offset, size)
glog.V(3).Infoln("reading key", key, "offset", offset, "size", size, "oldSize", oldSize)
glog.V(3).Infoln("reading key", key, "offset", offset*NeedlePaddingSize, "size", size, "oldSize", oldSize)
if oldSize > 0 {
nm.DeletionCounter++
nm.DeletionByteCounter = nm.DeletionByteCounter + uint64(oldSize)
}
} else {
oldSize := nm.m.Delete(Key(key))
glog.V(3).Infoln("removing key", key, "offset", offset, "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)
}

View file

@ -17,7 +17,6 @@ import (
func init() {
cmdExport.Run = runExport // break init cycle
cmdExport.IsDebug = cmdExport.Flag.Bool("debug", false, "enable debug mode")
}
const (
@ -105,14 +104,15 @@ func runExport(cmd *Command, args []string) bool {
return nil
}, true, func(n *storage.Needle, offset int64) error {
nv, ok := nm.Get(n.Id)
glog.V(3).Infoln("key", n.Id, "offset", offset, "size", n.Size, "disk_size", n.DiskSize(), "gzip", n.IsGzipped(), "ok", ok, "nv", nv)
if ok && nv.Size > 0 {
glog.V(3).Infof("key %d offset %d size %d disk_size %d gzip %v ok %v nv %+v",
n.Id, offset, n.Size, n.DiskSize(), n.IsGzipped(), ok, nv)
if ok && nv.Size > 0 && int64(nv.Offset)*8 == offset {
return walker(vid, n, version)
} else {
if !ok {
debug("This seems deleted", n.Id, "size", n.Size)
glog.V(2).Infof("This seems deleted %d size %d", n.Id, n.Size)
} else {
debug("Id", n.Id, "size", n.Size)
glog.V(2).Infof("Skipping later-updated Id %d size %d", n.Id, n.Size)
}
}
return nil

View file

@ -11,7 +11,6 @@ import (
func init() {
cmdFix.Run = runFix // break init cycle
cmdFix.IsDebug = cmdFix.Flag.Bool("debug", false, "enable debug mode")
}
var cmdFix = &Command{
@ -51,12 +50,12 @@ func runFix(cmd *Command, args []string) bool {
err = storage.ScanVolumeFile(*fixVolumePath, *fixVolumeCollection, vid, func(superBlock storage.SuperBlock) error {
return nil
}, false, func(n *storage.Needle, offset int64) error {
debug("key", n.Id, "offset", offset, "size", n.Size, "disk_size", n.DiskSize(), "gzip", n.IsGzipped())
glog.V(2).Infof("key %d offset %d size %d disk_size %d gzip %v", n.Id, offset, n.Size, n.DiskSize(), n.IsGzipped())
if n.Size > 0 {
count, pe := nm.Put(n.Id, uint32(offset/storage.NeedlePaddingSize), n.Size)
debug("saved", count, "with error", pe)
glog.V(2).Infof("saved %d with error %v", count, pe)
} else {
debug("skipping deleted file ...")
glog.V(2).Infof("skipping deleted file ...")
return nm.Delete(n.Id)
}
return nil