From 1d8fc7d56f0d947efda5cf20c98dd1f535aa0ac8 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 18 Mar 2015 19:09:07 +0100 Subject: [PATCH] Change minor things after code review. --- storage/local/crashrecovery.go | 4 +++- storage/local/persistence.go | 2 +- storage/local/series.go | 5 ++--- storage/local/storage.go | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/storage/local/crashrecovery.go b/storage/local/crashrecovery.go index 247d839da..f988bcb6c 100644 --- a/storage/local/crashrecovery.go +++ b/storage/local/crashrecovery.go @@ -225,7 +225,9 @@ func (p *persistence) sanitizeSeries( // Everything is consistent. We are good. return fp, true } - // If we are here, something's fishy. + // If we are here, we cannot be sure the series file is + // consistent with the checkpoint, so we have to take a closer + // look. if s.headChunkClosed { // This is the easy case as we don't have any chunks in // heads.db. Treat this series as a freshly unarchived diff --git a/storage/local/persistence.go b/storage/local/persistence.go index a3859e1bc..45bb63777 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -911,7 +911,7 @@ func (p *persistence) dropAndPersistChunks( // Otherwise, seek backwards to the beginning of its header and start // copying everything from there into a new file. Then append the chunks // to the new file. - _, err = f.Seek(-(chunkHeaderLen), os.SEEK_CUR) + _, err = f.Seek(-chunkHeaderLen, os.SEEK_CUR) if err != nil { return } diff --git a/storage/local/series.go b/storage/local/series.go index 3381d9132..3b67e424b 100644 --- a/storage/local/series.go +++ b/storage/local/series.go @@ -32,7 +32,6 @@ const ( chunkDescEvictionFactor = 10 headChunkTimeout = time.Hour // Close head chunk if not touched for that long. - ) // fingerprintSeriesPair pairs a fingerprint with a memorySeries pointer. @@ -168,7 +167,7 @@ type memorySeries struct { // appended. headChunkUsedByIterator bool // Whether the series is inconsistent with the last checkpoint in a way - // that would require a desk seek during crash recovery. + // that would require a disk seek during crash recovery. dirty bool } @@ -233,7 +232,7 @@ func (s *memorySeries) add(v *metric.SamplePair) int { } // maybeCloseHeadChunk closes the head chunk if it has not been touched for the -// duration of headChunkTimeout. It returns wether the head chunk was closed. +// duration of headChunkTimeout. It returns whether the head chunk was closed. // If the head chunk is already closed, the method is a no-op and returns false. // // The caller must have locked the fingerprint of the series. diff --git a/storage/local/storage.go b/storage/local/storage.go index db14aa840..b60685bfd 100644 --- a/storage/local/storage.go +++ b/storage/local/storage.go @@ -803,8 +803,8 @@ func (s *memorySeriesStorage) maintainMemorySeries( } // writeMemorySeries (re-)writes a memory series file. While doing so, it drops -// chunks older than beforeTime from both, the series file (if it exists) as -// well as from memory. The provided chunksToPersist are appended to the newly +// chunks older than beforeTime from both the series file (if it exists) as well +// as from memory. The provided chunksToPersist are appended to the newly // written series file. If no chunks need to be purged, but chunksToPersist is // not empty, those chunks are simply appended to the series file. If the series // contains no chunks after dropping old chunks, it is purged entirely. In that