Fixes #328

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix #342 where compacted millisecond columns were throwing errors during an
fsck when they shouldn't have been. Also add some unit tests to validate the
fix.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix #343 where the flags were inverted when checking for the http directories

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix for #346 where removing a pending assignment was not synchronized.
Thanks @pkwarren

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Align the start of downsampling
Aligned the start time of downsampling by the given downsampling interval
so that the same set of data points belongs to the same downsampling period
regardless of the start time of a user-requested time range.
- Made the start time of a downsampling period its representative timestamp
  without computing the average of the timestamps of the data points of the
  period.
- Factored downsampling code out from Span.java to its own class to make it
  easier to write unit tests.
- Made the type of downsampling result double regardless of the original type
  to get rid of the loop that checked the type of the raw input data points.
  By using double, we could handle very small integers and very big integers
  within a reasonable error margin. Some values are too small to round off.
  For example, the integer average of four values (2, 2, 2, 1) is 1, which is
  far from the real average of 1.75. Some values are so big that it could
  cause long-integer overflow while downsampling.
- Factored out the piece of code that computes the rate of changes to make
  it easier to understand and test.
- Factored out the piece of code that iterates over a list of spans to aggregate.
- Added unit tests against the AggregationIter class.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Refactor Downsampler to avoid the MutableDataPoint class and reduce method
calls.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify MutableDataPoint.java to store a long or a double encoded as a long to
save a primitive that won't be used.
Rename MutableDataPoint.resetWithLongValue() and resetWithDoubleValue() to
reset().
Remove MutableDoubleDataPoint.java as it's redundant.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix SeekableViewsForTest to handle the reset(long, double) overload properly

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Flatten RateSpan for efficiency.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix #139 by flushing the compaction queue first if compactions were enabled
and then the HBase client.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add auto_tagk and auto_tagv fields to the Config class along with defaults
(to true for both) in preparation for #331.
Create Config.loadStaticVariables() to load the static variables whenever a
config value changes. Now overrideConfig() will reload the statics.
Change setAutoMetric() so that it will update the hash map with the given value
in case users access the config from the GUI and have toggled the flag via CLI.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify Tags.resolveAllInternal() to use the new config flags to allow or block
UID assignment for tagks and tagvs. This fixes #331.
Also add unit tests for the UID creation.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add a TSDB constructor with a pre-initialized HBase client.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Add two config options: tsd.mode and tsd.no_diediedie

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Compare strings using equals

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add a simple travis configuration

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Merge branch 'master' into next
Preload uid caches at startup.

Preload uid caches at startup to reduce the latency of fetching many tags for
many spans at query time.
New behavior can be enabled by changing opentsdb.conf:
    # preload uid cache at startup
    tsd.core.preload_uid_cache = true

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Cleanup #326 a bit. Build a map of the UniqueId caches in TSDB and pass that
to the pre-loader instead of building a list then a map.
Pass the TSDB object to the pre-loader and use the config to load the max
results.
Fix naming of UniqueId.preloadUidCache().
Remove the named scope from the pre-load loop and use the row count instead.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add column timestamp support in MockBase. It will now store values with a
monotonically increasing timestamp or use a timestamp supplied by the
caller. It will return the latest column value in the same way HBase does
by default. Future updates should include support for returning multiple
values. But this is good enough for testing issues like duplicate data
points.

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