aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/volume_layout.go
diff options
context:
space:
mode:
authorbingoohuang <bingoo.huang@gmail.com>2019-01-17 09:17:19 +0800
committerbingoohuang <bingoo.huang@gmail.com>2019-01-17 09:17:19 +0800
commitab6be025d76748388ad3eea6fe6ca000db1c2435 (patch)
tree1be9b1b5e7f91693f4cabe3ae0d114cb7f7dced6 /weed/topology/volume_layout.go
parent6ddfaf33cba953b92a5e3383a15bf26ab1845dbc (diff)
downloadseaweedfs-ab6be025d76748388ad3eea6fe6ca000db1c2435.tar.xz
seaweedfs-ab6be025d76748388ad3eea6fe6ca000db1c2435.zip
go fmt and fix some typo
Diffstat (limited to 'weed/topology/volume_layout.go')
-rw-r--r--weed/topology/volume_layout.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go
index 31637b11a..71a071e2f 100644
--- a/weed/topology/volume_layout.go
+++ b/weed/topology/volume_layout.go
@@ -55,8 +55,8 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
vl.vid2location[v.Id].Set(dn)
// glog.V(4).Infof("volume %d added to %s len %d copy %d", v.Id, dn.Id(), vl.vid2location[v.Id].Length(), v.ReplicaPlacement.GetCopyCount())
for _, dn := range vl.vid2location[v.Id].list {
- if v_info, err := dn.GetVolumesById(v.Id); err == nil {
- if v_info.ReadOnly {
+ if vInfo, err := dn.GetVolumesById(v.Id); err == nil {
+ if vInfo.ReadOnly {
glog.V(3).Infof("vid %d removed from writable", v.Id)
vl.removeFromWritable(v.Id)
vl.readonlyVolumes[v.Id] = true
@@ -145,13 +145,13 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (*s
vl.accessLock.RLock()
defer vl.accessLock.RUnlock()
- len_writers := len(vl.writables)
- if len_writers <= 0 {
+ lenWriters := len(vl.writables)
+ if lenWriters <= 0 {
glog.V(0).Infoln("No more writable volumes!")
return nil, 0, nil, errors.New("No more writable volumes!")
}
if option.DataCenter == "" {
- vid := vl.writables[rand.Intn(len_writers)]
+ vid := vl.writables[rand.Intn(lenWriters)]
locationList := vl.vid2location[vid]
if locationList != nil {
return &vid, count, locationList, nil