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

fix(stmt): evict & unbound schema stmt query #1006

Merged
merged 6 commits into from
Sep 27, 2021

Conversation

shhdgit
Copy link
Member

@shhdgit shhdgit commented Sep 15, 2021

  • fix evict & unbound schema stmt query to avoid blank detail page
  • add evict stmt tips

Another issue that can cause blank detail page is #982. PTAL, thanks~

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 15, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breeswish

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@shhdgit
Copy link
Member Author

shhdgit commented Sep 15, 2021

/cc @baurine @breeswish

PTAL, Thanks~

if schemaName != "" {
query.Where("schema_name = ?", schemaName)
}
if digest == "" {
Copy link
Member

Choose a reason for hiding this comment

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

So frontend will pass digest="" to the backend, even if the digest from the backend is null?

Copy link
Contributor

Choose a reason for hiding this comment

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

Go: 🤧

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, there are two things we need to improve:

  • Define a new structure. Embed sql.NullString to scan NULL value from db and customize the MashallJSON/UnmashallJSON interface to serde null value
  • The get request is not easy to carry null, we can use undefined to not pass this parameter

But I don't think that's going to help here. I reverted the code, LOL.

Copy link
Member Author

@shhdgit shhdgit Sep 16, 2021

Choose a reason for hiding this comment

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

Because is null and = '' are always two different patterns.

pkg/apiserver/statement/queries.go Outdated Show resolved Hide resolved
Comment on lines 249 to 260
// the evicted record's digest will be empty string
const evictTips = 'Others(Aggregates all the evicted statements)'
data.forEach((d) => {
if (d.digest !== '') {
return
}
d.digest = evictTips
d.digest_text = evictTips
})

setStatements(data)
cacheMgr?.set(cacheKey, data)
Copy link
Member

Choose a reason for hiding this comment

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

Could you provide a screen shot about how it looks like for "Others" in the list page and in the detail page? Also maybe it is better to display this row as:

(Others) (gray)

tooltip: All of other dropped SQL statements

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I need to refine it, hold on.

Copy link
Member Author

@shhdgit shhdgit Sep 26, 2021

Choose a reason for hiding this comment

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

Should we show the detail page when user click evicted data? There's nothing to display.

@shhdgit
Copy link
Member Author

shhdgit commented Sep 26, 2021

Updated, PTAL~ @breeswish

Screen Shot 2021-09-26 at 22 15 44

Conflicts:
	ui/lib/apps/Statement/utils/useStatementTableController.ts
@shhdgit shhdgit merged commit 73a0157 into pingcap:master Sep 27, 2021
shhdgit added a commit to shhdgit/tidb-dashboard that referenced this pull request Sep 27, 2021
* fix(stmt): evict & unbound schema stmt query

* tweak(ui): evict stmt tips

* refine

* refine

* chore: make lint happy
shhdgit added a commit that referenced this pull request Sep 28, 2021
* fix(stmt): evict & unbound schema stmt query (#1006)

* fix(client): goroutine leak (#1013)

* Update release version

* hide help link for non TiDB distro (#1015)

Co-authored-by: Sparkle <1284531+baurine@users.noreply.github.com>
shhdgit added a commit to shhdgit/tidb-dashboard that referenced this pull request Nov 3, 2021
* fix(stmt): evict & unbound schema stmt query

* tweak(ui): evict stmt tips

* refine

* refine

* chore: make lint happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants