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

Fixes failing test case for TestOrdinalMap.testRamBytesUsed #13421

Merged
merged 4 commits into from
May 28, 2024

Conversation

pseudo-nymous
Copy link
Contributor

Description

closes #13372

TestOrdinalMap#testRamBytesUsed was failing for the case when there are multiple Default instances for PackedInts.NullReader. Currently, we return 0 when the instance is built with default size i.e. 256. Ref: org.apache.lucene.util.packed.PackedInts.NullReader#ramBytesUsed

But this was not accounted for in the Accumulator being used. Made changes to skip the object if the reader is of default static instance.

Passes failing UT.

./gradlew :lucene:core:test --tests "org.apache.lucene.index.TestOrdinalMap.testRamBytesUsed" -Ptests.seed=55680AD930225FC5 -Ptests.nightly=true

@pseudo-nymous pseudo-nymous changed the title Fixes failing test case for Fixes failing test case for TestOrdinalMap.testRamBytesUsed May 26, 2024
Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

The fix looks correct to me, thanks for looking into it!

if (o == LongValues.ZEROES || o == LongValues.IDENTITY) {
if (o == LongValues.ZEROES
|| o == LongValues.IDENTITY
|| o == PackedInts.NullReader.DEFAULT_PACKED_LONG_VALUES_PAGE_SIZE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Can you replace this with PackedInts.NullReader.forCount(PackedLongValues.DEFAULT_PAGE_SIZE) and make DEFAULT_PACKED_LONG_VALUES_PAGE_SIZE private again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Thanks for quick review.

@jpountz jpountz merged commit ea0646d into apache:main May 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reproducible failure TestOrdinalMap.testRamBytesUsed
2 participants