Fixes an issue with high id being too high after recovery

due to giving the IdGenerator the wrong highId in its constructor. It used
to give it fileSize/recordSize, but now gives it the highest inUse record id.

Also deduplicated 3 versions of rebuildIdGenerator, 2 versions of
figureOutHighestIdInUse (which was badly named btw) and some other
deduplication.
Merge pull request #3095 from tinwelint/1.9-fix-too-high-id

[1.9] Fixes an issue with high id being too high after recovery
Fixes issue recognizing inUse of dynamic record

the check looked at the whole upper nibble of the inUse byte and expected
it to == 1, which means that it would not recognize it as inUse if any
other bit in that nibble was set.
Only reserve ids in reltype store, no other token store

since they just weren't built for it.
A tool for shuffling log entries

This tool can be used to read a log file and produce an equivalent log file with shuffled entries.
Indeed it still guarantees that the commits are ordered wrt transaction id.
Merge pull request #3148 from davidegrohmann/1.9-log-entry-shuffler

[1.9] A tool for shuffling log entries
Solves issue with election results from a rejoining elector being dropped

Previously, the elector version would not be reset when the elector left
 the cluster or it failed for some reason. The result was that
 the election results from that elector, which presumably would lose
 state and start counting election versions from 1, would be dropped
 by receivers since the version is now smaller than what they expected.
 This patch solves this by having all instances invalidate the known
 elector when it leaves the cluster or is marked as failed
Updates changelogs for 1.9.9
Merge pull request #3163 from digitalstain/1.9-fix-versioned-election

[1.9] Solves issue with election results from a rejoining elector being dropped
Fix compilation error
Removes unecessary console output from tests
Fixes autoindexer issue with excessive Remove commands for property changes

The autoindexer provided the "facility" of lazily removing properties from the
 autoindex when those properties were removed from the list of properties
 to autoindex. This however led to Remove commands to be issued for all
 remove and set calls on all properties no matter if they should be tracked
 or not, as long as auto indexing was enabled. It would do so moreover
 for every such call in a transaction.
This patch reverts this behaviour (and updates the documentation) to
 not dealing at all with properties that are removed from the list
 of auto indexed properties.
[1.9] Backup tool should exit with error if consistency check fails.

A failed consistency check is now transported all the way up to the user with
a print and the return code is 1.
Merge pull request #3170 from martinfurmanski/1.9-backup-tool-should-report-consistency-error

[1.9] Backup tool should exit with error if consistency check fails.
[1.9] Fix backup service incorrectly initializing new log with -1 as previous txId.

The backup service receives a transaction (the last one) and should initialize
the log header with its txId minus one.
Merge pull request #3206 from martinfurmanski/1.9-backup-incorrect-log-header-previous-txid

[1.9] Fix backup service incorrectly initializing new log with -1 txId.
Slave goes through 'switchToSlave' process on every 'masterIsElected' event
CappedOperation does not trigger on first time event

Previously, a CappedOperation was triggered the first event regardless of
which triggered were specified. This was unexpected and counter intuitive,
especially for cases (where it is most used) where a CappedOperation was
added as a time-based logger and a log statement was expected to be
printed after the specified threshold, it would log immediately as well.
Removes console output from GraphDatabaseServiceTest
Fixes XaLogicalLog shutdown issue

XaLogicalLog.close() was flushing the store files after
 marking the active log file as applied. This could
 lead to recovery not happening if shutdown
 failed within a narrow window between log
 shutdown and store flush. This is now fixed.
The LogBackedXaDatasource defined a stop() method that
 managed log lifecycle without having to. This is now
 removed and log lifecycle control is delegated to
 subclasses through XaContainer.