This repository has been archived by the owner on Aug 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 179
move WAL tailing code from Prometheus to TSDB WAL package #606
Open
cstyan
wants to merge
16
commits into
prometheus-junkyard:master
Choose a base branch
from
cstyan:callum-move-wal-watcher
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ce08521
Move WAL Watcher from Prometheus to TSDB WAL package.
cstyan 643a5c9
Copy FromTime function from timestamp package so we don't have to vendor
cstyan b84a297
WAL Watcher needs to take in and pass a Registerer to LiveReader.
cstyan 6c4df84
Call Checkpoint in TestReadCheckpointMultipleSegments instead of
cstyan f453859
Move tombstones to it's own package.
cstyan adfe7f4
Fix some stuff I broke during rebase.
cstyan f2c8171
Keep memSeries in head.go
cstyan 1a4aba4
We can just duplicate ErrNotFound to the record package.
cstyan fd51852
These functions aren't used anywhere within the record package anymore
cstyan 323b5c4
Change type names to remove record.Record... stutter.
cstyan fe01392
Rename WALWatcher -> Watcher; fix creation/registration of it's metrics.
cstyan 7e36b01
Review fixes; mostly some things that don't need to be exported after
cstyan c392f57
These comments don't need to change.
cstyan 5264c56
Update WAL watcher from Prometheus repo, pass metrics structs around for
cstyan 8c40bb9
Don't export MemTombstones.
cstyan 3b20c64
Export WatcherMetrics struct and pass the struct to NewWatcher rather
cstyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,6 +35,7 @@ import ( | |||||
"github.com/prometheus/tsdb/fileutil" | ||||||
"github.com/prometheus/tsdb/index" | ||||||
"github.com/prometheus/tsdb/labels" | ||||||
"github.com/prometheus/tsdb/tombstones" | ||||||
) | ||||||
|
||||||
// ExponentialBlockRanges returns the time ranges based on the stepSize. | ||||||
|
@@ -607,7 +608,7 @@ func (c *LeveledCompactor) write(dest string, meta *BlockMeta, blocks ...BlockRe | |||||
} | ||||||
|
||||||
// Create an empty tombstones file. | ||||||
if _, err := writeTombstoneFile(c.logger, tmp, newMemTombstones()); err != nil { | ||||||
if _, err := tombstones.WriteTombstoneFile(c.logger, tmp, tombstones.NewMemTombstones()); err != nil { | ||||||
return errors.Wrap(err, "write new tombstones file") | ||||||
} | ||||||
|
||||||
|
@@ -768,7 +769,7 @@ func (c *LeveledCompactor) populateBlock(blocks []BlockReader, meta *BlockMeta, | |||||
// | ||||||
// TODO think how to avoid the typecasting to verify when it is head block. | ||||||
if _, isHeadChunk := chk.Chunk.(*safeChunk); isHeadChunk && chk.MaxTime >= meta.MaxTime { | ||||||
dranges = append(dranges, Interval{Mint: meta.MaxTime, Maxt: math.MaxInt64}) | ||||||
dranges = append(dranges, tombstones.Interval{Mint: meta.MaxTime, Maxt: math.MaxInt64}) | ||||||
|
||||||
} else | ||||||
// Sanity check for disk blocks. | ||||||
|
@@ -876,15 +877,15 @@ type compactionSeriesSet struct { | |||||
p index.Postings | ||||||
index IndexReader | ||||||
chunks ChunkReader | ||||||
tombstones TombstoneReader | ||||||
tombstones tombstones.TombstoneReader | ||||||
|
||||||
l labels.Labels | ||||||
c []chunks.Meta | ||||||
intervals Intervals | ||||||
intervals tombstones.Intervals | ||||||
err error | ||||||
} | ||||||
|
||||||
func newCompactionSeriesSet(i IndexReader, c ChunkReader, t TombstoneReader, p index.Postings) *compactionSeriesSet { | ||||||
func newCompactionSeriesSet(i IndexReader, c ChunkReader, t tombstones.TombstoneReader, p index.Postings) *compactionSeriesSet { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Suggested change
|
||||||
return &compactionSeriesSet{ | ||||||
index: i, | ||||||
chunks: c, | ||||||
|
@@ -914,7 +915,7 @@ func (c *compactionSeriesSet) Next() bool { | |||||
if len(c.intervals) > 0 { | ||||||
chks := make([]chunks.Meta, 0, len(c.c)) | ||||||
for _, chk := range c.c { | ||||||
if !(Interval{chk.MinTime, chk.MaxTime}.isSubrange(c.intervals)) { | ||||||
if !(tombstones.Interval{chk.MinTime, chk.MaxTime}.IsSubrange(c.intervals)) { | ||||||
chks = append(chks, chk) | ||||||
} | ||||||
} | ||||||
|
@@ -942,7 +943,7 @@ func (c *compactionSeriesSet) Err() error { | |||||
return c.p.Err() | ||||||
} | ||||||
|
||||||
func (c *compactionSeriesSet) At() (labels.Labels, []chunks.Meta, Intervals) { | ||||||
func (c *compactionSeriesSet) At() (labels.Labels, []chunks.Meta, tombstones.Intervals) { | ||||||
return c.l, c.c, c.intervals | ||||||
} | ||||||
|
||||||
|
@@ -952,7 +953,7 @@ type compactionMerger struct { | |||||
aok, bok bool | ||||||
l labels.Labels | ||||||
c []chunks.Meta | ||||||
intervals Intervals | ||||||
intervals tombstones.Intervals | ||||||
} | ||||||
|
||||||
func newCompactionMerger(a, b ChunkSeriesSet) (*compactionMerger, error) { | ||||||
|
@@ -1008,7 +1009,7 @@ func (c *compactionMerger) Next() bool { | |||||
_, cb, rb := c.b.At() | ||||||
|
||||||
for _, r := range rb { | ||||||
ra = ra.add(r) | ||||||
ra = ra.Add(r) | ||||||
} | ||||||
|
||||||
c.l = append(c.l[:0], l...) | ||||||
|
@@ -1029,6 +1030,6 @@ func (c *compactionMerger) Err() error { | |||||
return c.b.Err() | ||||||
} | ||||||
|
||||||
func (c *compactionMerger) At() (labels.Labels, []chunks.Meta, Intervals) { | ||||||
func (c *compactionMerger) At() (labels.Labels, []chunks.Meta, tombstones.Intervals) { | ||||||
return c.l, c.c, c.intervals | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure
tombstones.WriteTombstoneFile
needs to beWriteTombstoneFile
etc? Why not justtombstones.WriteFile
if we have clear package name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for
NewMemTombstones