[arvados] updated: 2.7.0-5898-g0d5bfc77fb

git repository hosting git at public.arvados.org
Mon Feb 12 16:06:58 UTC 2024


Summary of changes:
 services/keep-balance/change_set.go      |  4 ++--
 services/keep-balance/change_set_test.go |  4 ++--
 services/keepstore/keepstore.go          |  2 +-
 services/keepstore/router_test.go        | 13 +++++++++++++
 4 files changed, 18 insertions(+), 5 deletions(-)

       via  0d5bfc77fbb1b32f7767ed48053e021fac63e776 (commit)
       via  38bb7656f6d8e5672aaedf2d48b24a019a704ba9 (commit)
      from  4a68dab51715a65ce88c4e2d44070a82ffcfcd83 (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 0d5bfc77fbb1b32f7767ed48053e021fac63e776
Author: Tom Clegg <tom at curii.com>
Date:   Mon Feb 12 11:06:49 2024 -0500

    2960: Send entire locator with size in pull lists.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keep-balance/change_set.go b/services/keep-balance/change_set.go
index bb5a1dbf5e..771e277d60 100644
--- a/services/keep-balance/change_set.go
+++ b/services/keep-balance/change_set.go
@@ -25,7 +25,7 @@ type Pull struct {
 // it.
 func (p Pull) MarshalJSON() ([]byte, error) {
 	return json.Marshal(keepstore.PullListItem{
-		Locator:   string(p.SizedDigest[:32]),
+		Locator:   string(p.SizedDigest),
 		Servers:   []string{p.From.URLBase()},
 		MountUUID: p.To.KeepMount.UUID,
 	})
@@ -42,7 +42,7 @@ type Trash struct {
 // it, i.e., as a bare locator with no +size hint.
 func (t Trash) MarshalJSON() ([]byte, error) {
 	return json.Marshal(keepstore.TrashListItem{
-		Locator:    string(t.SizedDigest[:32]),
+		Locator:    string(t.SizedDigest),
 		BlockMtime: t.Mtime,
 		MountUUID:  t.From.KeepMount.UUID,
 	})
diff --git a/services/keep-balance/change_set_test.go b/services/keep-balance/change_set_test.go
index 5474d29fb5..f2b9429017 100644
--- a/services/keep-balance/change_set_test.go
+++ b/services/keep-balance/change_set_test.go
@@ -33,12 +33,12 @@ func (s *changeSetSuite) TestJSONFormat(c *check.C) {
 		To:          mnt,
 		From:        srv}})
 	c.Check(err, check.IsNil)
-	c.Check(string(buf), check.Equals, `[{"locator":"acbd18db4cc2f85cedef654fccc4a4d8","servers":["http://keep1.zzzzz.arvadosapi.com:25107"],"mount_uuid":"zzzzz-mount-abcdefghijklmno"}]`)
+	c.Check(string(buf), check.Equals, `[{"locator":"acbd18db4cc2f85cedef654fccc4a4d8+3","servers":["http://keep1.zzzzz.arvadosapi.com:25107"],"mount_uuid":"zzzzz-mount-abcdefghijklmno"}]`)
 
 	buf, err = json.Marshal([]Trash{{
 		SizedDigest: arvados.SizedDigest("acbd18db4cc2f85cedef654fccc4a4d8+3"),
 		From:        mnt,
 		Mtime:       123456789}})
 	c.Check(err, check.IsNil)
-	c.Check(string(buf), check.Equals, `[{"locator":"acbd18db4cc2f85cedef654fccc4a4d8","block_mtime":123456789,"mount_uuid":"zzzzz-mount-abcdefghijklmno"}]`)
+	c.Check(string(buf), check.Equals, `[{"locator":"acbd18db4cc2f85cedef654fccc4a4d8+3","block_mtime":123456789,"mount_uuid":"zzzzz-mount-abcdefghijklmno"}]`)
 }

commit 38bb7656f6d8e5672aaedf2d48b24a019a704ba9
Author: Tom Clegg <tom at curii.com>
Date:   Mon Feb 12 10:28:06 2024 -0500

    2960: Fix BlockWrite
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/keepstore.go b/services/keepstore/keepstore.go
index 11958f1545..d73118b9b6 100644
--- a/services/keepstore/keepstore.go
+++ b/services/keepstore/keepstore.go
@@ -366,7 +366,7 @@ func (ks *keepstore) BlockWrite(ctx context.Context, opts arvados.BlockWriteOpti
 			return resp, err
 		}
 		defer ks.bufferPool.Put(buf)
-		w := bytes.NewBuffer(buf)
+		w := bytes.NewBuffer(buf[:0])
 		h := md5.New()
 		limitedReader := &io.LimitedReader{R: opts.Reader, N: BlockSize}
 		n, err := io.Copy(io.MultiWriter(w, h), limitedReader)
diff --git a/services/keepstore/router_test.go b/services/keepstore/router_test.go
index 04ff665178..d40043c7e4 100644
--- a/services/keepstore/router_test.go
+++ b/services/keepstore/router_test.go
@@ -123,6 +123,19 @@ func (s *routerSuite) TestBlockRead_ChecksumMismatch(c *C) {
 	}
 }
 
+func (s *routerSuite) TestBlockWrite(c *C) {
+	router, cancel := testRouter(c, s.cluster, nil)
+	defer cancel()
+
+	resp := call(router, "PUT", "http://example/"+fooHash, arvadostest.ActiveTokenV2, []byte("foo"), nil)
+	c.Check(resp.Code, Equals, http.StatusOK)
+	locator := strings.TrimSpace(resp.Body.String())
+
+	resp = call(router, "GET", "http://example/"+locator, arvadostest.ActiveTokenV2, nil, nil)
+	c.Check(resp.Code, Equals, http.StatusOK)
+	c.Check(resp.Body.String(), Equals, "foo")
+}
+
 func (s *routerSuite) TestBlockWrite_Headers(c *C) {
 	router, cancel := testRouter(c, s.cluster, nil)
 	defer cancel()

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list