Skip to content

sql: include sampled stats in TestSampledStatsCollection#60424

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
asubiotto:rttm
Feb 18, 2021
Merged

sql: include sampled stats in TestSampledStatsCollection#60424
craig[bot] merged 1 commit intocockroachdb:masterfrom
asubiotto:rttm

Conversation

@asubiotto
Copy link
Copy Markdown
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)

@asubiotto asubiotto requested a review from yuzefovich February 10, 2021 14:46
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@asubiotto asubiotto requested a review from a team February 10, 2021 14:47
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

TFTR

bors r=yuzefovich

@craig
Copy link
Copy Markdown
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