Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[db] Add an option to use db writes in index mode #1596

Merged
merged 10 commits into from
May 2, 2019

Conversation

arnikola
Copy link
Collaborator

What this PR does / why we need it:
Adds an option to use a namespace in index mode; i.e. all writes to this namespace will get truncated to block size and have a set value, meaning we write at most one point per block per series, allowing this namespace to be used as a dedicated index more easily.

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE

@@ -1281,6 +1280,8 @@ func withEncodingAndPoolingOptions(
aggregateQueryResultsPool := index.NewAggregateResultsPool(
poolOptions(policy.IndexResultsPool, scope.SubScope("index-aggregate-results-pool")))

// Set index options.
opts = opts.SetTruncateType(cfg.Transforms.TruncateBy)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe move this above the // Set index options since this transforms values? i.e. maybe just comment with // Set value transformations?

ns, closer := newTestNamespace(t)
if index != nil {
ns.reverseIndex = index
}
return ns, closer
}

func newTestNamespaceWithUseAsIndex(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to newTestNamespaceWithTruncateType(..)?


const (
TypeNone TruncateType = iota
TypeBlock
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of just TypeBlock we could do TypeTimestampBlock so it is clear that it's truncating just the timestamp?

@@ -60,6 +60,10 @@ const (
// enabled to see if this is a sane number.
evictedTimesArraySize = 8
writableBucketVer = 0

// NB: this is the value all points will be truncated to.
truncatedValue float64 = 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't set it to a specific value and just let whatever the client is writing be the value it sets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair; pulling this into configs as discussed


// NB: this is the value all points will be truncated to.
truncatedValue float64 = 0
truncatedUnit = xtime.Second
Copy link
Collaborator

@robskillington robskillington May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also probably don't need to override the unit no? Client should always be sending the same unit unless it has a bug or is writing datapoints at different timestamps (that would not wish to be snapped to block boundary).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah fair, this was mostly to kinda standardize all values going into the index but don't suppose it matters very much here

@@ -1,4 +1,12 @@
db:
transforms:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops will revert this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (after removing the config from m3_stack config)

@robskillington
Copy link
Collaborator

Also looks like some big unit tests and docker integration tests are strangely failing?

@codecov
Copy link

codecov bot commented May 2, 2019

Codecov Report

Merging #1596 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1596   +/-   ##
======================================
  Coverage    70.2%   70.2%           
======================================
  Files         953     953           
  Lines       87398   87398           
======================================
  Hits        61377   61377           
  Misses      21895   21895           
  Partials     4126    4126
Flag Coverage Δ
#aggregator 82.3% <0%> (ø) ⬆️
#cluster 85.7% <0%> (ø) ⬆️
#collector 63.7% <0%> (ø) ⬆️
#dbnode 79.8% <0%> (ø) ⬆️
#m3em 10.5% <0%> (ø) ⬆️
#m3ninx 75.5% <0%> (ø) ⬆️
#m3nsch 50.9% <0%> (ø) ⬆️
#metrics 17.6% <0%> (ø) ⬆️
#msg 20.5% <0%> (ø) ⬆️
#query 66.9% <0%> (ø) ⬆️
#x 82.3% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e50a400...22d699d. Read the comment docs.

@arnikola arnikola merged commit def07b4 into master May 2, 2019
@arnikola arnikola deleted the arnikola/use-as-index branch May 2, 2019 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants