fix ec related bugs

This commit is contained in:
Chris Lu
2019-06-05 23:20:26 -07:00
parent 450f4733ce
commit d344e0a035
9 changed files with 51 additions and 9 deletions

View File

@@ -78,7 +78,7 @@ func (t *Topology) Leader() (string, error) {
return l, nil
}
func (t *Topology) Lookup(collection string, vid needle.VolumeId) []*DataNode {
func (t *Topology) Lookup(collection string, vid needle.VolumeId) (dataNodes []*DataNode) {
//maybe an issue if lots of collections?
if collection == "" {
for _, c := range t.collectionMap.Items() {
@@ -91,6 +91,14 @@ func (t *Topology) Lookup(collection string, vid needle.VolumeId) []*DataNode {
return c.(*Collection).Lookup(vid)
}
}
if locations, found := t.LookupEcShards(vid); found {
for _, loc := range locations.Locations {
dataNodes = append(dataNodes, loc...)
}
return dataNodes
}
return nil
}