[arvados] updated: 2.7.0-6013-gfb5609be2b

git repository hosting git at public.arvados.org
Tue Feb 27 19:38:35 UTC 2024


Summary of changes:
 sdk/go/arvados/fs_collection.go | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

       via  fb5609be2ba7c3fde4d4270dfc3df6f00d1cb459 (commit)
      from  222b45df0a30dad5189599d7942271c63f46f72d (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 fb5609be2ba7c3fde4d4270dfc3df6f00d1cb459
Author: Tom Clegg <tom at curii.com>
Date:   Tue Feb 27 14:07:09 2024 -0500

    18961: Limit prefetch to 2 segments after current file.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/sdk/go/arvados/fs_collection.go b/sdk/go/arvados/fs_collection.go
index 875a942210..4e2e2ac084 100644
--- a/sdk/go/arvados/fs_collection.go
+++ b/sdk/go/arvados/fs_collection.go
@@ -26,6 +26,10 @@ var (
 	concurrentWriters = 4 // max goroutines writing to Keep in background and during flush()
 )
 
+const (
+	prefetchAfterCurrentFile = 2 // max segments of next file(s) to prefetch
+)
+
 // A CollectionFileSystem is a FileSystem that can be serialized as a
 // manifest and stored as a collection.
 type CollectionFileSystem interface {
@@ -1313,6 +1317,11 @@ func (dn *dirnode) prefetch(fn *filenode, name string, ptr filenodePtr) {
 		}
 		return
 	}
+
+	if prefetchAfterCurrentFile == 0 {
+		return
+	}
+
 	if dn.prefetchNames == nil {
 		dn.prefetchNames = make([]string, 0, len(dn.inodes))
 		for name, node := range dn.inodes {
@@ -1326,14 +1335,16 @@ func (dn *dirnode) prefetch(fn *filenode, name string, ptr filenodePtr) {
 	iname := sort.Search(len(dn.prefetchNames), func(x int) bool {
 		return dn.prefetchNames[x] > name
 	})
-	for ; iname < len(dn.prefetchNames) && todo > 0; iname++ {
+	todosegments := prefetchAfterCurrentFile
+	for ; iname < len(dn.prefetchNames) && todo > 0 && todosegments > 0; iname++ {
 		profAdd1(&prefetchWalkNext)
 		fn, ok := dn.inodes[dn.prefetchNames[iname]].(*filenode)
 		if !ok {
 			continue
 		}
 		fn.Lock()
-		for inext := 0; inext < len(fn.segments) && todo > 0; inext++ {
+		for inext := 0; inext < len(fn.segments) && todo > 0 && todosegments > 0; inext++ {
+			todosegments--
 			next, ok := fn.segments[inext].(storedSegment)
 			if !ok {
 				// count in-memory data as already

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list