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

Use segment ordinals as global ordinals if possible #5873

Conversation

martijnvg
Copy link
Member

Use segment ordinals as global ordinals if a segment contains all values for a field on a shard level.

PR for #5854

@jpountz
Copy link
Contributor

jpountz commented Apr 18, 2014

This looks good. I think we just need to make sure the mapping from segment ords to global ords for these segments isn't loaded into the cache.

…l maxOrd, and use segment ordinals directly instead
@martijnvg
Copy link
Member Author

Updated the PR and yes, that make absolutely sense, to save a bit more memory.

@@ -105,7 +105,7 @@ public InternalGlobalOrdinalsBuilder(Index index, @IndexSettings Settings indexS
breakerService.getBreaker().addWithoutBreaking(memorySizeInBytes);

if (logger.isDebugEnabled()) {
String implName = segmentOrdToGlobalOrdLookups[0].getClass().getSimpleName();
String implName = maxOrd < threshold ? "PackedIntOrdinalMappingSource" : "CompressedOrdinalMappingSource";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we avoid hard-coding it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, this is ugly, I'll make it nice. In the current state segmentOrdToGlobalOrdLookups entries could be null (all of them), so that is why I resorted this hack.

Added BucketsAggregator.collectExistingBucket that doesn't check to resize the docCounts array. In case of global ordinals based terms agg we can initialize it with maxOrd and save a check per hit.
*/
public void initializeDocCounts(long maxOrd) {
docCounts = bigArrays.grow(docCounts, maxOrd);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary? the aggregator factory should create it with the right size directly? (if it does not I think this is a bug)

@martijnvg martijnvg closed this in eb98053 Apr 25, 2014
martijnvg added a commit that referenced this pull request Apr 25, 2014
…ues for a field on a shard level.

Relates to #5854
Closes #5873
martijnvg added a commit that referenced this pull request Apr 25, 2014
martijnvg added a commit that referenced this pull request Apr 25, 2014
@martijnvg martijnvg deleted the improvements/use-segment-ordinals-as-global-ordinals-if-all-values-exists-in-segment branch May 18, 2015 23:31
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Fielddata labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants