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
ByteSizeValue.equals should normalize units #13784
Conversation
currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB")
@javanna can you take a look please? |
return size == sizeValue.size; | ||
} else { | ||
return bytes() == sizeValue.bytes(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we just always use the else branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to avoid conversions in the case when it used to return true (i.e., same units) in order to have the minimal change for performance. Can switch if you feel strongly about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conversion should be very cheap, so I would prefer to always convert to avoid a branch.
@jpountz pushed another commit. |
LGTM |
thx @jpountz are you +1 on pushing this to 2.0 as well? |
It looks like a low-risk fix, so 2.0 works for me. |
currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB") Closes #13784
currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB") Closes #13784
When a shard becomes in active we trigger a sync flush in order to speed up future recoveries. The sync flush causes a new translog generation to be made, which in turn confuses the IndexingMemoryController making it think that the shard is active. If no documents comes along in the next 5m, the shard is made inactive again , triggering a sync flush and so forth. To avoid this, the IndexingMemoryController is changed to ignore empty translogs when checking if a shard became active. This comes with the price of potentially missing indexing operations which are followed by a flush. This is acceptable as if no more index operation come in, it's OK to leave the shard in active. A new unit test is introduced and comparable integration tests are removed. Relates elastic#13802 Includes a backport of elastic#13784
When a shard becomes in active we trigger a sync flush in order to speed up future recoveries. The sync flush causes a new translog generation to be made, which in turn confuses the IndexingMemoryController making it think that the shard is active. If no documents comes along in the next 5m, the shard is made inactive again , triggering a sync flush and so forth. To avoid this, the IndexingMemoryController is changed to ignore empty translogs when checking if a shard became active. This comes with the price of potentially missing indexing operations which are followed by a flush. This is acceptable as if no more index operation come in, it's OK to leave the shard in active. A new unit test is introduced and comparable integration tests are removed. Relates elastic#13802 Includes a backport of elastic#13784 Closes elastic#13824
currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB")