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 support for server search server side #4596

Closed

Conversation

mhoppa
Copy link
Contributor

@mhoppa mhoppa commented Apr 3, 2020

What does this PR (Pull Request) do?

This does not completely fix the issue but it adds server side search on servers.

Which Traffic Control components are affected by this PR?

  • Documentation
  • Traffic Control Client
  • Traffic Ops

What is the best way to verify this PR?

There is API tests and unit tests to test the new search ability but to manually test it you need to set up the TO server with the PR and make requests to GET 2.0/servers.

The search parameters work as follows:

search - comma separated list of server attributes to search
searchValue - string value to search with (its contains search)
searchOperator - optional operator to use on the search. Can either be OR or AND. The default is OR meaning any of the search attributes must contain the searchValue to return

If this is a bug fix, what versions of Traffic Control are affected?

The following criteria are ALL met by this PR

  • This PR includes tests OR I have explained why tests are unnecessary
  • This PR includes documentation OR I have explained why documentation is unnecessary
  • This PR includes an update to CHANGELOG.md OR such an update is not necessary
  • This PR includes any and all required license headers
  • This PR ensures that database migration sequence is correct OR this PR does not include a database migration
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

Additional Information

This is a stop gap solution to alleviate the load on TP as business grow their servers causing a tremendous bad user experience.

Going forward TO should adopt its own query language for searching that is not so rigid much like http://www.persvr.org/rql/ as an example

@@ -242,6 +242,30 @@ func getServers(params map[string]string, tx *sqlx.Tx, user *auth.CurrentUser) (
"dsId": dbhelpers.WhereColumnInfo{"dss.deliveryservice", nil},
}

searchQueryParamsToSQLCols := map[string]dbhelpers.WhereColumnInfo{
Copy link
Member

Choose a reason for hiding this comment

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

We should make sure all the columns we're allowing search on have indexes, to prevent performance issues and accidental or intentional DDOS

@mitchell852 mitchell852 added Traffic Ops related to Traffic Ops improvement The functionality exists but it could be improved in some way. labels Apr 3, 2020
@mitchell852
Copy link
Member

mitchell852 commented Apr 3, 2020

2 things i like about this feature:

  1. "contains" search: this allows you to do a contains search - ?search=hostName&searchValue=foo - where this does not: ?hostName=foo

^^ maybe this could even be changed at some point to include regex?

  1. OR search: this allows you to do an OR search - ?search=hostName,domainName&searchValue=foo - where this does not: ?hostName=foo&domainName=foo

@mitchell852 mitchell852 added new feature A new feature, capability or behavior and removed improvement The functionality exists but it could be improved in some way. labels Apr 6, 2020
@mhoppa mhoppa marked this pull request as ready for review April 16, 2020 19:36
@mitchell852
Copy link
Member

closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance (pagination and search) of TP's tables
3 participants