Skip to content

sql: fix in-memory stmt stats not properly updating#69441

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
Azhng:sqlstats-fix-missing-metadata
Aug 27, 2021
Merged

sql: fix in-memory stmt stats not properly updating#69441
craig[bot] merged 1 commit intocockroachdb:masterfrom
Azhng:sqlstats-fix-missing-metadata

Conversation

@Azhng
Copy link
Copy Markdown
Contributor

@Azhng Azhng commented Aug 26, 2021

Previsouly, in-memeory statement statistics does not return
any metadata. This is due to the temp SQLStats object used
for aggregating RPC fanout results not properly updating the
metadata fields.
This commit address the bug and expanded testing to randomly
test all fields for statement statistics metadata.

Resolves #69363

Release justification: Category 2: Bug fixes and low-risk updates
to new functionality

Release note: None

@Azhng Azhng requested a review from a team August 26, 2021 21:50
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Thanks for doing this quickly, just a few nits from me

Reviewed 3 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @Azhng)


pkg/sql/sqlstats/sslocal/sql_stats_test.go, line 26 at r1 (raw file):

)

func TestSQLStatsStmtStatsTempObjectRandomMetadata(t *testing.T) {

that is really long name and a little hard to understand at first, so add some comments about what this test is for


pkg/sql/sqlstats/ssmemstorage/ss_mem_storage.go, line 259 at r1 (raw file):

		stmtStats.mu.data.Add(&statistics[i].Stats)

		// We now manually add all other single metadata fields.

nit: avoid using "now" on comments, could be confusing and don't add much information (now on this part of the code or now is in this code is doing now because it wasn't doing before). Change to something like:
// Setting all metadata fields

@Azhng Azhng force-pushed the sqlstats-fix-missing-metadata branch from 18b6b73 to 442910e Compare August 26, 2021 23:03
Copy link
Copy Markdown
Contributor Author

@Azhng Azhng 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 (waiting on @maryliag)


pkg/sql/sqlstats/sslocal/sql_stats_test.go, line 26 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

that is really long name and a little hard to understand at first, so add some comments about what this test is for

Done.

Copy link
Copy Markdown
Contributor

@maryliag maryliag 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 4 of 4 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @maryliag)

Previsouly, in-memeory statement statistics does not return
any metadata. This is due to the temp SQLStats object used
for aggregating RPC fanout results not properly updating the
metadata fields.
This commit address the bug and expanded testing to randomly
test all fields for statement statistics metadata.

Resolves cockroachdb#69363

Release justification: Category 2: Bug fixes and low-risk updates
to new functionality

Release note: None
@Azhng Azhng force-pushed the sqlstats-fix-missing-metadata branch from 442910e to d2aae61 Compare August 26, 2021 23:59
@Azhng
Copy link
Copy Markdown
Contributor Author

Azhng commented Aug 27, 2021

bors r=maryliag

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 27, 2021

Build succeeded:

@craig craig bot merged commit 2bdfa38 into cockroachdb:master Aug 27, 2021
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.

sql: database name in crdb_internal.statement_statistics does not show up until flushed to disk

3 participants