Tweak for number of files opened by Lucene
Made DistinctPipe into a RonjaPipe
Allow Ronja to use lazy distinct when possible
Make the page cache cope well with AsynchronousCloseExceptions

It was possible for a stray interrupt to hit the page cache while in the middle
of a page fault. Such interrupts can cause the victim FileChannel to be closed,
leaving the page cache with a closed StoreChannel without its consent. This can
then cause further complications later on, because PagedFiles are flushed
before they are closed, and so the flushing can throw a ClosedChannelException
and in the end prevent the page cache from being able to shut down.

We now handle this much better, by making sure that the PageSwappers reopen
their StoreChannels whenever one the swapIn or swapOut methods throws a
ClosedChannelException. That is, unless the PageSwapper has been explicitly
closed.
Don't reuse HashMaps for transaction state if they've grown too big

HashMaps that are big use up a lot of memory and take a long time to clear for
reusing.
Ensures that Relationship commands in upgraded logs have proper first in chain flags

Previously upgraded logs would simply copy over relationships commands, leaving
 default values for the firstInFirstChain and firstInSecondChain fields. This
 could result in pointer chasing errors if these transactions were applied to an
 otherwise properly upgraded store, a scenario that comes up in backup. In
 particular, backup will copy the store and then the upgraded transactions,
 which would update the relevant relationship records to have
 wrong values for those flags, affecting pointer following.
 This commit checks if the currently transferred LogEntry holds
 a RelationshipCommand and if so it sets up the first in chain flags
 properly.
This approach, while improving on the problem, does not completely solve it.
 While the pointers will be interpreted correctly, the first record in a
 relationship chain will still have its previous pointer set to -1, which
 will overwrite the current value that represents the relationship count
 for this chain. This issue affects backups that are created
 immediately after an upgrade from 1.9 or 2.0.
Merge pull request #3290 from digitalstain/2.2-fix-log-upgrade

[2.2] Ensures that Relationship commands in upgraded logs have proper first in chain flags
Merge pull request #3292 from systay/lazy-distinct

[2.2] Lazy distinct for Ronja
Remove println in test
Merge pull request #3276 from lutovich/2.1-reduce-number-of-opened-files

[2.1] Tweak for number of files opened by Lucene
Tweak for number of files opened by Lucene
Merge pull request #3294 from chrisvest/2.2-async-close

[2.2] Make the page cache cope well with AsynchronousCloseExceptions
Merge pull request #3302 from lutovich/2.1-reduce-number-of-opened-files

Tweak for number of files opened by Lucene
Merge branch '2.1-maint'
Merge pull request #3301 from chrisvest/2.2-recordchanges-close

[2.2] Don't reuse HashMaps for transaction state if they've grown too big
Cheaper way of telling wether or not a RecordState has changes
Defers creation of header information until commit if there are changes
Defers LockGroup creation until we see that there are changes to commit
Reuses tx state --> record state visitor
Reuses command list for extracted commands