[arvados] updated: 2.7.0-5095-gc9b029a3b2

git repository hosting git at public.arvados.org
Fri Oct 27 18:09:28 UTC 2023


Summary of changes:
 services/keep-balance/balance_test.go | 55 ++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 8 deletions(-)

       via  c9b029a3b2efaf6babe458cfaa70b08a3debd4cc (commit)
      from  da83807d6bcef1c1f0bb78479c5ec17f150f5eda (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 c9b029a3b2efaf6babe458cfaa70b08a3debd4cc
Author: Tom Clegg <tom at curii.com>
Date:   Fri Oct 27 14:08:34 2023 -0400

    21126: Test keep-balance behavior with AllowTrashWhenReadOnly.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keep-balance/balance_test.go b/services/keep-balance/balance_test.go
index cb61ea58cc..e5bdf9c023 100644
--- a/services/keep-balance/balance_test.go
+++ b/services/keep-balance/balance_test.go
@@ -155,15 +155,53 @@ func (bal *balancerSuite) TestSkipReadonly(c *check.C) {
 		}})
 }
 
+func (bal *balancerSuite) TestAllowTrashWhenReadOnly(c *check.C) {
+	srvs := bal.srvList(0, slots{3})
+	srvs[0].mounts[0].KeepMount.AllowWrite = false
+	srvs[0].mounts[0].KeepMount.AllowTrash = true
+	// can't pull to slot 3, so pull to slot 4 instead
+	bal.try(c, tester{
+		desired:    map[string]int{"default": 4},
+		current:    slots{0, 1},
+		shouldPull: slots{2, 4},
+		expectBlockState: &balancedBlockState{
+			needed:  2,
+			pulling: 2,
+		}})
+	// expect to be able to trash slot 3 in future, so pull to
+	// slot 1
+	bal.try(c, tester{
+		desired:    map[string]int{"default": 2},
+		current:    slots{0, 3},
+		shouldPull: slots{1},
+		expectBlockState: &balancedBlockState{
+			needed:  2,
+			pulling: 1,
+		}})
+	// trash excess from slot 3
+	bal.try(c, tester{
+		desired:     map[string]int{"default": 2},
+		current:     slots{0, 1, 3},
+		shouldTrash: slots{3},
+		expectBlockState: &balancedBlockState{
+			needed:   2,
+			unneeded: 1,
+		}})
+}
+
 func (bal *balancerSuite) TestMultipleViewsReadOnly(c *check.C) {
-	bal.testMultipleViews(c, true)
+	bal.testMultipleViews(c, false, false)
+}
+
+func (bal *balancerSuite) TestMultipleViewsReadOnlyAllowTrash(c *check.C) {
+	bal.testMultipleViews(c, false, true)
 }
 
 func (bal *balancerSuite) TestMultipleViews(c *check.C) {
-	bal.testMultipleViews(c, false)
+	bal.testMultipleViews(c, true, true)
 }
 
-func (bal *balancerSuite) testMultipleViews(c *check.C, readonly bool) {
+func (bal *balancerSuite) testMultipleViews(c *check.C, allowWrite, allowTrash bool) {
 	for i, srv := range bal.srvs {
 		// Add a mount to each service
 		srv.mounts[0].KeepMount.DeviceID = fmt.Sprintf("writable-by-srv-%x", i)
@@ -171,8 +209,8 @@ func (bal *balancerSuite) testMultipleViews(c *check.C, readonly bool) {
 			KeepMount: arvados.KeepMount{
 				DeviceID:       bal.srvs[(i+1)%len(bal.srvs)].mounts[0].KeepMount.DeviceID,
 				UUID:           bal.srvs[(i+1)%len(bal.srvs)].mounts[0].KeepMount.UUID,
-				AllowWrite:     !readonly,
-				AllowTrash:     !readonly,
+				AllowWrite:     allowWrite,
+				AllowTrash:     allowTrash,
 				Replication:    1,
 				StorageClasses: map[string]bool{"default": true},
 			},
@@ -191,11 +229,12 @@ func (bal *balancerSuite) testMultipleViews(c *check.C, readonly bool) {
 				desired:     map[string]int{"default": 1},
 				current:     slots{0, i, i},
 				shouldTrash: slots{i}})
-		} else if readonly {
+		} else if !allowTrash {
 			// Timestamps are all different, and the third
 			// replica can't be trashed because it's on a
-			// read-only mount, so the first two replicas
-			// should be trashed.
+			// read-only mount (with
+			// AllowTrashWhenReadOnly=false), so the first
+			// two replicas should be trashed.
 			bal.try(c, tester{
 				desired:     map[string]int{"default": 1},
 				current:     slots{0, i, i},

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list