Currently, unsafeBytesToString function violates the 6th rule of unsafe
pointer usage. That is, reflect.SliceHeader/String header should never
be used as plain struct. This misuse can make to silent memory
corruption, which can be difficult to track down when problem occurred.
Instead, use the more (right) idiom to convert slice of byte to string
without heap allocation.
goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
BenchmarkInvalid-8 1000000000 0.497 ns/op 0 B/op 0 allocs/op
BenchmarkValid-8 1000000000 0.239 ns/op 0 B/op 0 allocs/op
PASS
ok command-line-arguments 0.815s
Go tip now enforces that strconv.ParseFloat receives a bitSize parameter
of 32 or 64. Previously, any value that was not 32, was treated as 64.
The previous value of 10 was likely a copy-paste error from integer
parsing.
This commit adds the `WithWritePointsValidationEnabled()` option
to disable validation in `Engine.WritePoints()` as the same
validation is performed earlier in the call stack by cloud.
These APIs require a measurement, permitting an additional optimization
to reduce the search space against the TSM index. Specifically, the
search key prefix is extended from `org+bucket` to
`org+bucket,\x00=<measurement>`
* MeasurementNames
* MeasurementTagKeys
* MeasurementTagValues
* Adds an api to the models package for efficiently parsing the
measurement tag (\x00) from a normalized series key
The behavior of the line-protocol parser remains unchanged. This PR
moves the functions to a struct in order to simplify the tracking of
limits whilst parsing a request.
Limits may be set using the ParsePointsWithOptions API and the
associated WithParser functional options, all of which are documented.
It should be noted that the behavior of ParsePointsWithPrecision remains
unchanged.
ParsePointsWithPrecisionV1 was no longer used and removed to simplify
code.
This API is a benefit when the caller is only interested in parsing
tags and reusing an existing Tags buffer. It will be used by the
storage schema APIs.
This type will be used by the storage TagKeys API to quickly determine
the distinct set of tag keys over a set of series keys.
It is also intended to replace the implementation of keyMerger in
the reads package in a separate PR.
We will want to validate that all tag key/value data is valid unicode.
This commit changes the validation helper to only validate provided
tags, since measurements are currently very likely to contain invalid
utf-8 characters.
There are two exceptions to the tag validation: the validation of the
special tag keys for measurements and field keys.
I did this with a dumb editor macro, so some comments changed too.
Also rename root package from platform to influxdb.
In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.
Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
Prior to this change, `go test -count=2 ./models` would fail like:
--- FAIL: TestMarshal (0.00s)
points_test.go:37: got: ,A\ FOO=bar,APPLE=orange,host=serverA,region=uswest
points_test.go:38: exp: ,apple=orange,foo=bar,host=serverA,region=uswest
points_test.go:39: invalid match
because a later test reassigned the package-level variable that
TestMarshal depends on. Don't reassign that variable anymore.
Also cleaned up some whitespace, and moved an init function to the top
of the file for visibility.
Type conflicts should be rare, but when they do happen, printing out the
string name should save developers a couple minutes of digging compared
to looking up which numeric value means which type.