OpenSearch/plugins
Colin Goodheart-Smithe 579d1fea57
Fixes ByteSizeValue to serialise correctly (#27702)
* Fixes ByteSizeValue to serialise correctly

This fix makes a few fixes to ByteSizeValue to make it possible to perform round-trip serialisation:
* Changes wire serialisation to use Zlong methods instead of VLong methods. This is needed because the value `-1` is accepted but previously if `-1` is supplied it cannot be serialised using the wire protocol.
* Limits the supplied size to be no more than Long.MAX_VALUE when converted to bytes. Previously values greater than Long.MAX_VALUE bytes were accepted but would be silently interpreted as Long.MAX_VALUE bytes rather than erroring so the user had no idea the value was not being used the way they had intended. I consider this a bug and so fine to include this bug fix in a minor version but I am open to other points of view.
* Adds a `getStringRep()` method that can be used when serialising the value to JSON. This will print the bytes value if the size is positive, `”0”` if the size is `0` and `”-1”` if the size is `-1`.
* Adds logic to detect fractional values when parsing from a String and emits a deprecation warning in this case.
* Modifies hashCode and equals methods to work with long values rather than doubles so they don’t run into precision problems when dealing with large values. Previous to this change the equals method would not detect small differences in the values (e.g. 1-1000 bytes ranges) if the actual values where very large (e.g. PBs). This was due to the values being in the order of 10^18 but doubles only maintaining a precision of ~10^15.

Closes #27568

* Fix bytes settings default value to not use fractional values

* Fixes test

* Addresses review comments

* Modifies parsing to preserve unit

This should be bwc since in the case that the input is fractional it reverts back to the old method of parsing it to the bytes value.

* Addresses more review comments

* Fixes tests

* Temporarily changes version check to 7.0.0

This will be changed to 6.2 when the fix has been backported
2017-12-14 12:17:17 +00:00
..
analysis-icu Catch InvalidPathException in IcuCollationTokenFilterFactory (#27202) 2017-12-04 10:29:08 +01:00
analysis-kuromoji Upgrade to lucene-7.2.0-snapshot-8c94404. (#27619) 2017-12-04 09:40:08 +01:00
analysis-phonetic Upgrade to lucene-7.2.0-snapshot-8c94404. (#27619) 2017-12-04 09:40:08 +01:00
analysis-smartcn Upgrade to lucene-7.2.0-snapshot-8c94404. (#27619) 2017-12-04 09:40:08 +01:00
analysis-stempel Upgrade to lucene-7.2.0-snapshot-8c94404. (#27619) 2017-12-04 09:40:08 +01:00
analysis-ukrainian Upgrade to lucene-7.2.0-snapshot-8c94404. (#27619) 2017-12-04 09:40:08 +01:00
discovery-azure-classic Remove stale awaits fix on azure master nodes test 2017-11-28 22:43:34 -05:00
discovery-ec2 Remove some unused code (#27792) 2017-12-13 16:45:55 +01:00
discovery-file Remove some unused code (#27792) 2017-12-13 16:45:55 +01:00
discovery-gce Remove some unused code (#27792) 2017-12-13 16:45:55 +01:00
examples Allow plugins to plug rescore implementations (#26368) 2017-08-25 13:46:57 -04:00
ingest-attachment Update Tika version to 1.15 2017-11-09 13:16:44 -05:00
ingest-geoip [Docs] "The the" is a great band, but ... (#26644) 2017-09-14 15:08:20 +02:00
ingest-user-agent update ingest-user-agent regexes.yml (#25608) 2017-07-10 08:43:11 -07:00
jvm-example Remove path.conf setting 2017-06-26 15:18:29 -04:00
mapper-murmur3 Add support for filtering mappings fields (#27603) 2017-12-05 20:31:29 +01:00
mapper-size Unify the result interfaces from get and search in Java client (#25361) 2017-06-29 11:35:28 +02:00
repository-azure Allow affix settings to specify dependencies (#27161) 2017-11-13 12:06:36 +01:00
repository-gcs Update Google SDK to version 1.23 (#27381) 2017-11-15 15:30:27 +01:00
repository-hdfs Fix SecurityException when HDFS Repository used against HA Namenodes (#27196) 2017-12-01 14:26:05 -05:00
repository-s3 Fixes ByteSizeValue to serialise correctly (#27702) 2017-12-14 12:17:17 +00:00
store-smb Validate top-level keys for create index request (#23755) (#23869) 2017-09-26 09:49:20 -07:00
build.gradle Plugins: Include license and notice files in zip (#23191) 2017-02-15 11:23:12 -08:00