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

ByteSizeValue.equals should normalize units #13784

Closed
wants to merge 2 commits into from

Conversation

bleskes
Copy link
Contributor

@bleskes bleskes commented Sep 25, 2015

currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB")

currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB")
@bleskes
Copy link
Contributor Author

bleskes commented Sep 25, 2015

@javanna can you take a look please?

return size == sizeValue.size;
} else {
return bytes() == sizeValue.bytes();
}
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@bleskes
Copy link
Contributor Author

bleskes commented Sep 25, 2015

@jpountz pushed another commit.

@jpountz
Copy link
Contributor

jpountz commented Sep 25, 2015

LGTM

@bleskes
Copy link
Contributor Author

bleskes commented Sep 25, 2015

thx @jpountz are you +1 on pushing this to 2.0 as well?

@jpountz
Copy link
Contributor

jpountz commented Sep 25, 2015

It looks like a low-risk fix, so 2.0 works for me.

@clintongormley clintongormley added the :Core/Infra/Settings Settings infrastructure and APIs label Sep 25, 2015
@bleskes bleskes closed this in 5a0f2fd Sep 25, 2015
@bleskes bleskes deleted the byte_size_value branch September 25, 2015 18:09
bleskes added a commit that referenced this pull request Sep 25, 2015
currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB")

Closes #13784
bleskes added a commit that referenced this pull request Sep 25, 2015
currently ByteSizeValue.parse("1GB") is not equal to ByteSizeValue.parse("1024MB")

Closes #13784
bleskes added a commit to bleskes/elasticsearch that referenced this pull request Sep 28, 2015
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
bleskes added a commit to bleskes/elasticsearch that referenced this pull request Sep 28, 2015
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants