cockroachdb/cockroach — pull request #192 by spencerkimball (2014-12-01 23:42:29+00:00)
Title: Introduce iterator to Engine interface, reimplement MVCCScan.

Added a vanilla iterator interface to engine for greater flexibility.
We now use the iterator for implementation of Engine.Iterate on both
RocksDB and Batch.

MVCCScan now uses a single iterator and invokes Iterator::Seek instead
of creating a new iterator at every step. This seems to speed up the
scan when benchmarked by roughly a factor of 2x. Benchmark timings are
here: https://docs.google.com/spreadsheets/d/1g8WTySNHLOQr-l0WDlbzkr-2h9dZj2bVrsW7yyJtw3Y/edit?usp=sharing

In the process of writing 100s of MB of data, discovered problems when
calling into go from C++ using an unsafe pointer of an object which
shouldn't have been GC'd. After poking around at it for a while and
not finding the problem, I decided to change the implementation so
that we no longer pass in a pointer to our Go struct. This appears to
have fixed the problems.