Commit Graph

54 Commits (0cb74eedbf730bd0a7c921d115ffb121d0a65ff3)

Author SHA1 Message Date
Cory LaNou 3c518f8927
panicing is bad -> error returns are good 2017-01-03 14:28:29 -06:00
kun de4436e9d9 fix scan tag value panic 2016-12-20 08:39:18 +08:00
Mark Rushakoff 15ba7958f8 Use strings.Replacer to escape string field
benchmark                                        old ns/op     new ns/op     delta
BenchmarkEscapeStringField_Plain-4               167           65.3          -60.90%
BenchmarkEscapeString_Quotes-4                   167           165           -1.20%
BenchmarkEscapeString_Backslashes-4              211           184           -12.80%
BenchmarkEscapeString_QuotesAndBackslashes-4     413           397           -3.87%

BenchmarkExportTSMStrings_100s_250vps-4     33833611      27381442           -19.07%
BenchmarkExportWALStrings_100s_250vps-4     34977761      29222717           -16.45%

benchmark                                        old allocs     new allocs     delta
BenchmarkEscapeStringField_Plain-4               4              1              -75.00%
BenchmarkEscapeString_Quotes-4                   4              3              -25.00%
BenchmarkEscapeString_Backslashes-4              5              3              -40.00%
BenchmarkEscapeString_QuotesAndBackslashes-4     9              5              -44.44%

BenchmarkExportTSMStrings_100s_250vps-4     201605          76938              -61.84%
BenchmarkExportWALStrings_100s_250vps-4     225371         100728              -55.31%

benchmark                                        old bytes     new bytes     delta
BenchmarkEscapeStringField_Plain-4               56            16            -71.43%
BenchmarkEscapeString_Quotes-4                   56            48            -14.29%
BenchmarkEscapeString_Backslashes-4              104           80            -23.08%
BenchmarkEscapeString_QuotesAndBackslashes-4     208           160           -23.08%

BenchmarkExportTSMStrings_100s_250vps-4     10872629       6062048           -44.24%
BenchmarkExportWALStrings_100s_250vps-4     10094933       5269980           -47.80%
2016-12-17 23:46:58 -08:00
Jason Wilder 2f776ea9e1 Fix string fields w/ trailing slashes
A string field w/ a trailing slash before the quote would parse incorrectly
because the quote would be seen as escaped.  We have to treat \\ as an
escape sequence within strings in order to handle this.
2016-12-01 15:24:11 -07:00
Joe LeGasse 743946fafb models: Add FieldIterator type
The FieldIterator is used to scan over the fields of a point, providing
information, and delaying parsing/decoding the value until it is needed.
This change uses this new type to avoid the allocation of a map for the
fields which is then thrown away as soon as the points get converted
into columns within the datastore.
2016-10-03 16:30:21 -06:00
Jason Wilder ac9a7d520b Pre-allocated Points slice when parsing points
Over a longer period of writes, this allocation shows up quite
a bit in profiles since the slice needs to be resized frequently.

This scans the slice to count how many lines are going to be parsed
in order to pre-allocate the slice capacity.  It's slightly slower,
but creates less garbage in the long run.
2016-09-26 12:19:15 -06:00
Cory LaNou 4a2d23da4a
fix failing vet issue in test 2016-09-26 11:29:02 -05:00
Joe LeGasse 0d2b339d7c models: Added AppendString, PointSize, and Round to Point
This change also updates the UDP client to take advantage of these
improvements, as well as some code review changes.
2016-09-23 13:22:30 -04:00
Joe LeGasse ee6816756a udp client: large points will now be split, if possible
The v2 UDP client will attempt to split points that exceed the
configured payload size. It will only do this for points that have a
timestamp specified.
2016-09-23 13:22:30 -04:00
Jonathan A. Sternberg dc2527ce86 Merge branch '1.0' 2016-08-31 14:45:57 -05:00
Jonathan A. Sternberg 0d63889847 Allow blank lines in the line protocol input 2016-08-30 09:25:55 -05:00
Jonathan A. Sternberg 8b234546a8 Merge pull request #7204 from influxdata/1.0
Merge 1.0 branch to master
2016-08-25 15:20:30 -05:00
Jonathan A. Sternberg 10029caf2f Support negative timestamps in the query engine
Negative timestamps are now supported. We also now refuse two
nanoseconds that are at the edge of the minimum time window. One of the
nanoseconds we do not accept is because we need MinInt64 to be used for
some internal comparisons in the TSM engine and it was causing an
underflow when we subtracted one from the minimum time. The second is so
we can have one minimum time that signifies the default minimum that
nobody can write to (so we can implicitly rewrite the timestamp on
aggregate queries) but still use the explicit timestamp if it is given
to us by the user. We aren't able to tell the difference between if the
user provided it or if it was implicit without those values being
different.

