HBASE-30234: Replication shippedBytes metric overflows to negative due to int truncation of batch size#8467
Open
asdf2014 wants to merge 1 commit into
Open
HBASE-30234: Replication shippedBytes metric overflows to negative due to int truncation of batch size#8467asdf2014 wants to merge 1 commit into
asdf2014 wants to merge 1 commit into
Conversation
…e to int truncation of batch size Several size-tracking variables in the replication source pipeline used int instead of long, so once a WAL entry batch (or a bulk load's referenced store files) exceeded Integer.MAX_VALUE (~2GB) the value silently overflowed. This surfaced as a negative shippedBytes JMX metric and as broken throttling, since the truncated (often negative) size was handed to the bandwidth throttler. Widen the size to long end-to-end: - ReplicationSourceShipper#shipEdits keeps getHeapSize() as long. - ReplicationSourceInterface/ReplicationSource#tryThrottle and ReplicationThrottler#getNextSleepInterval accept a long size. - MetricsSource#shipBatch takes a long sizeInBytes (sink counters are long). - ReplicationEndpoint.ReplicateContext#size and its accessors are long. - ReplicationSourceWALReader#sizeOfStoreFilesIncludeBulkLoad accumulates and returns long instead of casting each addition to int. Add TestReplicationSizeOverflow (store-file-size accumulation, shippedBytes metric path, ReplicateContext) and a >2GB case in TestReplicationThrottler.
Member
Author
|
The |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Several size-tracking variables in the replication source pipeline use
int.Once a WAL entry batch (or a bulk load's referenced store files) exceeds
Integer.MAX_VALUE(~2GB), the value silently overflows: theshippedBytesJMX metric goes negative and the (negative) size is fed to the bandwidth
throttler, breaking throttling.
Fix
Widen the size to
longend-to-end (shipper heap size,tryThrottle/getNextSleepInterval,MetricsSource#shipBatch,ReplicateContext#size,and
ReplicationSourceWALReader#sizeOfStoreFilesIncludeBulkLoad).Testing
TestReplicationSizeOverflowand a >2GB case inTestReplicationThrottler.intcast makes the store-file test fail withexpected: <3500000000> but was: <-794967296>.spotbugs:checkreports 0 bugs; changed lines are checkstyle-clean.