Skip to content

Conversation

@olcbean
Copy link
Contributor

@olcbean olcbean commented Mar 16, 2018

Simplify the parsing of the params in Clear Indices Cache API, as a follow up to the removing of the deprecated parameter names.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean(entry.getKey(), clearIndicesCacheRequest.fieldDataCache()));
} else if (Fields.FIELDS.match(entry.getKey(), LoggingDeprecationHandler.INSTANCE)) {
clearIndicesCacheRequest.fields(request.paramAsStringArray(entry.getKey(), clearIndicesCacheRequest.fields()));
for (String param : request.params().keySet()) {
Copy link
Member

Choose a reason for hiding this comment

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

Recently we've been doing something more like this:

clearIndicesCacheRequest.queryCache(request.paramAsBoolean("query", clearIndicesCacheRequest.queryCache()));
clearIndicesCacheRequest.requestCache(request.paramAsBoolean("request", clearIndicesCacheRequest.requestCache()));
...

Rather than the loop. The whole loop thing is more appropriate for by-hand xcontent parsing then url parsing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😅

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@elasticmachine, test this please

clearIndicesCacheRequest.queryCache(request.paramAsBoolean(QUERY, clearIndicesCacheRequest.queryCache()));
clearIndicesCacheRequest.requestCache(request.paramAsBoolean(REQUEST, clearIndicesCacheRequest.requestCache()));
clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean(FIELDDATA, clearIndicesCacheRequest.fieldDataCache()));
clearIndicesCacheRequest.fields(request.paramAsStringArray(FIELDS, clearIndicesCacheRequest.fields()));
Copy link
Member

Choose a reason for hiding this comment

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

super minor nit: I wonder if we even need the string constants at this point :)

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we either but I know some folks like them so I certainly don't object to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

( for consistency ) I think it would be better to remove them
Thanks!

@jasontedor jasontedor added the :Core/Infra/REST API REST infrastructure and utilities label Mar 16, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@nik9000 nik9000 merged commit 47211c0 into elastic:master Mar 16, 2018
@nik9000
Copy link
Member

nik9000 commented Mar 16, 2018

Thanks for doing this @olcbean! I've got a clean build so I'm merging!

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Mar 20, 2018
* master: (476 commits)
  Fix compilation errors in ML integration tests
  Small code cleanups and refactorings in persistent tasks (elastic#29109)
  Update allocation awareness docs (elastic#29116)
  Configure error file for archive packages (elastic#29129)
  Configure heap dump path for archive packages (elastic#29130)
  Client: Add missing test
  getMinGenerationForSeqNo should acquire read lock (elastic#29126)
  Backport - Do not renew sync-id PR to 5.6 and 6.3
  Client: Wrap SSLHandshakeException in sync calls
  Fix creating keystore when upgrading (elastic#29121)
  Align thread pool info to thread pool configuration (elastic#29123)
  TEST: Adjust translog size assumption in new engine
  Docs: HighLevelRestClient#multiGet (elastic#29095)
  Client: Wrap synchronous exceptions (elastic#28919)
  REST: Clear Indices Cache API simplify param parsing (elastic#29111)
  Fix typo in ExceptionSerializationTests
  Remove BWC layer for rejected execution exception
  Fix EsAbortPolicy to conform to API (elastic#29075)
  [DOCS] Removed prerelease footnote from upgrade table.
  Docs: Support triple quotes (elastic#28915)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/REST API REST infrastructure and utilities >non-issue v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants