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

[dbnode] Remove implicit cloning of time ranges to reduce Allocs #2178

Merged
merged 9 commits into from
Mar 16, 2020

Conversation

notbdu
Copy link
Contributor

@notbdu notbdu commented Feb 26, 2020

What this PR does / why we need it:

Fixes #2170 . Removes implicit cloning of time ranges. Adds explicit cloning to the API.

Special notes for your reviewer:

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

@codecov
Copy link

codecov bot commented Feb 27, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@fb46ae7). Click here to learn what that means.
The diff coverage is 85%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #2178   +/-   ##
========================================
  Coverage          ?   72.2%           
========================================
  Files             ?    1019           
  Lines             ?   88456           
  Branches          ?       0           
========================================
  Hits              ?   63907           
  Misses            ?   20255           
  Partials          ?    4294
Flag Coverage Δ
#aggregator 82% <ø> (?)
#cluster 85.3% <ø> (?)
#collector 82.8% <ø> (?)
#dbnode 79% <82.1%> (?)
#m3em 74.4% <ø> (?)
#m3ninx 74.7% <ø> (?)
#m3nsch 51.1% <ø> (?)
#metrics 17.6% <ø> (?)
#msg 74.8% <ø> (?)
#query 68.1% <ø> (?)
#x 83.1% <100%> (?)

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 fb46ae7...2a8b608. Read the comment docs.

type ShardTimeRanges map[uint32]xtime.Ranges
type ShardTimeRanges interface {
// Get time ranges for a shard.
Get(shard uint32) xtime.Ranges
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this Get(shard uint32) (xtime.Ranges, bool)?

The amount of times we should have tested whether Get returns nil or not but forgot and then it panics (because someone didn't check whether it was nil before calling on it) is just too high to avoid making this change IMO.

@robskillington robskillington changed the title Remove implicit cloning of time ranges to reduce Allocs [dbnode] Remove implicit cloning of time ranges to reduce Allocs Mar 16, 2020
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

@notbdu notbdu merged commit cbb8109 into master Mar 16, 2020
@notbdu notbdu deleted the bdu/tr-clone branch March 16, 2020 18:43
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.

time.Ranges.AddRange uses 15% of alloc spaces.
2 participants