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

Add topology tags command #942

Merged
merged 8 commits into from
Dec 4, 2019
Merged

Add topology tags command #942

merged 8 commits into from
Dec 4, 2019

Conversation

nickdelnano
Copy link
Contributor

Related issue: #941

Description

This PR adds a command "topology-tags" to the HTTP API and the CLI interface to act exactly like the "topology" command but also to print the tags for each instance on the same line as the instance itself.

A proposal for the text formatting is specified in #941, but copied here:

$ orchestrator -c topology -i testhost:22293
testhost:22293     [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
- testhost:22294   [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
  - testhost:22295 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
- testhost:22296   [unknown,unchecked,5.6.28,rw,nobinlog,P-GTID]
- testhost:22297   [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]

$ orchestrator -c tag -i testhost:22293 -t in_service
$ orchestrator -c tag -i testhost:22293 -t role=backup

$ orchestrator -c tag -i testhost:22294 -t role=delayed

$ orchestrator -c tag -i testhost:22295 -t in_service

# The command which I am proposing, here I call it "topology-tags"
$ orchestrator -c topology-tags -i testhost:22295
testhost:22293     [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] [in_service,role=backup]
- testhost:22294   [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] [role=delayed]
  - testhost:22295 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] [in_service]
- testhost:22296   [unknown,unchecked,5.6.28,rw,nobinlog,P-GTID] []
- testhost:22297   [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] []

I chose to add a separate command for this functionality instead of modifying "topology" or "topology-tabulated" in order to not modify existing APIs.

There is no option for printing tags for a tabulated topology, though this could be added if desired.

Testing

I added an integration test following the same pattern as the testing of the "topology" command, which invokes the orchestrator CLI to call the command which is added in this PR.

I did not see unit tests for the functions which I modified in go/inst/instance_topology.go so I did not add any. I also did not add any tests for the HTTP endpoint for the new command since I see only minimal testing in go/http/api_test.go, though I did run orchestrator in http mode and curled the new endpoint and invoked it with the modified orchestrator-client script from this PR.

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • code is formatted via gofmt (please avoid goimports)
  • code is built via ./build.sh
  • code is tested via go test ./go/...

@shlomi-noach
Copy link
Collaborator

Thank you and sorry for the slow response. Getting to this in a few days.

@nickdelnano
Copy link
Contributor Author

Hi @shlomi-noach , can you let me know whether this is a PR you are interested in reviewing (and considering for submission) ?

@shlomi-noach
Copy link
Collaborator

Terribly sorry for the delay. Please understand my current workload demands my attention at other places, I can still be slow to look into this -- please bare with me.

@shlomi-noach
Copy link
Collaborator

Sorry about the delay; I expect to look into & merge a bunch of community PRs during the first two weeks of October.

@shlomi-noach shlomi-noach temporarily deployed to production/mysql_cluster=concertmaster December 4, 2019 10:01 Inactive
@shlomi-noach shlomi-noach temporarily deployed to production/mysql_cluster=conductor December 4, 2019 10:03 Inactive
Copy link
Collaborator

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

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

Again, apologies for the delay.

Thank you for this PR, for keeping inline with the existing coding conventions, for adding tests. This looks good!

@shlomi-noach shlomi-noach had a problem deploying to production/mysql_cluster=concertmaster December 4, 2019 10:07 Failure
@shlomi-noach shlomi-noach had a problem deploying to production/mysql_cluster=conductor December 4, 2019 10:07 Failure
@shlomi-noach shlomi-noach merged commit 4e7381c into openark:master Dec 4, 2019
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.

2 participants