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

kvserver: avoid nil deref on replica_stats merge #80071

Merged
merged 1 commit into from
Apr 16, 2022

Conversation

kvoli
Copy link
Collaborator

@kvoli kvoli commented Apr 16, 2022

A bug existed where when replica stats were merged with only partially
initialized windows, merging would result in a nil ptr dereference. This
patch updates the logic of replicaStatsMerge to avoid nil dereferences
and appropriately handle uninitialized window records.

resolves: #80072

Release note: None

@kvoli kvoli requested review from yuzefovich and lidorcarmel April 16, 2022 19:10
@kvoli kvoli requested a review from a team as a code owner April 16, 2022 19:10
@kvoli kvoli self-assigned this Apr 16, 2022
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@kvoli kvoli force-pushed the 220416.stats-merge-deref branch 2 times, most recently from f5df859 to 32c6124 Compare April 16, 2022 19:30
Copy link
Member

@yuzefovich yuzefovich 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: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @irfansharif, @kvoli, and @lidorcarmel)


-- commits, line 4 at r1:
nit: s/paritally/partially/.


pkg/kv/kvserver/replica_stats_test.go, line 528 at r1 (raw file):

		// Ensure that with uninitialzed entries in replica stats, the result
		// adjusts correctly. Here we expect the sliding windows to be
		// merged from most the recent window (tail) backwards.

nit: "most the recent" reads unusual.

A bug existed where when replica stats were merged with only partially
initialized windows, merging would result in a nil ptr dereference. This
patch updates the logic of replicaStatsMerge to avoid nil dereferences
and appropriately handle uninitialized window records.

resolves: cockroachdb#80072

Release note: None
@kvoli kvoli force-pushed the 220416.stats-merge-deref branch from 32c6124 to 79429fc Compare April 16, 2022 20:17
Copy link
Collaborator Author

@kvoli kvoli 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: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @irfansharif, @lidorcarmel, and @yuzefovich)


-- commits, line 4 at r1:

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: s/paritally/partially/.

Updated


pkg/kv/kvserver/replica_stats_test.go, line 528 at r1 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: "most the recent" reads unusual.

Reworded.

@kvoli kvoli requested review from irfansharif and lidorcarmel and removed request for lidorcarmel and irfansharif April 16, 2022 20:30
@kvoli
Copy link
Collaborator Author

kvoli commented Apr 16, 2022

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 16, 2022

Build succeeded:

@craig craig bot merged commit f2fdd07 into cockroachdb:master Apr 16, 2022
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.

kvserver: nil dereference on replica stats merge with uninitalized windows
3 participants