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
Adds deprecation logging to ScriptDocValues#getValues. #34279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this won't work as is. Due to scripts running with reduced permissions, the call to the logger needs to be wrapped with an AccessController.doPrivileged
call. See the other deprecation examples in ScriptDocValues. We also need a test for this, preferably for each subclass.
Thanks for the fast response -- I will review the examples and update accordingly |
Pinging @elastic/es-core-infra |
It is sneaky how it won't work too. For the most part it only fails when the log call happens to roll the log file. |
Ok I've updated with an initial attempt at a fix. I think using the I will think about how testing for each class in the meantime. |
server/src/main/java/org/elasticsearch/index/fielddata/ScriptDocValues.java
Outdated
Show resolved
Hide resolved
The fix looks right to me. I agree on the BiConsumer being better here, at least with the field being call |
I think what is still missing from here is a test for each doc value type. |
@rjernst it is at the top of my todo list! Had some other items I had to take care of last week. |
Two quick questions:
Otherwise I hope to have an updated PR with tests in the next day or two. Again, sorry about the delay! |
|
If and only if they represent constants (e.g., a primitive type, or an immutable reference type like a It's genuinely an interesting discussion point whether or not a deprecation logger represents a constant. I would say that it does not, since it is mutable internal state that is visible. Given this, I would say the right name is |
I count about 58 occurrences of |
We just had the same discussion on another issue. So an issue sounds good to me! |
970c3e1
to
d643b9e
Compare
I've added an initial attempt at the tests. There are a few things I am unsure on:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests! This looks good, except one nit about the deprecation message.
server/src/main/java/org/elasticsearch/index/fielddata/ScriptDocValues.java
Outdated
Show resolved
Hide resolved
First commit addressing issue elastic#22919. `ScriptDocValues#getValues` was added for backwards compatibility but no longer needed. Scripts using the syntax `doc['foo'].values` when `doc['foo']` is a list should be using `doc['foo']` instead.
There was a problem hiding this 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. |
I merged master into my branch but |
I've seen this fail once or twice in our builds. I suspect it is flaky these past few days. |
I have a few more updates I'll push hopefully by Sunday. I merged master again and that seemed to fix the |
Thanks for sticking with this @j-haj! |
@nik9000 My pleasure! I'm seeing a few failures in the |
I am still seeing some failures when I run |
@j-haj, what are you seeing fail locally? Everything seems good in CI. I've pulled this locally and am running it on my side just to check. |
@nik9000 I am seeing
|
The slow tests shouldn't be a problem. I'll run the failing test a few
times locally. I'm 99.9999999% sure that your change has nothing to do with
RareClusterStateIT.
Given that CI is passing on the PR I'll merge it this afternoon if I can't
get RareClusterStateIT to fail locally.
…On Tue, Nov 27, 2018 at 2:09 PM Jeff Hajewski ***@***.***> wrote:
@nik9000 <https://github.com/nik9000> I am seeing
org.elasticsearch.indices.state.RareClusterStateIT.testDelayedMappingPropagationOnReplica
fail locally along with the following slow tests:
org.elasticsearch.cluster.routing.PrimaryAllocationIT
org.elasticsearch.discovery.MasterDisruptionIT
org.elasticsearch.search.aggregations.bucket.MinDocCountIT
org.elasticsearch.discovery.DiscoveryDisruptionIT
org.elasticsearch.discovery.ClusterDisruptionIT
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34279 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANLoreX0GeWvIo5SadeC7gEbUAtBcS2ks5uzY3ygaJpZM4XGgUK>
.
|
@nik9000 sounds great! |
`ScriptDocValues#getValues` was added for backwards compatibility but no longer needed. Scripts using the syntax `doc['foo'].values` when `doc['foo']` is a list should be using `doc['foo']` instead. Closes #22919
* master: DOCS Audit event attributes in new format (elastic#35510) Scripting: Actually add joda time back to whitelist (elastic#35965) [DOCS] fix HLRC ILM doc misreferenced tag Add realm information for Authenticate API (elastic#35648) [ILM] add HLRC docs to remove-policy-from-index (elastic#35759) [Rollup] Update serialization version after backport [Rollup] Add more diagnostic stats to job (elastic#35471) Build: Fix gradle build for Mac OS (elastic#35968) Adds deprecation logging to ScriptDocValues#getValues. (elastic#34279) [Monitoring] Make Exporters Async (elastic#35765) [ILM] reduce time restriction on IndexLifecycleExplainResponse (elastic#35954) Remove use of AbstractComponent in xpack (elastic#35394) Deprecate types in search and multi search templates. (elastic#35669) Remove fromXContent from IndexUpgradeInfoResponse (elastic#35934)
@j-haj, I've merged and backported to 6.x. Thanks so much for working on this! |
@nik9000 Do we need a second PR that removes this functionality? If I recall correctly from the initial discussions, there were two steps: 1) add deprecation logging and 2) remove the methods altogether (or is this what you meant by "backported to 6.x"?). |
@j-haj, yes! We do need another PR to remove the functionality. By backporting to 6.x, I mean that I cherry-picked this change onto the 6.x branch, resolved the conflicts, ran the tests, and pushed it. That is what having the |
@nik9000 yes I will take on that PR if it's available. If there is no issue already I am happy to create one. |
No need to create an issue. Just reference this PR and the original issue in the new PR. |
Yeah! We build our release notes using the PRs rather than the issues. |
* Adds deprecation logging to ScriptDocValues#getValues. First commit addressing issue #22919. `ScriptDocValues#getValues` was added for backwards compatibility but no longer needed. Scripts using the syntax `doc['foo'].values` when `doc['foo']` is a list should be using `doc['foo']` instead. * Fixes two build errors in #34279 * Removes unused import in ScriptDocValuesDatesTest * Removes used of `.values` in example in diversified-sampler-aggregation.asciidoc * Removes use of .values from painless test. Part of #34279 * Updates tests to use `doc[foo]` syntax rather than `doc[foo].values`. * Removes use of `getValues()` and replaces use of `doc[foo].values` with `doc[foo]`. * Indentation fix. * Remove unnecessary list construction at previous `getValues()` callsite in ScriptDocValues.GeoPoints. * Update migration doc and add link to `getValue` in ScriptDocValues javadoc. * Fix compile * Fix javadoc issue * Removes ScriptDocValues#getValues usage from painless whitelist.
First commit addressing issue #22919.
ScriptDocValues#getValues
was added for backwards compatibility but nolonger needed. Scripts using the syntax
doc.foo.values.bar
should beusing
doc.foo.bar
instead.