[arvados] updated: 2.4.2-25-g12a14f217

git repository hosting git at public.arvados.org
Mon Sep 19 17:52:22 UTC 2022


Summary of changes:
 services/keep-balance/block_state.go      |  6 +++++-
 services/keep-balance/block_state_test.go | 23 +++++++++++++++++++++++
 services/keep-balance/collection.go       |  2 +-
 3 files changed, 29 insertions(+), 2 deletions(-)

       via  12a14f217939ecb4d0ee6485a036f67fb299c36b (commit)
      from  a7911f5bc0ea6e501b06adce04705572d8d87e25 (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 12a14f217939ecb4d0ee6485a036f67fb299c36b
Author: Tom Clegg <tom at curii.com>
Date:   Tue Aug 23 13:25:53 2022 -0400

    Merge branch '19414-keep-balance-panic'
    
    fixes #19414
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keep-balance/block_state.go b/services/keep-balance/block_state.go
index e30b4ff79..79eff50c2 100644
--- a/services/keep-balance/block_state.go
+++ b/services/keep-balance/block_state.go
@@ -151,7 +151,11 @@ func (bsm *BlockStateMap) GetConfirmedReplication(blkids []arvados.SizedDigest,
 		for _, c := range classes {
 			perclass[c] = 0
 		}
-		for _, r := range bsm.get(blkid).Replicas {
+		bs, ok := bsm.entries[blkid]
+		if !ok {
+			return 0
+		}
+		for _, r := range bs.Replicas {
 			total += r.KeepMount.Replication
 			mntclasses := r.KeepMount.StorageClasses
 			if len(mntclasses) == 0 {
diff --git a/services/keep-balance/block_state_test.go b/services/keep-balance/block_state_test.go
index aaf2c18e2..231f0caee 100644
--- a/services/keep-balance/block_state_test.go
+++ b/services/keep-balance/block_state_test.go
@@ -5,6 +5,7 @@
 package main
 
 import (
+	"sync"
 	"time"
 
 	"git.arvados.org/arvados.git/sdk/go/arvados"
@@ -92,3 +93,25 @@ func (s *confirmedReplicationSuite) TestBlocksOnMultipleMounts(c *check.C) {
 	n = s.blockStateMap.GetConfirmedReplication([]arvados.SizedDigest{knownBlkid(40), knownBlkid(41)}, nil)
 	c.Check(n, check.Equals, 4)
 }
+
+func (s *confirmedReplicationSuite) TestConcurrency(c *check.C) {
+	var wg sync.WaitGroup
+	for i := 1000; i < 1256; i++ {
+		i := i
+		wg.Add(1)
+		go func() {
+			defer wg.Done()
+			n := s.blockStateMap.GetConfirmedReplication([]arvados.SizedDigest{knownBlkid(i), knownBlkid(i)}, []string{"default"})
+			c.Check(n, check.Equals, 0)
+		}()
+		wg.Add(1)
+		go func() {
+			defer wg.Done()
+			n := s.blockStateMap.GetConfirmedReplication([]arvados.SizedDigest{knownBlkid(10)}, []string{"default"})
+			c.Check(n, check.Equals, 1)
+			n = s.blockStateMap.GetConfirmedReplication([]arvados.SizedDigest{knownBlkid(20)}, []string{"default"})
+			c.Check(n, check.Equals, 2)
+		}()
+	}
+	wg.Wait()
+}
diff --git a/services/keep-balance/collection.go b/services/keep-balance/collection.go
index 1e1e51abe..6755f90ae 100644
--- a/services/keep-balance/collection.go
+++ b/services/keep-balance/collection.go
@@ -152,7 +152,7 @@ func (bal *Balancer) updateCollections(ctx context.Context, c *arvados.Client, c
 	// Use about 1 goroutine per 2 CPUs. Based on experiments with
 	// a 2-core host, using more concurrent database
 	// calls/transactions makes this process slower, not faster.
-	for i := 0; i < runtime.NumCPU()+1/2; i++ {
+	for i := 0; i < (runtime.NumCPU()+1)/2; i++ {
 		wg.Add(1)
 		goSendErr(errs, func() error {
 			defer wg.Done()

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list