aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-04-20 23:53:37 -0700
committerChris Lu <chris.lu@gmail.com>2019-04-20 23:53:37 -0700
commit316bd27f75e416e803280bc03bd45ed76ce417fa (patch)
treeb74565c7a1c8831ff96e9875b4954347e627e00d
parent64a9a0e10489b216539ece86583d2313e3dca333 (diff)
downloadseaweedfs-316bd27f75e416e803280bc03bd45ed76ce417fa.tar.xz
seaweedfs-316bd27f75e416e803280bc03bd45ed76ce417fa.zip
add remove volumes with version info
-rw-r--r--weed/pb/master.proto1
-rw-r--r--weed/pb/master_pb/master.pb.go162
-rw-r--r--weed/storage/store.go4
-rw-r--r--weed/storage/volume_info.go1
-rw-r--r--weed/topology/topology.go10
-rw-r--r--weed/topology/topology_test.go53
-rw-r--r--weed/topology/volume_layout.go9
7 files changed, 155 insertions, 85 deletions
diff --git a/weed/pb/master.proto b/weed/pb/master.proto
index 424f70805..2d1262b07 100644
--- a/weed/pb/master.proto
+++ b/weed/pb/master.proto
@@ -63,6 +63,7 @@ message VolumeShortInformationMessage {
uint32 id = 1;
string collection = 3;
uint32 replica_placement = 8;
+ uint32 version = 9;
uint32 ttl = 10;
}
diff --git a/weed/pb/master_pb/master.pb.go b/weed/pb/master_pb/master.pb.go
index 1ffa770ef..90d946e4a 100644
--- a/weed/pb/master_pb/master.pb.go
+++ b/weed/pb/master_pb/master.pb.go
@@ -280,6 +280,7 @@ type VolumeShortInformationMessage struct {
Id uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
Collection string `protobuf:"bytes,3,opt,name=collection" json:"collection,omitempty"`
ReplicaPlacement uint32 `protobuf:"varint,8,opt,name=replica_placement,json=replicaPlacement" json:"replica_placement,omitempty"`
+ Version uint32 `protobuf:"varint,9,opt,name=version" json:"version,omitempty"`
Ttl uint32 `protobuf:"varint,10,opt,name=ttl" json:"ttl,omitempty"`
}
@@ -309,6 +310,13 @@ func (m *VolumeShortInformationMessage) GetReplicaPlacement() uint32 {
return 0
}
+func (m *VolumeShortInformationMessage) GetVersion() uint32 {
+ if m != nil {
+ return m.Version
+ }
+ return 0
+}
+
func (m *VolumeShortInformationMessage) GetTtl() uint32 {
if m != nil {
return m.Ttl
@@ -1483,92 +1491,92 @@ var fileDescriptor0 = []byte{
0x10, 0x36, 0x29, 0x59, 0x96, 0x46, 0x96, 0x2c, 0xad, 0x9d, 0x84, 0x51, 0x9a, 0x44, 0xd9, 0x5c,
0x94, 0xfe, 0x18, 0xa9, 0x7b, 0xe8, 0xa1, 0x2d, 0x82, 0xc4, 0x71, 0x50, 0x23, 0x6e, 0x93, 0x50,
0x49, 0x0a, 0x14, 0x28, 0xd8, 0x35, 0xb9, 0x76, 0x08, 0x53, 0x24, 0x4b, 0xae, 0x1c, 0x2b, 0x97,
- 0x5e, 0x7a, 0x2c, 0xd2, 0x43, 0xdf, 0xa7, 0x97, 0x1e, 0xf3, 0x30, 0x05, 0x7a, 0x2f, 0x50, 0xec,
- 0x0f, 0xc9, 0x25, 0x25, 0xdb, 0x49, 0x81, 0x1e, 0x72, 0xdb, 0x9d, 0x99, 0x9d, 0x9d, 0xfd, 0x66,
- 0xf8, 0xcd, 0x48, 0xb0, 0x3a, 0x21, 0x29, 0xa3, 0xc9, 0x66, 0x9c, 0x44, 0x2c, 0x42, 0x2d, 0xb9,
- 0x73, 0xe2, 0x7d, 0xfc, 0xa6, 0x06, 0xad, 0xaf, 0x29, 0x49, 0xd8, 0x3e, 0x25, 0x0c, 0x75, 0xc1,
- 0xf4, 0x63, 0xcb, 0x18, 0x1a, 0xa3, 0x96, 0x6d, 0xfa, 0x31, 0x42, 0x50, 0x8f, 0xa3, 0x84, 0x59,
- 0xe6, 0xd0, 0x18, 0x75, 0x6c, 0xb1, 0x46, 0x57, 0x01, 0xe2, 0xe9, 0x7e, 0xe0, 0xbb, 0xce, 0x34,
- 0x09, 0xac, 0x9a, 0xb0, 0x6d, 0x49, 0xc9, 0xb3, 0x24, 0x40, 0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weed/storage/store.go b/weed/storage/store.go
index 5b2110bd8..2f2c70171 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -105,6 +105,7 @@ func (s *Store) addVolume(vid needle.VolumeId, collection string, needleMapKind
Id: uint32(vid),
Collection: collection,
ReplicaPlacement: uint32(replicaPlacement.Byte()),
+ Version: uint32(volume.Version()),
Ttl: ttl.ToUint32(),
}
return nil
@@ -241,6 +242,7 @@ func (s *Store) MountVolume(i needle.VolumeId) error {
Id: uint32(v.Id),
Collection: v.Collection,
ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()),
+ Version: uint32(v.Version()),
Ttl: v.Ttl.ToUint32(),
}
return nil
@@ -259,6 +261,7 @@ func (s *Store) UnmountVolume(i needle.VolumeId) error {
Id: uint32(v.Id),
Collection: v.Collection,
ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()),
+ Version: uint32(v.Version()),
Ttl: v.Ttl.ToUint32(),
}
for _, location := range s.Locations {
@@ -281,6 +284,7 @@ func (s *Store) DeleteVolume(i needle.VolumeId) error {
Id: uint32(v.Id),
Collection: v.Collection,
ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()),
+ Version: uint32(v.Version()),
Ttl: v.Ttl.ToUint32(),
}
for _, location := range s.Locations {
diff --git a/weed/storage/volume_info.go b/weed/storage/volume_info.go
index a49cb94ba..0e05019d2 100644
--- a/weed/storage/volume_info.go
+++ b/weed/storage/volume_info.go
@@ -47,6 +47,7 @@ func NewVolumeInfoFromShort(m *master_pb.VolumeShortInformationMessage) (vi Volu
vi = VolumeInfo{
Id: needle.VolumeId(m.Id),
Collection: m.Collection,
+ Version: needle.Version(m.Version),
}
rp, e := NewReplicaPlacementFromByte(byte(m.ReplicaPlacement))
if e != nil {
diff --git a/weed/topology/topology.go b/weed/topology/topology.go
index c7dfffff0..44dd1484b 100644
--- a/weed/topology/topology.go
+++ b/weed/topology/topology.go
@@ -189,7 +189,6 @@ func (t *Topology) IncrementalSyncDataNodeRegistration(newVolumes, deletedVolume
continue
}
newVis = append(newVis, vi)
- t.RegisterVolumeLayout(vi, dn)
}
for _, v := range deletedVolumes {
vi, err := storage.NewVolumeInfoFromShort(v)
@@ -198,8 +197,15 @@ func (t *Topology) IncrementalSyncDataNodeRegistration(newVolumes, deletedVolume
continue
}
oldVis = append(oldVis, vi)
- t.UnRegisterVolumeLayout(vi, dn)
}
dn.DeltaUpdateVolumes(newVis, oldVis)
+
+ for _, vi := range newVis {
+ t.RegisterVolumeLayout(vi, dn)
+ }
+ for _, vi := range oldVis {
+ t.UnRegisterVolumeLayout(vi, dn)
+ }
+
return
}
diff --git a/weed/topology/topology_test.go b/weed/topology/topology_test.go
index ec745ee93..7d7d4d7ad 100644
--- a/weed/topology/topology_test.go
+++ b/weed/topology/topology_test.go
@@ -41,7 +41,7 @@ func TestHandlingVolumeServerHeartbeat(t *testing.T) {
DeletedByteCount: 34524,
ReadOnly: false,
ReplicaPlacement: uint32(0),
- Version: uint32(1),
+ Version: uint32(needle.CurrentVersion),
Ttl: 0,
}
volumeMessages = append(volumeMessages, volumeMessage)
@@ -66,15 +66,63 @@ func TestHandlingVolumeServerHeartbeat(t *testing.T) {
DeletedByteCount: 345240,
ReadOnly: false,
ReplicaPlacement: uint32(0),
- Version: uint32(1),
+ Version: uint32(needle.CurrentVersion),
Ttl: 0,
}
volumeMessages = append(volumeMessages, volumeMessage)
}
topo.SyncDataNodeRegistration(volumeMessages, dn)
+ //rp, _ := storage.NewReplicaPlacementFromString("000")
+ //layout := topo.GetVolumeLayout("", rp, needle.EMPTY_TTL)
+ //assert(t, "writables", len(layout.writables), volumeCount)
+
+ assert(t, "activeVolumeCount1", int(topo.activeVolumeCount), volumeCount)
+ assert(t, "volumeCount", int(topo.volumeCount), volumeCount)
+ }
+
+ {
+ volumeCount := 6
+ newVolumeShortMessage := &master_pb.VolumeShortInformationMessage{
+ Id: uint32(3),
+ Collection: "",
+ ReplicaPlacement: uint32(0),
+ Version: uint32(needle.CurrentVersion),
+ Ttl: 0,
+ }
+ topo.IncrementalSyncDataNodeRegistration(
+ []*master_pb.VolumeShortInformationMessage{newVolumeShortMessage},
+ nil,
+ dn)
+ rp, _ := storage.NewReplicaPlacementFromString("000")
+ layout := topo.GetVolumeLayout("", rp, needle.EMPTY_TTL)
+ assert(t, "writables after repeated add", len(layout.writables), volumeCount)
+
assert(t, "activeVolumeCount1", int(topo.activeVolumeCount), volumeCount)
assert(t, "volumeCount", int(topo.volumeCount), volumeCount)
+
+ topo.IncrementalSyncDataNodeRegistration(
+ nil,
+ []*master_pb.VolumeShortInformationMessage{newVolumeShortMessage},
+ dn)
+ assert(t, "writables after deletion", len(layout.writables), volumeCount-1)
+ assert(t, "activeVolumeCount1", int(topo.activeVolumeCount), volumeCount-1)
+ assert(t, "volumeCount", int(topo.volumeCount), volumeCount-1)
+
+ topo.IncrementalSyncDataNodeRegistration(
+ []*master_pb.VolumeShortInformationMessage{newVolumeShortMessage},
+ nil,
+ dn)
+
+ for vid, _ := range layout.vid2location{
+ println("after add volume id", vid)
+ }
+ for _, vid := range layout.writables{
+ println("after add writable volume id", vid)
+ }
+
+ assert(t, "writables after add back", len(layout.writables), volumeCount)
+
}
topo.UnRegisterDataNode(dn)
@@ -112,6 +160,7 @@ func TestAddRemoveVolume(t *testing.T) {
dn.UpdateVolumes([]storage.VolumeInfo{v})
topo.RegisterVolumeLayout(v, dn)
+ topo.RegisterVolumeLayout(v, dn)
if _, hasCollection := topo.FindCollection(v.Collection); !hasCollection {
t.Errorf("collection %v should exist", v.Collection)
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go
index b3aa7d251..6ab90e9e2 100644
--- a/weed/topology/volume_layout.go
+++ b/weed/topology/volume_layout.go
@@ -50,7 +50,7 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
vl.accessLock.Lock()
defer vl.accessLock.Unlock()
- if _, ok := vl.vid2location[v.Id]; !ok {
+ if _, ok := vl.vid2location[v.Id]; !ok || vl.vid2location[v.Id] == nil {
vl.vid2location[v.Id] = NewVolumeLocationList()
}
vl.vid2location[v.Id].Set(dn)
@@ -58,7 +58,7 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
for _, dn := range vl.vid2location[v.Id].list {
if vInfo, err := dn.GetVolumesById(v.Id); err == nil {
if vInfo.ReadOnly {
- glog.V(3).Infof("vid %d removed from writable", v.Id)
+ glog.V(1).Infof("vid %d removed from writable", v.Id)
vl.removeFromWritable(v.Id)
vl.readonlyVolumes[v.Id] = true
return
@@ -66,7 +66,7 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
delete(vl.readonlyVolumes, v.Id)
}
} else {
- glog.V(3).Infof("vid %d removed from writable", v.Id)
+ glog.V(1).Infof("vid %d removed from writable", v.Id)
vl.removeFromWritable(v.Id)
delete(vl.readonlyVolumes, v.Id)
return
@@ -93,7 +93,8 @@ func (vl *VolumeLayout) UnRegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
defer vl.accessLock.Unlock()
vl.removeFromWritable(v.Id)
- delete(vl.vid2location, v.Id)
+ delete(vl.vid2location, v.Id) // somehow this line does not work as expected
+ // vl.vid2location[v.Id] = nil
}
func (vl *VolumeLayout) addToWritable(vid needle.VolumeId) {