Introduce pooling of KernelTransactions.
Resolve two race conditions relating to HA lock sessions

- Adds a check ensuring a slave commit has a running lock session when committing,
  or has explicitly opted out from having one.

- Moves lock session management into its own class, where timeouts and concurrent
  access can be tested in isolation.
Revert the change which adds count values in the state on read

- it is indeed better to delegate the caching to the page cache used in the CountStore
- having less values in the in-memory state will also make the sorting much faster when we need to merge them
  with the one on disk
Increase key-value record size to 16 + 16 bytes

- change node and relationship key encoding to write a type byte
- extract CountsStoreWriter and added tests
- fix a bug in the binary search when reading entries ordered by key
Stop visiting records when reading an empty one from the page
Add tests for CountsStore
Extract record serialization outside the CountsStore

Now the CountsStore accept generic keys
Change CountsStore.get to accept a register rather than returining a long
Make the counts store generic on values type
CountsStore takes a WriterFactory rather than creating a specific CountsStoreWriter
Repackaging to separate the concepts of KVStore and CountsStore

- revisit KeyValueRecordVisitor to be generic
- the specific CountsStore visitors uses registers rather than passing aroung longs
Fix a page cache bug that can lead to lost updates

The problem was in the MuninnPageCache#evictPages method, in that we released
the write lock on the newly evicted page before we attempted to grab the write
lock on the translation table, for removing the evicted page. This left open a
window where another thread can do a look-up in the translation table, observe
the page that we have just evicted, complete a page fault, and then the
eviction thread would get the lock on the translation table and remove the page
that was just faulted in. This is the bug.
Later, another thread would find that the translation table does not have an
entry for the page it wants, so it faults it in. Now we have two cache pages
that are bound to the same file pages. If both are written two, then one will
overwrite the other when they are evicted. This is the symptom we observed in
our tests.
Increase the potential parallelism of page faulting

... by releasing the write lock on the translation table sooner. This way,
other page faults to the same stripe can proceed, while page faults and lookups
for the specific page will wait like they've always done. Except now they're
waiting on the lock on the page itself, instead of waiting on the lock for the
translation table. We ensure this by grabbing the write lock on the page we are
faulting into, before we add it to the translation table and release the lock
on the translation table.
Merge pull request #3254 from davidegrohmann/2.2-ref-counts-store

[2.2] Counts Store refactor to be based on a generic KV-Store
Re-enables parallel I/O in batch importer
Add additional tests for X-Forwarded-Host

Against Cypher REST response, and slash redirects
Changed the code so that the transactional endpoint creates URIs based on the request URI (rather than the server's URI). This is better (the server doesn't usually know it's own URI, whereas clients do) and enables X-Forward headers to work, fixing the problem identified in https://gist.github.com/albertoperdomo/6f3d7ffcb1351e5c61ce

However, /db/data and /db/manage (note: no trailing slashes) are not fixed here. That is a different bit of code to tame.
Merge pull request #3191 from jakewins/2.2-slavesessions

[2.2] Resolve two race conditions relating to HA lock sessions
Reduces contention in ArrayQueueOutOfOrderSequence#get

by removing synchronized on the method and letting the member variable
containing the high id by volatile.
Make Rewriter a total function (AnyRef => AnyRef) rather than (AnyRef => Option[AnyRef])

In practice, some combinators already made assumptions about it being the case.
There doesn't seem to be a benefit for the partiality other than a short-circuit in repeat().
However, we rely on identity equality to be roughly as performant as a runtime check
for whether Option[AnyRef] is Some(_) or None.