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 performance issue on the status page #522

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions go/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (

type Exec struct {
UUID uuid.UUID
RawUUID string
AnsibleConfig ansible.Config
Source string
GitRef string
Expand Down Expand Up @@ -456,32 +457,11 @@ func GetRecentExecutions(client storage.SQLClient) ([]*Exec, error) {
}
defer result.Close()
for result.Next() {
var eUUID string
exec := &Exec{}
err = result.Scan(&eUUID, &exec.Status, &exec.GitRef, &exec.StartedAt, &exec.FinishedAt, &exec.Source, &exec.TypeOf, &exec.PullNB, &exec.GolangVersion)
err = result.Scan(&exec.RawUUID, &exec.Status, &exec.GitRef, &exec.StartedAt, &exec.FinishedAt, &exec.Source, &exec.TypeOf, &exec.PullNB, &exec.GolangVersion)
if err != nil {
return nil, err
}
exec.UUID, err = uuid.Parse(eUUID)
if err != nil {
return nil, err
}
if exec.TypeOf != "micro" {
macroResult, err := client.Select("SELECT m.vtgate_planner_version FROM macrobenchmark m, execution e WHERE e.uuid = m.exec_uuid AND e.uuid = ? LIMIT 1", eUUID)
if err != nil {
Comment on lines -469 to -471
Copy link
Member Author

Choose a reason for hiding this comment

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

We were not even rendering the query planner version on the web page, so it is totally fine to remove these extra db calls.

return nil, err
}
defer macroResult.Close()

var plannerVersion string
if macroResult.Next() {
err = macroResult.Scan(&plannerVersion)
if err != nil {
return nil, err
}
}
exec.VtgatePlannerVersion = plannerVersion
}
res = append(res, exec)
}
return res, nil
Expand Down
2 changes: 1 addition & 1 deletion go/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Server) getRecentExecutions(c *gin.Context) {
recentExecs := make([]RecentExecutions, 0, len(execs))
for _, e := range execs {
recentExecs = append(recentExecs, RecentExecutions{
UUID: e.UUID.String(),
UUID: e.RawUUID,
Source: e.Source,
GitRef: e.GitRef,
Status: e.Status,
Expand Down
Loading