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

Grow buffer if histogram can't fit #398

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

travisdowns
Copy link
Contributor

When we serialize a histogram to a byte array, the intermediate
ByteBuffer that we pass may be too small which may result in silent
truncation of the encoded histogram.

This will manifest on the driver side as a decoding failure. However,
because the driver side retries this request on failure, it will attempt
to get the histogram from the remote worker a second time but
histogram reads are "destructive" - they clear the source histogram.

So the second read will succeed because the histogram is much
smaller (it is almost empty), but it leads to only sampling about 1
second worth of data at the end of the test.

This change detects this case and grows the buffer by a
factor of 2 until it fits.

Fixes #369.

When we serialize a histogram to a byte array, the intermediate
ByteBuffer that we pass may be too small which may result in silent
truncation of the encoded histogram.

This will manifest on the driver side as a decoding failure.

This change detects this case and grows the buffer by a
factor of 2 until it fits.

Fixes openmessaging#369.
Add an addition test to the HistogramSerDeTest which tests that
histogram deserialization roundtrips even when the serialized size
exceeds the initial buffer.
@travisdowns travisdowns changed the title Td upstream histogram fix Grow buffer if histogram can't fit Dec 6, 2023
@merlimat merlimat merged commit 4eb2327 into openmessaging:master Dec 20, 2023
1 check 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.

Benchmark failed with ArrayIndexOutOfBoundException.
2 participants