Relaxed timeouts in metrics test to avoid spurious failures
in 'make racetest' on travis CI.
Merge pull request #95 from cockroachdb/spencerkimball/metrics_test

Relaxed timeouts in metrics test to avoid spurious failures
A test framework for verifying concurrency anomalies

Introduced a new framework in kv/txn_db_test.go which makes it relatively
easy to construct transaction histories and then play out every possible
enumeration of priorities, isolation levels and interleavings of txn
commands. The resulting database state can then be checked for evidence
of concurrency anomalies.

This is now used to check that Cockroach's SI and SSI implementations
do not exhibit common anomolies: lost updates, inconsistent analysis,
phantom reads, and phantom deletes. Further, it verifies that the SSI
implementation does not exhibit write skew and that the SI implementation
does.

This unittest framework discovered a great many edge cases which were
bugs and also various performance issues. So it was pretty successful
by that metric. Will be adding tests to this file over the course of
the next few months. There are several other anomalies worth testing.
Also, I'd like to verify we avoid starvation scenarios.

Some additional changes:

 - Gave the retry/backoff harness an ability to reset itself via a
   RetryStatus instead of just returning a bool.
 - Gave retry/backoff random jitter to avoid synchronization of
   degenerate behavior amongst concurrent actors.
 - Eliminate immediate initial heartbeat on transaction; most txns
   will finish long before they need to heartbeat to be kept alive,
   so this saves some unnecessary traffic.
 - Created a new storage.BaseDB class which eliminated a duplicate
   implementation of storage.DB and made it much simpler to wrap
   a database -- we needed this to correctly implement kv.TxnDB,
   but it had the side benefit of eliminating the pedantic
   storage.testDB implementation.
 - Pretty much complete overhaul of 1st cut of kv.TxnDB. Lots of bug
   fixes, better layering to support the test harness, and better
   comments.
 - Added a Transaction.Name field to the proto for better debugging.
 - Added Transaction.Restart to localize all adjustments necessary
   to restart a transaction in-situ. This avoid leaking these details
   into multiple places in the code.
 - Added Timestamp and Transaction String() methods for debugging.
 - Gave timestamp cache entries knowledge of whether the entry is
   for read-only or read-write commands. This is crucial to handling
   abort on writes-too-old errors while still handling the case of
   a DeleteRange affecting the timestamp cache.
 - Check whether or not methods being executed in Range deserve to
   use the timestamp cache--only "real" db methods should. The others
   (e.g. push transaction, etc.) were just wasting space there.
remove echo from Makefile
Address review feedback
Fix testrace issues, move correctness tests into a new file with race testing disabled
Increase timeout due to new correctness checking
Increase timeout due to new correctness checking
Increase timeout due to new correctness checking
Increase timeout due to new correctness checking
Found several bugs contributing to travis failures. In particular,
we weren't previously deleting write intents aggressively, but once
that was enabled, it exposed a new bug where we weren't keeping a higher
epoch when ending a transaction. Fixed that bug and added a unittest.

Further, discovered that the enumeration of isolation types was
incorrect except for the case of enumerating both isolations. For just
one, it would stupidly do all four--this was slowing the tests down.
We can now run race on the correctness tests.

Finally, reorg'd the code in the correctness test so it makes a little
more logical sense in terms of layout. This shows as a big change, but
really nothing changed.
added post-checkout hook, merged with metrics test update
Merge pull request #83 from cockroachdb/spencerkimball/concurrency-anomalies

A test framework for verifying concurrency anomalies
Add ApproximateSize() method to Engine

Commit adds ApproximateSize() method on the Engine interface, designed to
utilize the GetApproximateSize() method of the rocksdb engine.

+ Implemented in both rocksdb and inMem Engine structs
+ Adds compression-aware test for the method.
Merge pull request #96 from cockroachdb/mtracy/approximate_size

Add ApproximateSize() method to Engine
Added simple offset measurement between two connected nodes