Switched tests to use the new planner.
Rename setEstimatedCardinality to withEstimatedCardinality
Merge pull request #3162 from pontusmelke/change-tests-to-newplanner

[2.2] Change tests to use new planner
Ability to persist counts durably.

The `rotate()` method of the CountsTracker will read from the current
CountsStore and write to the other CountsStore before making that one
the current. The intention is to invoke rotation of the counts store
when the log rotates, so that the counts store will be kept consistent
even though the commands in the log only contain deltas to apply to the
counts store.

By persisting durably on log rotation only, we will simply restart from
last point-of-rotation if we need to perform recovery on startup.

As of this commit the persisting of counts has not been wired in to the
rest of the database.
Circumvent the PageCache for (stream) reading.

Since the PageCache only supports one cursor per thread, we cannot both
read through the PageCache and write through the PageCache when rotating
the CountsStore. As a workaround we read directly from the file system
when streaming through the source file during rotation.

By not using a cursor when visiting all counts in a store, we gain the
ability to do "self-verification" of the store. Since cursors are pooled
per thread (each thread has a read cursor and a write cursor that it
reuses) the code would become harder to follow if we were to allow doing
`get()` on the store while visiting it, since we would need to find and
reuse the same cursor. As of this change we no longer use cursors when
visiting the store, so we are now able to invoke `get()` from the visitor
and thereby verifying that all values that the visitor sees can also be
looked up from the store.
Integrate persisting counts durably.

Wires in the rotation of the counts store on transaction log rotation.
(Re)Builds the counts store at the end of a batch insert session.
Add test for checking CountsStore rotation

- expose total number of records written
- avoid returning a record if the count is zero
Rename CountStoreApplier to CountsStoreApplier
Avoid applying commands in recovery if they belongs to a transaction with id leq than the last tx id in the CountsStore
Add a FreshCountsStoreCreator that will be used to construct a counts store for an old database
Create a new CountsStore when migrating [BROKEN]