Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Format SHOW PROCESSLIST progress as a tree #861

Merged
merged 1 commit into from
Oct 29, 2019

Conversation

carlosms
Copy link
Contributor

This is a sugestion by @ajnavarro, related to #855.

With the changes in this PR the output of SHOW PROCESSLIST shows the progress formatted as a tree:

mysql> show processlist\G
*************************** 1. row ***************************
     Id: 2
   User: root
   Host: 127.0.0.1:53116
     db: gitbase
Command: query
   Time: 0
  State: running
   Info: show processlist
*************************** 2. row ***************************
     Id: 1
   User: root
   Host: 127.0.0.1:53116
     db: gitbase
Command: query
   Time: 50
  State: 
SquashedTable(repositories, commits) (0/3 partitions)
 ├─ cangallo (101/? rows)
 ├─ octoprint-tft (101/? rows)
 └─ upsilon (101/? rows)

   Info: select * from repositories natural join commits
2 rows in set (0.01 sec)

@carlosms carlosms requested a review from a team October 29, 2019 13:05
progress := proc.Progress[name]

printer := sql.NewTreePrinter()
printer.WriteNode("\n" + progress.String())

Choose a reason for hiding this comment

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

Error return value of printer.WriteNode is not checked (from errcheck)

Copy link
Contributor

Choose a reason for hiding this comment

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

you should _ = printer.WriteNode

children = append(children, partitionProgress.String())
}
sort.Strings(children)
printer.WriteChildren(children...)

Choose a reason for hiding this comment

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

Error return value of printer.WriteChildren is not checked (from errcheck)

Copy link
Contributor

@erizocosmico erizocosmico left a comment

Choose a reason for hiding this comment

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

Other than the minor checks golangci bot is mentioning, LGTM.

@carlosms
Copy link
Contributor Author

GolangCI changes made and squashed

@ajnavarro ajnavarro merged commit 62780e1 into src-d:master Oct 29, 2019
@carlosms carlosms deleted the format-processlist branch October 29, 2019 17:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants