Handle duplicate timestamps

Duplicate timestamps are handled automatically with last-written wins.
In addition, the compaction code is cleaned up and unified - instead of
having separate code paths for trivial and complex compactions, there is
only one code path.  However, it is faster than the trivial path was
before, particularly for large rows.