[arvados] created: 2.3.2-2-gc3268207e

git repository hosting git at public.arvados.org
Thu Aug 25 13:54:57 UTC 2022


        at  c3268207eeb57686c29a0f846bba1a7e6f135622 (commit)


commit c3268207eeb57686c29a0f846bba1a7e6f135622
Author: Tom Clegg <tom at curii.com>
Date:   Tue Aug 23 13:24:32 2022 -0400

    19414: Fix missing parens.
    
    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 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()

commit aa2883fbf8d6d9fdec74f72666ac25fe657e68b1
Author: Tom Clegg <tom at curii.com>
Date:   Tue Aug 23 11:02:04 2022 -0400

    19414: Fix concurrent map read/write.
    
    Occurred when a block was referenced by a collection but not returned
    by any keepstore index, and NumCPU > 2.
    
    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()
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list