Skip to content

Commit

Permalink
remove unused WALFlushInterval option and NopWAL struct (prometheus-j…
Browse files Browse the repository at this point in the history
…unkyard#468)

The WALFlushInterval is not used anywhere in the code base.
The WAL is not an interface anymore to save some lookup time so can't use NopWAL in the tests. Instead can just pass nil as the code checks for that and it is essentially a noop.

Signed-off-by: Krasi Georgiev <[email protected]>
  • Loading branch information
krasi-georgiev authored and Radoslaw Lesniewski committed Jan 18, 2019
1 parent 5597a45 commit 99acaf7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 27 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## master / unreleased
- [CHANGE] New `WALSegmentSize` option to override the `DefaultOptions.WALSegmentSize`. Added to allow using smaller wal files. For example using tmpfs on a RPI to minimise the SD card wear out from the constant WAL writes. As part of this change the `DefaultOptions.WALSegmentSize` constant was also exposed.
- [CLEANUP] `Options.WALFlushInterval` is removed as it wasn't used anywhere.

## 0.3.1
- [BUGFIX] Fixed most windows test and some actual bugs for unclosed file readers.
- [BUGFIX] Fixed most windows test and some actual bugs for unclosed file readers.

## 0.3.0
- [CHANGE] `LastCheckpoint()` used to return just the segment name and now it returns the full relative path.
Expand Down
1 change: 0 additions & 1 deletion cmd/tsdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func (b *writeBenchmark) run() {
l = log.With(l, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)

st, err := tsdb.Open(dir, l, nil, &tsdb.Options{
WALFlushInterval: 200 * time.Millisecond,
RetentionDuration: 15 * 24 * 60 * 60 * 1000, // 15 days in milliseconds
BlockRanges: tsdb.ExponentialBlockRanges(2*60*60*1000, 5, 3),
})
Expand Down
4 changes: 0 additions & 4 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import (
// DefaultOptions used for the DB. They are sane for setups using
// millisecond precision timestamps.
var DefaultOptions = &Options{
WALFlushInterval: 5 * time.Second,
WALSegmentSize: wal.DefaultSegmentSize,
RetentionDuration: 15 * 24 * 60 * 60 * 1000, // 15 days in milliseconds
BlockRanges: ExponentialBlockRanges(int64(2*time.Hour)/1e6, 3, 5),
Expand All @@ -53,9 +52,6 @@ var DefaultOptions = &Options{

// Options of the DB storage.
type Options struct {
// The interval at which the write ahead log is flushed to disk.
WALFlushInterval time.Duration

// Segments (wal files) max size
WALSegmentSize int

Expand Down
21 changes: 0 additions & 21 deletions wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,6 @@ type WAL interface {
Close() error
}

// NopWAL is a WAL that does nothing.
func NopWAL() WAL {
return nopWAL{}
}

type nopWAL struct{}

func (nopWAL) Read(
seriesf func([]RefSeries),
samplesf func([]RefSample),
deletesf func([]Stone),
) error {
return nil
}
func (w nopWAL) Reader() WALReader { return w }
func (nopWAL) LogSeries([]RefSeries) error { return nil }
func (nopWAL) LogSamples([]RefSample) error { return nil }
func (nopWAL) LogDeletes([]Stone) error { return nil }
func (nopWAL) Truncate(int64, func(uint64) bool) error { return nil }
func (nopWAL) Close() error { return nil }

// WALReader reads entries from a WAL.
type WALReader interface {
Read(
Expand Down

0 comments on commit 99acaf7

Please sign in to comment.