[ARVADOS] updated: 1.3.0-2750-gb272e9772

Git user git at public.arvados.org
Mon Jul 6 19:19:05 UTC 2020


Summary of changes:
 tools/keep-exercise/keep-exercise.go | 51 ++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 23 deletions(-)

       via  b272e9772244a684fe3356d92cdf8109392d1b09 (commit)
      from  f56c55a3ce637fefd0d63a4331e78f0777c074ed (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 b272e9772244a684fe3356d92cdf8109392d1b09
Author: Ward Vandewege <ward at curii.com>
Date:   Mon Jul 6 15:15:51 2020 -0400

    16585: avoid read thead starvation, re-read the last locator if a new
           one is not available yet. This doesn't help with the startup
           phase, when doReads has not seen any locators to read yet.
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>

diff --git a/tools/keep-exercise/keep-exercise.go b/tools/keep-exercise/keep-exercise.go
index 1567fcd6e..0dd94c5f3 100644
--- a/tools/keep-exercise/keep-exercise.go
+++ b/tools/keep-exercise/keep-exercise.go
@@ -278,35 +278,40 @@ func doWrites(wg *sync.WaitGroup, kc *keepclient.KeepClient, nextBuf <-chan []by
 func doReads(wg *sync.WaitGroup, kc *keepclient.KeepClient, nextLocator <-chan string, stopCh <-chan struct{}, stderr *log.Logger) {
 	defer wg.Done()
 
+	var locator string
 	for {
 		select {
 		case <-stopCh:
 			return
-		case locator := <-nextLocator:
-			rdr, size, url, err := kc.Get(locator)
-			if err != nil {
-				stderr.Print(err)
-				errorsChan <- struct{}{}
-				continue
-			}
-			n, err := io.Copy(ioutil.Discard, rdr)
-			rdr.Close()
-			if n != size || err != nil {
-				stderr.Printf("Got %d bytes (expected %d) from %s: %v", n, size, url, err)
-				errorsChan <- struct{}{}
-				continue
-				// Note we don't count the bytes received in
-				// partial/corrupt responses: we are measuring
-				// throughput, not resource consumption.
-			}
-			select {
-			case <-stopCh:
-				return
-			case bytesInChan <- uint64(n):
-			}
+		case locator = <-nextLocator:
 		default:
-			stderr.Printf("STARVED FOR BLOCKS TO READ - SLEEPING 100ms!")
+			// We don't have a new locator available, just re-use the previous one
+		}
+		if locator == "" {
+			// No locator yet (not enough doWrite loops completed), sleep for 100ms and try again
 			time.Sleep(100 * time.Millisecond)
+			continue
+		}
+		rdr, size, url, err := kc.Get(locator)
+		if err != nil {
+			stderr.Print(err)
+			errorsChan <- struct{}{}
+			continue
+		}
+		n, err := io.Copy(ioutil.Discard, rdr)
+		rdr.Close()
+		if n != size || err != nil {
+			stderr.Printf("Got %d bytes (expected %d) from %s: %v", n, size, url, err)
+			errorsChan <- struct{}{}
+			continue
+			// Note we don't count the bytes received in
+			// partial/corrupt responses: we are measuring
+			// throughput, not resource consumption.
+		}
+		select {
+		case <-stopCh:
+			return
+		case bytesInChan <- uint64(n):
 		}
 	}
 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list