X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a88e87137911142ef7e9237703a1073e4feffdb7..deba5b86b2e0c41d18d6f9f7bd72f18755ed7a81:/sdk/go/keepclient/support.go diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go index e9c8d68727..7b96341823 100644 --- a/sdk/go/keepclient/support.go +++ b/sdk/go/keepclient/support.go @@ -94,7 +94,7 @@ func (this *KeepClient) DiscoverKeepServers() error { listed := make(map[string]bool) localRoots := make(map[string]string) gatewayRoots := make(map[string]string) - writableRoots := make(map[string]string) + writableLocalRoots := make(map[string]string) for _, service := range m.Items { scheme := "http" @@ -118,7 +118,7 @@ func (this *KeepClient) DiscoverKeepServers() error { } if service.ReadOnly == false { - writableRoots[url] = "" + writableLocalRoots[service.Uuid] = url } // Gateway services are only used when specified by @@ -135,7 +135,7 @@ func (this *KeepClient) DiscoverKeepServers() error { this.setClientSettingsStore() } - this.SetServiceRoots(localRoots, gatewayRoots, writableRoots) + this.SetServiceRoots(localRoots, writableLocalRoots, gatewayRoots) return nil } @@ -219,7 +219,7 @@ func (this KeepClient) putReplicas( requestId := fmt.Sprintf("%x", md5.Sum([]byte(locator+time.Now().String())))[0:8] // Calculate the ordering for uploading to servers - sv := NewRootSorter(this.LocalRoots(), hash).GetSortedRoots() + sv := NewRootSorter(this.WritableLocalRoots(), hash).GetSortedRoots() // The next server to try contacting next_server := 0 @@ -238,12 +238,10 @@ func (this KeepClient) putReplicas( for active < remaining_replicas { // Start some upload requests if next_server < len(sv) { - if _, ok := this.WritableRoots()[sv[next_server]]; ok { // If writable - log.Printf("[%v] Begin upload %s to %s", requestId, hash, sv[next_server]) - go this.uploadToKeepServer(sv[next_server], hash, tr.MakeStreamReader(), upload_status, expectedLength, requestId) - active += 1 - } + log.Printf("[%v] Begin upload %s to %s", requestId, hash, sv[next_server]) + go this.uploadToKeepServer(sv[next_server], hash, tr.MakeStreamReader(), upload_status, expectedLength, requestId) next_server += 1 + active += 1 } else { if active == 0 { return locator, (this.Want_replicas - remaining_replicas), InsufficientReplicasError