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

sql: include sampled stats in TestSampledStatsCollection #60424

Merged
merged 1 commit into from
Feb 18, 2021
Merged

sql: include sampled stats in TestSampledStatsCollection #60424

merged 1 commit into from
Feb 18, 2021

Conversation

asubiotto
Copy link
Contributor

Depends on #59992, which is required for this new regression test to pass.

TestSampledStatsCollection would previously only check that stats that are
collected regardless of the sample rate are returned. These types of stats
(rows/bytes read) are propagated using metadata, rather than the trace.

This resulted in us silently failing to collect any stats when sampling was
enabled once the tracing mode was reverted back to legacy. To avoid this kind
of thing happening again, this commit adds a check that max memory usage is
reported to be non-zero.

Release note: None (this is a new feature that has no user impact yet)

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@asubiotto asubiotto requested a review from a team February 10, 2021 14:47
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.

The last commit :lgtm:

Reviewed 2 of 2 files at r5.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto)


pkg/sql/instrumentation_test.go, line 83 at r5 (raw file):

		require.Equal(t, int64(1), stats.mu.data.ExecStatCollectionCount, "expected to have collected exactly one set of execution stats")
		require.Greater(t, stats.mu.data.RowsRead.Mean, float64(0), "expected statement to have read at least one row")
		require.Greater(t, stats.mu.data.MaxMemUsage.Mean, float64(0), "expected statement to have requested bytes")

nit: to me "to have requested bytes" reads like it is more about BytesRead and not MaxMemUsage, maybe expected statement to request some RAM or something like that?

TestSampledStatsCollection would previously only check that stats that are
collected regardless of the sample rate are returned. These types of stats
(rows/bytes read) are propagated using metadata, rather than the trace.

This resulted in us silently failing to collect any stats when sampling was
enabled once the tracing mode was reverted back to legacy. To avoid this kind
of thing happening again, this commit adds a check that max memory usage is
reported to be non-zero.

Release note: None (this is a new feature that has no user impact yet)
Copy link
Contributor Author

@asubiotto asubiotto 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! 1 of 0 LGTMs obtained


pkg/sql/instrumentation_test.go, line 83 at r5 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: to me "to have requested bytes" reads like it is more about BytesRead and not MaxMemUsage, maybe expected statement to request some RAM or something like that?

Done.

@asubiotto
Copy link
Contributor Author

TFTR

bors r=yuzefovich

@craig
Copy link
Contributor

craig bot commented Feb 18, 2021

Build succeeded:

@craig craig bot merged commit 80dd7d0 into cockroachdb:master Feb 18, 2021
@asubiotto asubiotto deleted the rttm branch February 18, 2021 16:27
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