[ARVADOS] updated: 2.1.0-1109-gde030f2c3

Git user git at public.arvados.org
Tue Aug 3 20:43:55 UTC 2021


Summary of changes:
 services/keep-balance/collection.go       | 13 +++++++++----
 services/keep-balance/integration_test.go |  4 ++--
 2 files changed, 11 insertions(+), 6 deletions(-)

       via  de030f2c3f7a0c57904def9662d4d7a979b90497 (commit)
      from  e75d90299dc2ff0dbccf28c134ee2640f79b2b5d (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 de030f2c3f7a0c57904def9662d4d7a979b90497
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Tue Aug 3 16:42:04 2021 -0400

    17574: Confirm storage classes as [] when replication is 0.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keep-balance/collection.go b/services/keep-balance/collection.go
index 1da3ec441..1e1e51abe 100644
--- a/services/keep-balance/collection.go
+++ b/services/keep-balance/collection.go
@@ -199,10 +199,13 @@ func (bal *Balancer) updateCollections(ctx context.Context, c *arvados.Client, c
 					// temporarily.
 					repl = desired
 				}
-				classes, err := json.Marshal(coll.StorageClassesDesired)
-				if err != nil {
-					bal.logf("BUG? json.Marshal(%v) failed: %s", classes, err)
-					continue
+				classes := emptyJSONArray
+				if repl > 0 {
+					classes, err = json.Marshal(coll.StorageClassesDesired)
+					if err != nil {
+						bal.logf("BUG? json.Marshal(%v) failed: %s", classes, err)
+						continue
+					}
 				}
 				needUpdate := coll.ReplicationConfirmed == nil || *coll.ReplicationConfirmed != repl || len(coll.StorageClassesConfirmed) != len(coll.StorageClassesDesired)
 				for i := range coll.StorageClassesDesired {
@@ -259,3 +262,5 @@ func goSendErr(errs chan<- error, f func() error) {
 		}
 	}()
 }
+
+var emptyJSONArray = []byte("[]")
diff --git a/services/keep-balance/integration_test.go b/services/keep-balance/integration_test.go
index 3ddcb159d..52e614915 100644
--- a/services/keep-balance/integration_test.go
+++ b/services/keep-balance/integration_test.go
@@ -118,10 +118,10 @@ func (s *integrationSuite) TestBalanceAPIFixtures(c *check.C) {
 		repl    int
 		classes []string
 	}{
-		{arvadostest.EmptyCollectionUUID, 0, []string{"default"}},
+		{arvadostest.EmptyCollectionUUID, 0, []string{}},
 		{arvadostest.FooCollection, 2, []string{"default"}},                                // "foo" blk
 		{arvadostest.StorageClassesDesiredDefaultConfirmedDefault, 2, []string{"default"}}, // "bar" blk
-		{arvadostest.StorageClassesDesiredArchiveConfirmedDefault, 0, []string{"archive"}}, // "bar" blk
+		{arvadostest.StorageClassesDesiredArchiveConfirmedDefault, 0, []string{}},          // "bar" blk
 	} {
 		c.Logf("%#v", trial)
 		var coll arvados.Collection

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list