Skip to content

Conversation

@rmuir
Copy link
Contributor

@rmuir rmuir commented Oct 12, 2015

Currently this caches some state per-top-level-reader.

This currently has a downside in that it makes managing the cache tricky when readers are wrapped, since the map is cleared by addReaderClosedListener.

As a per-segment cache, things are simpler for that case since we can just use addCoreClosedListener, which will evict from this cache when the underlying segment's core is merged away. Its effectively required for reader wrappers to delegate getCoreCacheKey for good performance with elasticsearch (otherwise you would e.g. build fielddata and so on per-query), so its not a limitation.

It also addresses the TODO in the code about handling reopen...

If @mikemccand benchmarking is ok, I will add unit tests to this PR, we should be able to easily test this thing.

@mikemccand
Copy link
Contributor

LGTM, this is a nice cleanup (1 TermsEnum per segment core, instead of 1 per top-level reader X segment core).

I benchmarked indexing at defaults and it looks like any performance change is within noise.

@s1monw
Copy link
Contributor

s1monw commented Oct 12, 2015

LGTM too - I think as a followup we can remove the support for payloads in master since we don't support indices with payloads anymore.

@clintongormley clintongormley added >enhancement :Core/Infra/Core Core issues without another label labels Oct 13, 2015
@rmuir
Copy link
Contributor Author

rmuir commented Oct 13, 2015

I added some tests for cache eviction of readers and so on here. I think its ready.

@s1monw
Copy link
Contributor

s1monw commented Oct 13, 2015

LGTM thanks for all the tests

@rmuir rmuir closed this in ceb969a Oct 13, 2015
rmuir added a commit that referenced this pull request Oct 13, 2015
Closes #14070

Squashed commit of the following:

commit ad5829e
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Oct 13 06:50:25 2015 -0400

    Add more tests for version map caching

commit 617333e
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:25:51 2015 -0400

    fix javadocs ref

commit 9626dd0
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:23:16 2015 -0400

    make the version map cache per-segment

Conflicts:
	core/src/main/java/org/elasticsearch/common/lucene/uid/Versions.java
rmuir added a commit that referenced this pull request Oct 13, 2015
Closes #14070

Squashed commit of the following:

commit ad5829e
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Oct 13 06:50:25 2015 -0400

    Add more tests for version map caching

commit 617333e
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:25:51 2015 -0400

    fix javadocs ref

commit 9626dd0
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:23:16 2015 -0400

    make the version map cache per-segment

Conflicts:
	core/src/main/java/org/elasticsearch/common/lucene/uid/Versions.java
rmuir added a commit that referenced this pull request Oct 13, 2015
Closes #14070

Squashed commit of the following:

commit ad5829e
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Oct 13 06:50:25 2015 -0400

    Add more tests for version map caching

commit 617333e
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:25:51 2015 -0400

    fix javadocs ref

commit 9626dd0
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Oct 12 13:23:16 2015 -0400

    make the version map cache per-segment

Conflicts:
	core/src/main/java/org/elasticsearch/common/lucene/uid/Versions.java

Conflicts:
	core/src/main/java/org/elasticsearch/common/lucene/uid/PerThreadIDAndVersionLookup.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants