Skip to content

db: clear range key count during Batch Reset#1563

Merged
jbowens merged 1 commit intocockroachdb:masterfrom
jbowens:batch-reset-leak
Mar 7, 2022
Merged

db: clear range key count during Batch Reset#1563
jbowens merged 1 commit intocockroachdb:masterfrom
jbowens:batch-reset-leak

Conversation

@jbowens
Copy link
Copy Markdown
Contributor

@jbowens jbowens commented Mar 7, 2022

Previously, if a Batch was Reset its running count of range keys was not reset.

@jbowens jbowens requested review from a team and nicktrav March 7, 2022 15:53
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Previously, if a Batch was Reset its running count of range keys was not reset.
@jbowens jbowens force-pushed the batch-reset-leak branch from 1728325 to 64b084d Compare March 7, 2022 16:16
Copy link
Copy Markdown
Contributor Author

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @erikgrinaker and @nicktrav)


batch.go, line 947 at r1 (raw file):

	b.commit = sync.WaitGroup{}
	b.commitErr = nil
	atomic.StoreUint32(&b.applied, 0)

I wanted to refactor this to clear the entire struct, except for what's explicitly copied, eg *b = Batch{/* ... */} but the race detector flags the nonatomic write to b.applied. I'm not sure if anything can done about that.

Copy link
Copy Markdown
Contributor

@nicktrav nicktrav left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @erikgrinaker)

@erikgrinaker
Copy link
Copy Markdown
Contributor

Thanks! I see we're pooling batches, so this makes sense.

Copy link
Copy Markdown
Contributor Author

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

TFTRs!

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @erikgrinaker)

@jbowens jbowens merged commit e2b7bb8 into cockroachdb:master Mar 7, 2022
@jbowens jbowens deleted the batch-reset-leak branch September 13, 2022 20:04
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.

4 participants