From 14568bb4cda60d42812f785923c4da8ba30031e3 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Wed, 20 May 2020 09:59:00 -0400 Subject: [PATCH] 16319: Count Utimes stats. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- services/keepstore/unix_volume.go | 2 ++ services/keepstore/unix_volume_test.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/keepstore/unix_volume.go b/services/keepstore/unix_volume.go index 7af058ae57..5026e2d325 100644 --- a/services/keepstore/unix_volume.go +++ b/services/keepstore/unix_volume.go @@ -304,6 +304,8 @@ func (v *UnixVolume) WriteBlock(ctx context.Context, loc string, rdr io.Reader) // avoid this by setting the output file's timestamps // explicitly, using a higher resolution clock. ts := time.Now() + v.os.stats.TickOps("utimes") + v.os.stats.Tick(&v.os.stats.UtimesOps) if err = os.Chtimes(tmpfile.Name(), ts, ts); err != nil { err = fmt.Errorf("error setting timestamps on %s: %s", tmpfile.Name(), err) v.os.Remove(tmpfile.Name()) diff --git a/services/keepstore/unix_volume_test.go b/services/keepstore/unix_volume_test.go index 7777363b9d..5a3a536944 100644 --- a/services/keepstore/unix_volume_test.go +++ b/services/keepstore/unix_volume_test.go @@ -405,13 +405,13 @@ func (s *UnixVolumeSuite) TestStats(c *check.C) { c.Check(stats(), check.Matches, `.*"OutBytes":3,.*`) c.Check(stats(), check.Matches, `.*"CreateOps":1,.*`) c.Check(stats(), check.Matches, `.*"OpenOps":0,.*`) - c.Check(stats(), check.Matches, `.*"UtimesOps":0,.*`) + c.Check(stats(), check.Matches, `.*"UtimesOps":1,.*`) err = vol.Touch(loc) c.Check(err, check.IsNil) c.Check(stats(), check.Matches, `.*"FlockOps":1,.*`) c.Check(stats(), check.Matches, `.*"OpenOps":1,.*`) - c.Check(stats(), check.Matches, `.*"UtimesOps":1,.*`) + c.Check(stats(), check.Matches, `.*"UtimesOps":2,.*`) _, err = vol.Get(context.Background(), loc, make([]byte, 3)) c.Check(err, check.IsNil) -- 2.39.5