Change minor things after code review.

This commit is contained in:
beorn7 2015-03-18 19:09:07 +01:00
parent 1a86dd3893
commit 1d8fc7d56f
4 changed files with 8 additions and 7 deletions

View file

@ -225,7 +225,9 @@ func (p *persistence) sanitizeSeries(
// Everything is consistent. We are good. // Everything is consistent. We are good.
return fp, true 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 { if s.headChunkClosed {
// This is the easy case as we don't have any chunks in // This is the easy case as we don't have any chunks in
// heads.db. Treat this series as a freshly unarchived // heads.db. Treat this series as a freshly unarchived

View file

@ -911,7 +911,7 @@ func (p *persistence) dropAndPersistChunks(
// Otherwise, seek backwards to the beginning of its header and start // Otherwise, seek backwards to the beginning of its header and start
// copying everything from there into a new file. Then append the chunks // copying everything from there into a new file. Then append the chunks
// to the new file. // to the new file.
_, err = f.Seek(-(chunkHeaderLen), os.SEEK_CUR) _, err = f.Seek(-chunkHeaderLen, os.SEEK_CUR)
if err != nil { if err != nil {
return return
} }

View file

@ -32,7 +32,6 @@ const (
chunkDescEvictionFactor = 10 chunkDescEvictionFactor = 10
headChunkTimeout = time.Hour // Close head chunk if not touched for that long. headChunkTimeout = time.Hour // Close head chunk if not touched for that long.
) )
// fingerprintSeriesPair pairs a fingerprint with a memorySeries pointer. // fingerprintSeriesPair pairs a fingerprint with a memorySeries pointer.
@ -168,7 +167,7 @@ type memorySeries struct {
// appended. // appended.
headChunkUsedByIterator bool headChunkUsedByIterator bool
// Whether the series is inconsistent with the last checkpoint in a way // 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 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 // 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. // 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. // The caller must have locked the fingerprint of the series.

View file

@ -803,8 +803,8 @@ func (s *memorySeriesStorage) maintainMemorySeries(
} }
// writeMemorySeries (re-)writes a memory series file. While doing so, it drops // 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 // chunks older than beforeTime from both the series file (if it exists) as well
// well as from memory. The provided chunksToPersist are appended to the newly // as from memory. The provided chunksToPersist are appended to the newly
// written series file. If no chunks need to be purged, but chunksToPersist is // 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 // 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 // contains no chunks after dropping old chunks, it is purged entirely. In that