aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2014-04-17 00:16:44 -0700
committerChris Lu <chris.lu@gmail.com>2014-04-17 00:16:44 -0700
commit3b5035c468626af9ba052afaaa16a8cd3598423e (patch)
tree5949edc5a243888d79fea90272e1a95270b4a7ab
parent51939efeac635d0ba8b683cae6176aa60845b5f7 (diff)
downloadseaweedfs-3b5035c468626af9ba052afaaa16a8cd3598423e.tar.xz
seaweedfs-3b5035c468626af9ba052afaaa16a8cd3598423e.zip
1. v0.54
2. go vet found many printing format errors
-rw-r--r--go/storage/cdb_map.go6
-rw-r--r--go/storage/cdb_map_test.go6
-rw-r--r--go/storage/needle_map.go2
-rw-r--r--go/storage/store.go14
-rw-r--r--go/storage/volume.go8
-rw-r--r--go/topology/volume_layout.go1
-rw-r--r--go/util/constants.go2
-rw-r--r--go/weed/export.go2
-rw-r--r--go/weed/server.go2
-rw-r--r--go/weed/shell.go1
-rw-r--r--go/weed/volume.go2
11 files changed, 22 insertions, 24 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()
diff --git a/go/topology/volume_layout.go b/go/topology/volume_layout.go
index bd95cc796..538acb54c 100644
--- a/go/topology/volume_layout.go
+++ b/go/topology/volume_layout.go
@@ -107,7 +107,6 @@ func (vl *VolumeLayout) PickForWrite(count int, option *VolumeGrowOption) (*stor
}
return &vid, count, locationList, nil
}
- return nil, 0, nil, errors.New("Strangely This Should Never Have Happened!")
}
func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) int {
diff --git a/go/util/constants.go b/go/util/constants.go
index a666ff5d5..ab57af0c9 100644
--- a/go/util/constants.go
+++ b/go/util/constants.go
@@ -3,5 +3,5 @@ package util
import ()
const (
- VERSION = "0.54 beta"
+ VERSION = "0.54"
)
diff --git a/go/weed/export.go b/go/weed/export.go
index ef14e19c0..dae6053c7 100644
--- a/go/weed/export.go
+++ b/go/weed/export.go
@@ -94,7 +94,7 @@ func runExport(cmd *Command, args []string) bool {
nm, err := storage.LoadNeedleMap(indexFile)
if err != nil {
- glog.Fatalf("cannot load needle map from %s: %s", indexFile, err)
+ glog.Fatalf("cannot load needle map from %s: %s", indexFile.Name(), err)
}
var version storage.Version
diff --git a/go/weed/server.go b/go/weed/server.go
index 61e42fb36..dde896c09 100644
--- a/go/weed/server.go
+++ b/go/weed/server.go
@@ -86,7 +86,7 @@ func runServer(cmd *Command, args []string) bool {
if max, e := strconv.Atoi(maxString); e == nil {
maxCounts = append(maxCounts, max)
} else {
- glog.Fatalf("The max specified in -max not a valid number %s", max)
+ glog.Fatalf("The max specified in -max not a valid number %s", maxString)
}
}
if len(folders) != len(maxCounts) {
diff --git a/go/weed/shell.go b/go/weed/shell.go
index 885a0fa71..6a3331284 100644
--- a/go/weed/shell.go
+++ b/go/weed/shell.go
@@ -57,5 +57,4 @@ func runShell(command *Command, args []string) bool {
cmd = readLine()
execCmd(cmd)
}
- return true
}
diff --git a/go/weed/volume.go b/go/weed/volume.go
index 3c6cf05a5..a43a396b2 100644
--- a/go/weed/volume.go
+++ b/go/weed/volume.go
@@ -53,7 +53,7 @@ func runVolume(cmd *Command, args []string) bool {
if max, e := strconv.Atoi(maxString); e == nil {
maxCounts = append(maxCounts, max)
} else {
- glog.Fatalf("The max specified in -max not a valid number %s", max)
+ glog.Fatalf("The max specified in -max not a valid number %s", maxString)
}
}
if len(folders) != len(maxCounts) {