Split ConnectionManager exception types into unknown, closed, reset and timeout
for greater detail into problems

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add "tsd.storage.hbase.tree_table" config parameter

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add tree table variable, check and getter to TSDB

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify all tree related code to use the new tree table instead of forcing
multiple rows of data in the UID table. This will improve scan performance
across TSUIDs

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add tsdb-tree to the create_table.sh script

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add "store_failures" option to trees so that we can avoid writing potentially
massively wide rows unless the user explicitly wants to. Collisions and not
matched rows will still be logged.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix TreeSync error where it was scanning the tree table instead of the UID table
Fix suppressed exception in TreeSync where the Deferreds were swallowing HBase
exceptions and running forever.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add bloomfilter option to the UID table in create_table.sh

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Split the TreeSync CLI command into threads for quicker completion.
Modify TreeSync to log exceptions on particular TSUIDs instead of killing the
entire thread.
Modify "uid fsck" CLI to skip meta data entries

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add backlog option to the TSD so that the user can adjust the connection queue
depth.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add /api/config endpoint to show the running configuration of the TSD

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add "tsd.http.request.cors_domains" config parameter for CORS requests,
defaults to an empty string that disables CORS behavior.
Add CORS processing to RpcHandler. On creation, the class will parse the
CORS domain list from the config. Once loaded, when a request comes in with
an "Origin" header or using the "Options" method, the given domain will be
compared against the list and if matched, the proper header appended to the
response. If the domain does not match, a 200 response with an error message
will be returned immediately. See http://www.w3.org/TR/cors/
This isn't a complete, full featured implementation. It only handles the most
common tasks required by CORS.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Encode integer values on a variable number of bytes.

The design always supported this, and the read-path already supports
reading those, but the write path never really bothered and always
wrote all integer values on 8 bytes no matter what.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add an API to store double-precision floating point values.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix compaction bug: flush compaction queue if it's too old.

The compaction queue needs to be flushed if either it's grown too
large or it's been too long since the last flush.  That second
condition wasn't implemented properly because the timestamp that
tracks the time at which we last flushed was never set and always
remained 0.  This would only impact very low-traffic TSDs that
never manage to exceed the threshold on the size of the queue.

Thanks to Brent Evans for spotting and reporting this bug.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Simplify the condition under which we flush the compaction queue.

This code is equivalent to what we had before.  Given the constants
in the code, we were only flushing based on the queue size when one
of those two conditions was true:
  - The size of the queue is bigger than 100
  - The size of the queue is bigger than 18000
Which obviously can be simplified as checking only against 100.

Thanks to Brent Evans for pointing this out.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Don't bother flushing the compaction queue based on time.

If someone is writing to less than 100 rows ever then compactions
probably don't actually matter (and can always happen lazily during
read accesses).

Thanks to Brent Evans for the suggestion.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Unicode letters is supported for metric names and tag names/values.
Current whitelisted symbols: letter, digit, dash, underscore symbol, dot symbol, forward slash.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix TSDB.addPoint() unit tests for variable length encoding

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add tsdb-meta table to create_table.sh

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>