If the default minimum time is used with an aggregate query, we rewrite
the time to be the epoch for backwards compatibility since we believe
that's more important than supporting that extra nanosecond.
2016-08-25 12:52:41 -05:00
Ben Johnson 8aa224b22d
reduce memory allocations in index
This commit changes the index to point to index data in the shards
instead of keeping it in-memory on the heap.
2016-08-16 14:09:00 -06:00
Jason Wilder d432aaa84d Fix panic with parsing empty key
Fixes #6990
2016-07-28 18:38:17 -06:00
Jonathan A. Sternberg 8e1b036b0a Modify the max nanosecond time to be one nanosecond less
The highest time represented by a nanosecond needs to be used for an
exclusive range, so the maximum time needs to be one less than the
possible maximum number of nanoseconds representable by an int64 so that
we don't lose a point at that one time.

Previously worked in the open source version because the timestamp used
for finding a shard would be truncated by the retention policy so the
lookup time didn't run into this edge case because it didn't rest on the
truncation boundary. Since that point didn't really belong in that shard
group and was placed there by mistake, it's best to fix this bug since
the timestamp used to create the shard group should be capable of
retrieving it.
2016-06-16 12:15:41 -05:00
Jonathan A. Sternberg 3bd9425edb Fix the point validation parser to identify and sort tags correctly
Fixes #6771.
2016-06-13 09:45:10 -05:00
Jason Wilder 97ad5fd2e6 Add ParseKey benchmark 2016-05-27 10:30:08 -06:00
Edd Robinson f7c7b89b65 Merge pull request #6675 from influxdata/er-future-meta
Ensure meta SHOW queries include future points
2016-05-27 13:02:23 +01:00
Edd Robinson f4fc905fa9 Reject timestamps too far in future 2016-05-27 11:07:48 +01:00
Edd Robinson 46489a5195 Fix vet issue 2016-05-27 10:31:20 +01:00
Edd Robinson 39f3480f28 Ensure points with trailing whitespace are accepted 2016-05-26 19:00:24 +01:00
Jason Wilder aa842fd38f Return error if creating a point would exceed max key length 2016-03-30 23:57:41 -06:00
Joe LeGasse 24bcf46213 Update number scanning edge cases
This should fix #5965, and other issues that result from submitting
malformed numbers with points
2016-03-14 16:48:39 -04:00
Jon Seymour d46e0407a0 Merge #5716
RHS merges cleanly with 0.10.0 maintenance branch.

Signed-off-by: Jon Seymour <jon@wildducktheories.com>
2016-02-20 22:24:03 +11:00
Jon Seymour 9491846047 models: improve handling of points with empty field names or with no fields
Influx does not support fields with empty names or points
with no fields.

NewPoint is changed to validate that all field names are non-empty.

AddField is removed because we now require that all fields are
specified on construction.

NewPointFromByte is changed to return an error if a unmarshaled
binary point does not have any fields.

newFieldsFromBinary is changed to prevent an infinite loop that
can arise while attempting to parse corrupt binary point data.

TestNewPointsWithBytesWithCorruptData is changed to reflect the
change in the behaviour of NewPointFromByte.

Signed-off-by: Jon Seymour <jon@wildducktheories.com>
2016-02-20 22:22:26 +11:00
Jon Seymour bfb361e854 models: add tests for point construction
These tests check that NewPoint and NewPointFromBytes return an error if:

* arguments specify a point with no fields
* arguments specify a point with a field that has an empty name

These tests also check that Point.Fields() always returns, even in the presence
of corrupt binary data read with NewPointFromBytes.

These tests fail at this commit and are fixed by a subsequent commit.

Signed-off-by: Jon Seymour <jon@wildducktheories.com>
2016-02-19 17:58:38 +11:00
Ben Johnson 5a0d1ab7c1 rename influxdb/influxdb to influxdata/influxdb
This commit changes all the import and URL references from:

    github.com/influxdb/influxdb

