diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-24 13:28:44 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-24 13:28:44 -0700 |
| commit | 6f4b09b6a46f63eaebbbc23198d3ec73754ed11d (patch) | |
| tree | 152c9dd2bb7fd551480322e4299b2aa29a5fe9bc /weed/topology | |
| parent | 228850d58888174d5f0d84c7f0f9506fb4360176 (diff) | |
| download | seaweedfs-6f4b09b6a46f63eaebbbc23198d3ec73754ed11d.tar.xz seaweedfs-6f4b09b6a46f63eaebbbc23198d3ec73754ed11d.zip | |
pb shard info uses ShardBits instead one message for one shard
Diffstat (limited to 'weed/topology')
| -rw-r--r-- | weed/topology/data_node.go | 2 | ||||
| -rw-r--r-- | weed/topology/topology_ec.go | 19 |
2 files changed, 6 insertions, 15 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go index dba323518..5edc9c580 100644 --- a/weed/topology/data_node.go +++ b/weed/topology/data_node.go @@ -164,7 +164,7 @@ func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo { m.VolumeInfos = append(m.VolumeInfos, v.ToVolumeInformationMessage()) } for _, ecv := range dn.GetEcShards() { - m.EcShardInfos = append(m.EcShardInfos, ecv.ToVolumeEcShardInformationMessage()...) + m.EcShardInfos = append(m.EcShardInfos, ecv.ToVolumeEcShardInformationMessage()) } return m } diff --git a/weed/topology/topology_ec.go b/weed/topology/topology_ec.go index 379440684..eb52b44b4 100644 --- a/weed/topology/topology_ec.go +++ b/weed/topology/topology_ec.go @@ -1,9 +1,6 @@ package topology import ( - "math" - "sort" - "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" "github.com/chrislusf/seaweedfs/weed/storage/erasure_coding" @@ -20,18 +17,12 @@ type EcShardLocations struct { func (t *Topology) SyncDataNodeEcShards(shardInfos []*master_pb.VolumeEcShardInformationMessage, dn *DataNode) (newShards, deletedShards []*erasure_coding.EcVolumeInfo) { // convert into in memory struct storage.VolumeInfo var shards []*erasure_coding.EcVolumeInfo - sort.Slice(shardInfos, func(i, j int) bool { - return shardInfos[i].Id < shardInfos[j].Id - }) - prevVolumeId := uint32(math.MaxUint32) - var ecVolumeInfo *erasure_coding.EcVolumeInfo for _, shardInfo := range shardInfos { - if shardInfo.Id != prevVolumeId { - ecVolumeInfo = erasure_coding.NewEcVolumeInfo(shardInfo.Collection, needle.VolumeId(shardInfo.Id)) - shards = append(shards, ecVolumeInfo) - } - prevVolumeId = shardInfo.Id - ecVolumeInfo.AddShardId(erasure_coding.ShardId(shardInfo.EcIndex)) + shards = append(shards, + erasure_coding.NewEcVolumeInfo( + shardInfo.Collection, + needle.VolumeId(shardInfo.Id), + erasure_coding.ShardBits(shardInfo.EcIndexBits))) } // find out the delta volumes newShards, deletedShards = dn.UpdateEcShards(shards) |
