Don't rely on some non-portable shell substitutions.

According to Autoconf's manual, ${var##word} is required by POSIX but
doesn't work on Solaris 10's retarded /bin/sh.

Change-Id: I21d385e11ae002f4f32453b9d73bfcb9b4c1149c
Quote some shell variable values.

Change-Id: I2b2e30487aa9dd32a1dbc3a1da268aeb94f39148
Upgrade to asynchbase 1.3.2.

Change-Id: I2c677fbb7a4da2c9d129c9ee56082a05c5088cb9
Upgrade to Netty 3.5.2.

Change-Id: I2723644bd9193aac6430445744ed78e4da773e0a
Add a `getHash' method to DataPoints and Query.

This allows the code to quickly hash those objects, which will be used
for improved caching.  We don't override Java's built-in `hashCode'
method because it only returns a 32-bit hash.  Here we use 64 bits.

Change-Id: I928c310e739aa4ac0e149ce4f2de79f055d2f613
Significantly improve query caching.

This change contains public API changes.
This change completely invalidates any existing TSD cache.  It is
recommended (but not required) to purge it before restarting the TSD.

Previously, only 2 exactly identical queries would lead to a disk cache
hit.  If any aesthetic parameter changed (such as changing some style
setting), the TSD would retrieve the data points again from HBase and
store them twice in the disk cache.  This was because the entire query
was hashed and this was used as the key in the cache.  Any change, even
if not relevant to the data to retrieve, led to a different cache key.

Now each time series retrieved from HBase is stored in a file using its
own cache key.  We now store an extra file in the cache, a `.map' file,
that associates the hash of the query to the hashes of the time series
matched by that query.  When a new query comes in, we hash it and check
to see if we already saw that query.  Note that unlike the previous code
we don't hash the aesthetic aspects of the query, only what is relevant
to the data points returned by the query.  If there's a cache hit, we
simply generate a new Gnuplot script and re-use the already cached time
series data.  The cache hit could also be partial, where the user is
requesting data for say 3 time series and we already have the cached
results for 2 of them.  In this case we scan HBase only for the 3rd
query for which we don't have cached results.

The bottom line of this change is that little aesthetic customizations
in the UI are almost free, because now the TSD no longer scans HBase
again, it only runs Gnuplot again.

Public API changes:
  - graph.Plot.dumpToFiles(String) has been replaced with
    graph.Plot.dumpToFiles(String, String)
  - graph.Plot.add(DataPoints, String) has been replaced with
    graph.Plot.add(DataPoints, long, String)

Since I don't believe anyone wrote code against those APIs, and since
OpenTSDB is still beta software, I'm taking the liberty to change these
public APIs without starting to carry the @Deprecated burden.

This change also modifies the on-disk layout of the cache to use the
common 2-directory level hierarchy where each level has up to 256
directories `00' through `FF'.  Directories are created lazily.  And
in addition to this change, hashes used as cache keys are now all on
64 bits (vs 32 bits previously), which helps prevent collisions.

Change-Id: Icdda5036a7383b99f5ced9b43bb9a5233322d0f5