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] Use active index block which GCs expired series instead of explicit block rotations #3464

Merged
merged 74 commits into from
Aug 26, 2021

Conversation

robskillington
Copy link
Collaborator

What this PR does / why we need it:

Makes the index keep an active index block which GCs expired series instead of requiring building a fresh index at block rotation time.

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

src/dbnode/storage/index/types.go Outdated Show resolved Hide resolved
b.segments[i] = emptySegment
b.segments[i].negativeOffsets = negativeOffsets[:0]
}
b.segments = b.segments[:0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to reset filter and filterCount in this method as well?

@@ -50,6 +52,9 @@ var (
errForegroundCompactorNoPlan = errors.New("index foreground compactor failed to generate a plan")
errForegroundCompactorBadPlanFirstTask = errors.New("index foreground compactor generated plan without mutable segment in first task")
errForegroundCompactorBadPlanSecondaryTask = errors.New("index foreground compactor generated plan with mutable segment a secondary task")

numBackgroundCompactorsStandard = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: move to const?

src/m3ninx/doc/document.go Outdated Show resolved Hide resolved
for _, taskSegment := range task.Segments {
if taskSegment.Segment == seg.Segment() {
alreadyHasTask = true
break
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want a goto here or some other mechanism to escape the middle for-loop? Seems like you'll do some unnecessary iterations if not.


func newEntryIndexState() entryIndexState {
return entryIndexState{
states: make(map[xtime.UnixNano]entryIndexBlockState, 4),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why 4?

MinSizeInclusive: 0,
MaxSizeExclusive: 1 << 18,
},
Level{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we not need these levels any longer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In practice I found while testing the new active block semantics that the more extra levels of compactions caused more churn and really huge segments needing multiple GC passes. Whereas with just a fixed ceiling it got a lot better in terms of how difficult the speed of re-processing segments got, since things wouldn't get re-combined any longer at higher levels of compaction.

@@ -541,6 +554,10 @@ func (i *nsIndex) reportStats() error {
return err
}
}
// Active block should always be open.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth checking activeBlock.IsOpen here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't close it until it's explicitly closed in Close().

Maybe the comment should read "Active block is always open until index closed, at which point report stats is not run, therefore no check required".

@nbroyles
Copy link
Collaborator

nbroyles commented May 5, 2021

Would also be nice we could get some tests around the new functionality

@codecov
Copy link

codecov bot commented Jul 7, 2021

Codecov Report

Merging #3464 (7cbbec9) into master (bebd560) will increase coverage by 0.0%.
The diff coverage is 78.1%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #3464    +/-   ##
=======================================
  Coverage    56.7%   56.8%            
=======================================
  Files         552     552            
  Lines       61915   62319   +404     
=======================================
+ Hits        35145   35432   +287     
- Misses      23625   23724    +99     
- Partials     3145    3163    +18     
Flag Coverage Δ
aggregator 61.4% <ø> (ø)
cluster ∅ <ø> (∅)
collector 58.4% <ø> (ø)
dbnode 60.8% <78.1%> (+0.1%) ⬆️
m3em 46.4% <ø> (ø)
metrics 19.7% <ø> (ø)
msg 74.3% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.


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 bebd560...7cbbec9. Read the comment docs.

@rallen090 rallen090 merged commit 5d60010 into master Aug 26, 2021
@rallen090 rallen090 deleted the r/index-active-block branch August 26, 2021 23:38
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.

3 participants