21214: Include project/collection singletons in customfs MemorySize.
authorTom Clegg <tom@curii.com>
Mon, 18 Dec 2023 20:03:04 +0000 (15:03 -0500)
committerTom Clegg <tom@curii.com>
Mon, 18 Dec 2023 20:03:04 +0000 (15:03 -0500)
Previously, a hardlink returned its target's MemorySize, which
overreported the size of a tree in which a collection or project was
reachable by multiple paths.

Since 3d5a798ef6f4bd3b1a771bacdf0acf70edf6c1f5 a hardlink returns a
MemorySize reflecting only the hardlink itself, so the MemorySize of
the hardlink targets (project/collection singletons) needs to be added
explicitly by customFilesystem.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

sdk/go/arvados/fs_site.go
services/keep-web/server_test.go

index 1e7d51b9ad078adc88644e86a9401eff51c77782..d4f02416822a8b52494f62672a95bd00c1c04519 100644 (file)
@@ -123,6 +123,10 @@ func (fs *customFileSystem) ForwardSlashNameSubstitution(repl string) {
        fs.forwardSlashNameSubstitution = repl
 }
 
+func (fs *customFileSystem) MemorySize() int64 {
+       return fs.fileSystem.MemorySize() + fs.byIDRoot.MemorySize()
+}
+
 // SiteFileSystem returns a FileSystem that maps collections and other
 // Arvados objects onto a filesystem layout.
 //
index b3d0b9b418533110ce550da62946c1651af2245b..dd29c40082cb7910da661801c610ba3c753a4271 100644 (file)
@@ -476,7 +476,7 @@ func (s *IntegrationSuite) TestMetrics(c *check.C) {
        c.Check(summaries["request_duration_seconds/get/200"].SampleCount, check.Equals, "3")
        c.Check(summaries["request_duration_seconds/get/404"].SampleCount, check.Equals, "1")
        c.Check(summaries["time_to_status_seconds/get/404"].SampleCount, check.Equals, "1")
-       c.Check(gauges["arvados_keepweb_sessions_cached_session_bytes//"].Value, check.Equals, float64(469))
+       c.Check(gauges["arvados_keepweb_sessions_cached_session_bytes//"].Value, check.Equals, float64(624))
 
        // If the Host header indicates a collection, /metrics.json
        // refers to a file in the collection -- the metrics handler