to:

    github.com/influxdata/influxdb
2016-02-10 10:26:18 -07:00
Edd Robinson 789aff9b23 Fixes #5380 and #5381 2016-01-19 17:10:03 +00:00
Jonathan A. Sternberg 8eac790eab Fix a panic when a tag value was empty
A panic would happen if you wrote the following:
    cpu,host=

There was a missing bounds check when scanning the tag value.

Fixes #5262.
2016-01-16 12:21:32 -05:00
Jonathan A. Sternberg 2994eafc9b Fix scanLine to handle quotes properly
Quotes are handled differently in the line protocol depending on when
they are encountered. Quotes in field values matter, quotes anywhere
else don't.

`scanLine()` didn't understand this difference and treated all quotes
the same as ones for tag values. This resulted in `scanLine()` reading
the wrong amount of data sometimes when quotes were involved.

This fixes #5204.
2015-12-29 14:35:00 -05:00
Jonathan A. Sternberg 4813d82285 Fix the line protocol scanner to read field keys with quotes correctly
Quotes are not supposed to be significant in field keys, but are
significant in field values. The code as it currently was would
consider quotes in a key to be significant, but the later parser that
would unmarshal the fields from the byte string did not consider those
quotes to be significant. This meant that the following string:

    "a=1

The line protocol parser would see a mismatched quote instead of a valid
input to the line protocol. But more nefariously, the following string:

    "a=1"=2

The line protocol parser would ignore the first equals since it is
located in the quotation marks and think this was a valid input. It
would then pass it on to the field parser who would panic and die when
it tried to parse `1"=2` as a number.

Fixes #4076.
2015-12-23 09:14:28 -05:00
Nathaniel Cook eb080785d4 add bounds checking for shard group timestamps
enforce strict valid time ranges on points

small
2015-12-09 13:07:13 -07:00
Edd Robinson 4b5eb30876 Add extra test cases. 2015-11-20 11:01:23 +00:00
Edd Robinson 7ce385ff18 Improve scanning performance 2015-11-20 01:41:25 +00:00
Edd Robinson c6536b6769 Add extra test coverage; fix test typo 2015-11-20 01:26:21 +00:00
Edd Robinson 98b8d7d9fa Improve robustness of tests, highlighting #3070 and #4770 2015-11-20 01:26:21 +00:00
CrazyJvm 6e60e3226a check point without fields when NewPoint 2015-11-17 13:21:52 +08:00
Cameron Sparr e2db577e0f Implement a UDP client
closes #4647
2015-11-04 14:18:14 -07:00
Jason Wilder 78086cfa08 Merge pull request #4596 from ch33hau/models_point_skip_empty_string
skip empty string for start position
2015-10-28 19:15:03 -06:00
ch33hau f13af15e71 skip empty string for start position 2015-10-29 02:28:48 +08:00
Jason Wilder 0926b19e6b Prevent creating points with NaN float values
Float values are not supported in the existing engine and the tsm1
engines.  This changes NewPoint to return an error if a field value
contains a NaN field.  It also allows us to validate fields to prevent
other unsupported types from sneaking in through other input plugins.
2015-10-27 17:12:52 -06:00
Jason Wilder c874e48406 Return parse error for NaN float values
Not currently supported.
2015-10-27 16:50:56 -06:00
gunnaraasen 859d2a46e8 Add test for 1- timestamp 2015-10-19 13:06:13 -07:00
gunnaraasen 3244d3f213 Handle negative timestamps 2015-10-19 12:36:28 -07:00
Charles Chan 456a9a8ab7 Fix typos.
* meaining --> meaning
* communcation --> communication
* deterimine --> determine
* mistmatch --> mistmatch
2015-10-17 07:50:45 -07:00
Sean Beckett cbb7e3cbbd Update points_test.go 2015-10-13 16:53:50 -07:00
Sean Beckett 2100c1459c Update points_test.go 2015-10-13 16:46:23 -07:00
Philip O'Toole ea3ecc733e Remove superfluous blank lines 2015-10-13 14:22:09 -07:00
Philip O'Toole 16580d32a7 Allow uppercase 'e' with scientific notation 2015-10-13 13:30:21 -07:00