[ARVADOS] updated: 2.1.0-1197-g69cc7c89a

Git user git at public.arvados.org
Mon Aug 23 14:29:40 UTC 2021


Summary of changes:
 services/keepstore/handler_test.go | 20 +++++++++++++++
 services/keepstore/handlers.go     | 50 +++++++++++++++++++-------------------
 services/keepstore/volume.go       |  3 +++
 3 files changed, 48 insertions(+), 25 deletions(-)

       via  69cc7c89aa51e7aa7265215bfc910eaa457986d8 (commit)
       via  c33f2b099d86429356b1655cff688aef9fa18764 (commit)
       via  b8f6c929b202ec691b52189acc4f79ff3db9fa50 (commit)
       via  e8dd5c58fdb7d07badb9389f8524e506c9c66f68 (commit)
       via  3f08b10a2b466a498bc3a202cae1492ff3480510 (commit)
      from  e0632f47bb83bda5badccc47cc2d8dbb70d92678 (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 69cc7c89aa51e7aa7265215bfc910eaa457986d8
Author: Tom Clegg <tom at curii.com>
Date:   Mon Aug 23 10:28:17 2021 -0400

    17698: Test "no writable volumes" case.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go
index cbc83929d..16dcd2aaf 100644
--- a/services/keepstore/handler_test.go
+++ b/services/keepstore/handler_test.go
@@ -368,6 +368,26 @@ func (s *HandlerSuite) TestReadsOrderedByStorageClassPriority(c *check.C) {
 	}
 }
 
+func (s *HandlerSuite) TestPutWithNoWritableVolumes(c *check.C) {
+	s.cluster.Volumes = map[string]arvados.Volume{
+		"zzzzz-nyw5e-111111111111111": {
+			Driver:         "mock",
+			Replication:    1,
+			ReadOnly:       true,
+			StorageClasses: map[string]bool{"class1": true}},
+	}
+	c.Assert(s.handler.setup(context.Background(), s.cluster, "", prometheus.NewRegistry(), testServiceURL), check.IsNil)
+	resp := IssueRequest(s.handler,
+		&RequestTester{
+			method:         "PUT",
+			uri:            "/" + TestHash,
+			requestBody:    TestBlock,
+			storageClasses: "class1",
+		})
+	c.Check(resp.Code, check.Equals, FullError.HTTPCode)
+	c.Check(s.handler.volmgr.mountMap["zzzzz-nyw5e-111111111111111"].Volume.(*MockVolume).CallCount("Put"), check.Equals, 0)
+}
+
 func (s *HandlerSuite) TestConcurrentWritesToMultipleStorageClasses(c *check.C) {
 	s.cluster.Volumes = map[string]arvados.Volume{
 		"zzzzz-nyw5e-111111111111111": {

commit c33f2b099d86429356b1655cff688aef9fa18764
Author: Tom Clegg <tom at curii.com>
Date:   Mon Aug 23 10:01:40 2021 -0400

    17698: Add comment to clarify locking.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 4698d1faf..910033ebb 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -912,7 +912,11 @@ func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash s
 	pending := result.Copy()
 	var allFull atomic.Value
 	allFull.Store(true)
+
+	// We hold the lock for the duration of the "each volume" loop
+	// below, except when it is released during cond.Wait().
 	mtx.Lock()
+
 	for _, mnt := range writables {
 		// Wait until our decision to use this mount does not
 		// depend on the outcome of pending writes.

commit b8f6c929b202ec691b52189acc4f79ff3db9fa50
Author: Tom Clegg <tom at curii.com>
Date:   Mon Aug 23 10:01:32 2021 -0400

    17698: Update PutBlock comment.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 4459adfa1..4698d1faf 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -853,33 +853,29 @@ func newPutProgress(classes []string) putProgress {
 	return pr
 }
 
-// PutBlock Stores the BLOCK (identified by the content id HASH) in Keep.
+// PutBlock stores the given block on one or more volumes.
 //
-// PutBlock(ctx, block, hash)
-//   Stores the BLOCK (identified by the content id HASH) in Keep.
+// The MD5 checksum of the block must match the given hash.
 //
-//   The MD5 checksum of the block must be identical to the content id HASH.
-//   If not, an error is returned.
+// The block is written to each writable volume (ordered by priority
+// and then UUID, see volume.go) until at least one replica has been
+// stored in each of the requested storage classes.
 //
-//   PutBlock stores the BLOCK on the first Keep volume with free space.
-//   A failure code is returned to the user only if all volumes fail.
-//
-//   On success, PutBlock returns nil.
-//   On failure, it returns a KeepError with one of the following codes:
-//
-//   500 Collision
-//          A different block with the same hash already exists on this
-//          Keep server.
-//   422 MD5Fail
-//          The MD5 hash of the BLOCK does not match the argument HASH.
-//   503 Full
-//          There was not enough space left in any Keep volume to store
-//          the object.
-//   500 Fail
-//          The object could not be stored for some other reason (e.g.
-//          all writes failed). The text of the error message should
-//          provide as much detail as possible.
+// The returned error, if any, is a KeepError with one of the
+// following codes:
 //
+// 500 Collision
+//        A different block with the same hash already exists on this
+//        Keep server.
+// 422 MD5Fail
+//        The MD5 hash of the BLOCK does not match the argument HASH.
+// 503 Full
+//        There was not enough space left in any Keep volume to store
+//        the object.
+// 500 Fail
+//        The object could not be stored for some other reason (e.g.
+//        all writes failed). The text of the error message should
+//        provide as much detail as possible.
 func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash string, wantStorageClasses []string) (putProgress, error) {
 	log := ctxlog.FromContext(ctx)
 

commit e8dd5c58fdb7d07badb9389f8524e506c9c66f68
Author: Tom Clegg <tom at curii.com>
Date:   Mon Aug 23 10:00:50 2021 -0400

    17698: Rename newPutResult to match new putProgress type name.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 81f7fcd12..4459adfa1 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -837,7 +837,7 @@ func (pr *putProgress) Copy() *putProgress {
 	return &cp
 }
 
-func newPutResult(classes []string) putProgress {
+func newPutProgress(classes []string) putProgress {
 	pr := putProgress{
 		classNeeded: make(map[string]bool, len(classes)),
 		classTodo:   make(map[string]bool, len(classes)),
@@ -890,7 +890,7 @@ func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash s
 		return putProgress{}, RequestHashError
 	}
 
-	result := newPutResult(wantStorageClasses)
+	result := newPutProgress(wantStorageClasses)
 
 	// If we already have this data, it's intact on disk, and we
 	// can update its timestamp, return success. If we have

commit 3f08b10a2b466a498bc3a202cae1492ff3480510
Author: Tom Clegg <tom at curii.com>
Date:   Mon Aug 23 10:00:01 2021 -0400

    17698: Fix AllWritable panic when no volumes are writable.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/volume.go b/services/keepstore/volume.go
index 878f690c9..3f7c9cb79 100644
--- a/services/keepstore/volume.go
+++ b/services/keepstore/volume.go
@@ -401,6 +401,9 @@ func (vm *RRVolumeManager) AllWritable() []*VolumeMount {
 // each volume gets a turn to be first. Used by PutBlock to distribute
 // new data across available volumes.
 func (vm *RRVolumeManager) NextWritable() []*VolumeMount {
+	if len(vm.writables) == 0 {
+		return nil
+	}
 	offset := (int(atomic.AddUint32(&vm.counter, 1)) - 1) % len(vm.writables)
 	return append(append([]*VolumeMount(nil), vm.writables[offset:]...), vm.writables[:offset]...)
 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list