diff options
Diffstat (limited to 'go/storage')
| -rw-r--r-- | go/storage/cdb_map.go | 6 | ||||
| -rw-r--r-- | go/storage/cdb_map_test.go | 6 | ||||
| -rw-r--r-- | go/storage/needle_map.go | 2 | ||||
| -rw-r--r-- | go/storage/store.go | 14 | ||||
| -rw-r--r-- | go/storage/volume.go | 8 |
5 files changed, 18 insertions, 18 deletions
diff --git a/go/storage/cdb_map.go b/go/storage/cdb_map.go index 14437c45b..d09a87e2a 100644 --- a/go/storage/cdb_map.go +++ b/go/storage/cdb_map.go @@ -142,7 +142,7 @@ func (m cdbMap) Visit(visit func(NeedleValue) error) (err error) { func ConvertIndexToCdb(cdbName string, index *os.File) error { idx, err := LoadNeedleMap(index) if err != nil { - return fmt.Errorf("error loading needle map %s: %s", index, err) + return fmt.Errorf("error loading needle map %s: %s", index.Name(), err) } defer idx.Close() return DumpNeedleMapToCdb(cdbName, idx) @@ -185,12 +185,12 @@ func DumpNeedleMapToCdb(cdbName string, nm *NeedleMap) error { }) if err != nil { closer() - return fmt.Errorf("error walking index %s: %s", nm, err) + return fmt.Errorf("error walking index %v: %s", nm, err) } // store fileBytes data, e := json.Marshal(nm.mapMetric) if e != nil { - return fmt.Errorf("error marshaling metric %s: %s", nm.mapMetric, e) + return fmt.Errorf("error marshaling metric %v: %s", nm.mapMetric, e) } if err = adder(cdb.Element{Key: []byte{'M'}, Data: data}); err != nil { return err diff --git a/go/storage/cdb_map_test.go b/go/storage/cdb_map_test.go index 6fe2a12f0..f6a7d42ad 100644 --- a/go/storage/cdb_map_test.go +++ b/go/storage/cdb_map_test.go @@ -84,7 +84,7 @@ func BenchmarkCdbMap9List(t *testing.B) { t.Logf("opening %s", indexFile) idx, err := LoadNeedleMap(indexFile) if err != nil { - t.Fatalf("cannot load %s: %s", indexFile, err) + t.Fatalf("cannot load %s: %s", indexFile.Name(), err) } defer idx.Close() b := getMemStats() @@ -113,7 +113,7 @@ func BenchmarkCdbMap9List(t *testing.B) { glog.V(0).Infof("%d. %s", i, nv) } if nv2, ok := m.Get(uint64(nv.Key)); !ok || nv2 == nil { - t.Errorf("%s in index, not in cdb", nv.Key) + t.Errorf("%d in index, not in cdb", nv.Key) } else if nv2.Key != nv.Key { t.Errorf("requested key %d from cdb, got %d", nv.Key, nv2.Key) } else if nv2.Offset != nv.Offset { @@ -137,7 +137,7 @@ func BenchmarkCdbMap9List(t *testing.B) { return nil } if nv2, ok := m.Get(uint64(nv.Key)); !ok || nv2 == nil { - t.Errorf("%s in cdb, not in index", nv.Key) + t.Errorf("%d in cdb, not in index", nv.Key) } else if nv2.Key != nv.Key { t.Errorf("requested key %d from index, got %d", nv.Key, nv2.Key) } else if nv2.Offset != nv.Offset { diff --git a/go/storage/needle_map.go b/go/storage/needle_map.go index 9c77fcf73..33d3d1747 100644 --- a/go/storage/needle_map.go +++ b/go/storage/needle_map.go @@ -145,7 +145,7 @@ func (nm *NeedleMap) Delete(key uint64) error { if e := nm.indexFile.Truncate(offset); e != nil { plus = "\ncouldn't truncate index file: " + e.Error() } - return fmt.Errorf("error writing to indexfile %s: %s%s", nm.indexFile, err, plus) + return fmt.Errorf("error writing to indexfile %s: %s%s", nm.indexFile.Name(), err, plus) } nm.DeletionCounter++ return nil diff --git a/go/storage/store.go b/go/storage/store.go index a4263dcac..8c6663a08 100644 --- a/go/storage/store.go +++ b/go/storage/store.go @@ -150,7 +150,7 @@ func (s *Store) findFreeLocation() (ret *DiskLocation) { } func (s *Store) addVolume(vid VolumeId, collection string, replicaPlacement *ReplicaPlacement) error { if s.findVolume(vid) != nil { - return fmt.Errorf("Volume Id %s already exists!", vid) + return fmt.Errorf("Volume Id %d already exists!", vid) } if location := s.findFreeLocation(); location != nil { glog.V(0).Infoln("In dir", location.Directory, "adds volume =", vid, ", collection =", collection, ", replicaPlacement =", replicaPlacement) @@ -177,7 +177,7 @@ func (s *Store) CheckCompactVolume(volumeIdString string, garbageThresholdString glog.V(3).Infoln(vid, "garbage level is", v.garbageLevel()) return nil, garbageThreshold < v.garbageLevel() } - return fmt.Errorf("volume id %s is not found during check compact!", vid), false + return fmt.Errorf("volume id %d is not found during check compact!", vid), false } func (s *Store) CompactVolume(volumeIdString string) error { vid, err := NewVolumeId(volumeIdString) @@ -187,7 +187,7 @@ func (s *Store) CompactVolume(volumeIdString string) error { if v := s.findVolume(vid); v != nil { return v.Compact() } - return fmt.Errorf("volume id %s is not found during compact!", vid) + return fmt.Errorf("volume id %d is not found during compact!", vid) } func (s *Store) CommitCompactVolume(volumeIdString string) error { vid, err := NewVolumeId(volumeIdString) @@ -197,7 +197,7 @@ func (s *Store) CommitCompactVolume(volumeIdString string) error { if v := s.findVolume(vid); v != nil { return v.commitCompact() } - return fmt.Errorf("volume id %s is not found during commit compact!", vid) + return fmt.Errorf("volume id %d is not found during commit compact!", vid) } func (s *Store) FreezeVolume(volumeIdString string) error { vid, err := NewVolumeId(volumeIdString) @@ -210,7 +210,7 @@ func (s *Store) FreezeVolume(volumeIdString string) error { } return v.freeze() } - return fmt.Errorf("volume id %s is not found during freeze!", vid) + return fmt.Errorf("volume id %d is not found during freeze!", vid) } func (l *DiskLocation) loadExistingVolumes() { if dirs, err := ioutil.ReadDir(l.Directory); err == nil { @@ -328,7 +328,7 @@ func (s *Store) Close() { func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) { if v := s.findVolume(i); v != nil { if v.readOnly { - err = fmt.Errorf("Volume %s is read only!", i) + err = fmt.Errorf("Volume %d is read only!", i) return } else { if MaxPossibleVolumeSize >= v.ContentSize()+uint64(size) { @@ -346,7 +346,7 @@ func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) { return } glog.V(0).Infoln("volume", i, "not found!") - err = fmt.Errorf("Volume %s not found!", i) + err = fmt.Errorf("Volume %d not found!", i) return } func (s *Store) Delete(i VolumeId, n *Needle) (uint32, error) { diff --git a/go/storage/volume.go b/go/storage/volume.go index f0006f5cc..9ec112c57 100644 --- a/go/storage/volume.go +++ b/go/storage/volume.go @@ -195,7 +195,7 @@ func (v *Volume) isFileUnchanged(n *Needle) bool { func (v *Volume) Destroy() (err error) { if v.readOnly { - err = fmt.Errorf("%s is read-only", v.dataFile) + err = fmt.Errorf("%s is read-only", v.dataFile.Name()) return } v.Close() @@ -210,7 +210,7 @@ func (v *Volume) Destroy() (err error) { func (v *Volume) write(n *Needle) (size uint32, err error) { glog.V(4).Infof("writing needle %s", NewFileIdFromNeedle(v.Id, n).String()) if v.readOnly { - err = fmt.Errorf("%s is read-only", v.dataFile) + err = fmt.Errorf("%s is read-only", v.dataFile.Name()) return } v.accessLock.Lock() @@ -236,7 +236,7 @@ func (v *Volume) write(n *Needle) (size uint32, err error) { if size, err = n.Append(v.dataFile, v.Version()); err != nil { if e := v.dataFile.Truncate(offset); e != nil { - err = fmt.Errorf("%s\ncannot truncate %s: %s", err, v.dataFile, e.Error()) + err = fmt.Errorf("%s\ncannot truncate %s: %s", err, v.dataFile.Name(), e.Error()) } return } @@ -252,7 +252,7 @@ func (v *Volume) write(n *Needle) (size uint32, err error) { func (v *Volume) delete(n *Needle) (uint32, error) { glog.V(4).Infof("delete needle %s", NewFileIdFromNeedle(v.Id, n).String()) if v.readOnly { - return 0, fmt.Errorf("%s is read-only", v.dataFile) + return 0, fmt.Errorf("%s is read-only", v.dataFile.Name()) } v.accessLock.Lock() defer v.accessLock.Unlock() |
