[ARVADOS] updated: 0aaa4681a5ad936aeaa08b9b30b167d9f7cac7cc

git at public.curoverse.com git at public.curoverse.com
Thu May 14 12:33:06 EDT 2015


Summary of changes:
 .../app/views/layouts/application.html.erb         | 16 +++++++++++
 sdk/go/keepclient/keepclient.go                    |  6 ++---
 sdk/go/keepclient/keepclient_test.go               | 31 +++++++++++++---------
 sdk/go/keepclient/support.go                       | 13 ++++-----
 services/keepproxy/keepproxy_test.go               |  2 +-
 5 files changed, 43 insertions(+), 25 deletions(-)

       via  0aaa4681a5ad936aeaa08b9b30b167d9f7cac7cc (commit)
       via  af934d0ffc1d26efc766bb18c226dae70c2179b7 (commit)
       via  01574a902d99cba21ed53e62cef6bef683bed2a2 (commit)
       via  ad73066c03b640dfe710e4b9eef1ea56cee30629 (commit)
       via  1be4d2818c9e81b47887e33f8dfba347851fd88f (commit)
       via  cfb0f7874504563836442522be33c53e6fd586de (commit)
       via  d2e7d7e1a7d1de592ea98c661be41429d7b6160b (commit)
      from  a88e87137911142ef7e9237703a1073e4feffdb7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 0aaa4681a5ad936aeaa08b9b30b167d9f7cac7cc
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu May 14 12:32:12 2015 -0400

    4717: writable roots in go sdk

diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index f908a5a..5ebdf0a 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -196,7 +196,7 @@ func (kc *KeepClient) GatewayRoots() map[string]string {
 }
 
 // WritableRoots() returns the map of writable Keep services:
-// url -> ""
+// uuid -> baseURI.
 func (kc *KeepClient) WritableRoots() map[string]string {
 	kc.lock.RLock()
 	defer kc.lock.RUnlock()
@@ -220,8 +220,8 @@ func (kc *KeepClient) SetServiceRoots(newLocals, newGateways map[string]string,
 		gateways[uuid] = root
 	}
 	writables := make(map[string]string)
-	for root, _ := range writableRoots {
-		writables[root] = ""
+	for uuid, root := range writableRoots {
+		writables[uuid] = root
 	}
 	kc.lock.Lock()
 	defer kc.lock.Unlock()
diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index 764cd0d..5bd540a 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -249,7 +249,7 @@ func (s *StandaloneSuite) TestPutB(c *C) {
 
 	for i, k := range ks {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 
@@ -294,7 +294,7 @@ func (s *StandaloneSuite) TestPutHR(c *C) {
 
 	for i, k := range ks {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 
@@ -351,12 +351,12 @@ func (s *StandaloneSuite) TestPutWithFail(c *C) {
 
 	for i, k := range ks1 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 	for i, k := range ks2 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i+len(ks1))] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i+len(ks1))] = k.url
 		defer k.listener.Close()
 	}
 
@@ -410,12 +410,12 @@ func (s *StandaloneSuite) TestPutWithTooManyFail(c *C) {
 
 	for i, k := range ks1 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 	for i, k := range ks2 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i+len(ks1))] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i+len(ks1))] = k.url
 		defer k.listener.Close()
 	}
 
@@ -577,7 +577,11 @@ func (s *StandaloneSuite) TestGetWithLocalServiceHint(c *C) {
 			"zzzzz-bi6l4-xxxxxxxxxxxxxxx": ks0.url,
 			"zzzzz-bi6l4-wwwwwwwwwwwwwww": ks0.url,
 			uuid: ks.url},
-		map[string]string{ks.url: ""},
+		map[string]string{
+			"zzzzz-bi6l4-yyyyyyyyyyyyyyy": ks0.url,
+			"zzzzz-bi6l4-xxxxxxxxxxxxxxx": ks0.url,
+			"zzzzz-bi6l4-wwwwwwwwwwwwwww": ks0.url,
+			uuid: ks.url},
 	)
 
 	r, n, uri, err := kc.Get(hash + "+K@" + uuid)
@@ -616,7 +620,8 @@ func (s *StandaloneSuite) TestGetWithServiceHintFailoverToLocals(c *C) {
 	kc.SetServiceRoots(
 		map[string]string{"zzzzz-bi6l4-keepdisk0000000": ksLocal.url},
 		map[string]string{uuid: ksGateway.url},
-		map[string]string{ksLocal.url: "", ksGateway.url: ""})
+		map[string]string{"zzzzz-bi6l4-keepdisk0000000": ksLocal.url},
+  )
 
 	r, n, uri, err := kc.Get(hash + "+K@" + uuid)
 	c.Assert(err, Equals, nil)
@@ -692,12 +697,12 @@ func (s *StandaloneSuite) TestGetWithFailures(c *C) {
 
 	for i, k := range ks1 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 	for i, k := range ks2 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i+len(ks1))] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i+len(ks1))] = k.url
 		defer k.listener.Close()
 	}
 
@@ -788,7 +793,7 @@ func (s *StandaloneSuite) TestPutProxy(c *C) {
 
 	for i, k := range ks1 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 
@@ -821,7 +826,7 @@ func (s *StandaloneSuite) TestPutProxyInsufficientReplicas(c *C) {
 
 	for i, k := range ks1 {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
-		writableRoots[k.url] = ""
+		writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		defer k.listener.Close()
 	}
 	kc.SetServiceRoots(localRoots, nil, writableRoots)
@@ -899,7 +904,7 @@ func (s *StandaloneSuite) TestPutBWant2ReplicasWithOnlyOneWritableRoots(c *C) {
 	for i, k := range ks {
 		localRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		if i == 0 {
-			writableRoots[k.url] = ""
+			writableRoots[fmt.Sprintf("zzzzz-bi6l4-fakefakefake%03d", i)] = k.url
 		}
 		defer k.listener.Close()
 	}
diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go
index e9c8d68..776cb23 100644
--- a/sdk/go/keepclient/support.go
+++ b/sdk/go/keepclient/support.go
@@ -118,7 +118,7 @@ func (this *KeepClient) DiscoverKeepServers() error {
 		}
 
 		if service.ReadOnly == false {
-			writableRoots[url] = ""
+			writableRoots[service.Uuid] = url
 		}
 
 		// Gateway services are only used when specified by
@@ -219,8 +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.WritableRoots(), hash).GetSortedRoots()
 	// The next server to try contacting
 	next_server := 0
 
@@ -238,12 +237,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
diff --git a/services/keepproxy/keepproxy_test.go b/services/keepproxy/keepproxy_test.go
index 3530ac8..b70b933 100644
--- a/services/keepproxy/keepproxy_test.go
+++ b/services/keepproxy/keepproxy_test.go
@@ -119,7 +119,7 @@ func runProxy(c *C, args []string, port int, bogusClientToken bool) keepclient.K
 		"proxy": fmt.Sprintf("http://localhost:%v", port),
 	}
 	writables := map[string]string{
-		fmt.Sprintf("http://localhost:%v", port): "",
+		"proxy": fmt.Sprintf("http://localhost:%v", port),
 	}
 	kc.SetServiceRoots(locals, nil, writables)
 	c.Check(kc.Using_proxy, Equals, true)

commit af934d0ffc1d26efc766bb18c226dae70c2179b7
Merge: a88e871 01574a9
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu May 14 11:59:34 2015 -0400

    Merge branch 'master' into 4717-read-only-keep-services-flag


-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list