Start of transaction interceptor for 2.0->2.1 rolling upgrade

o Refactorings for injection of interceptor
o Start of the interceptor and a decent test setup for it
Merge branch 'master' into 2.1-rolling-upgrade
Merge branch 'master' into 2.1-rolling-upgrade
Adds basic tests for slave transaction rewriting, disabled
First wave of refactorings disentangling Commands from operations on them

This is the first in a series of commits refactoring how commands are
 read, written and executed and how transactions are deserialized and
 rewritten. The immediate usability of this is rolling upgrades. However,
 this is not complete, still lacking proper method names in places and some
 wires hanging out. Must be polished before merging.

Neo store Commands no longer carry the responsibility of reading, writing and
 executing themselves. Instead, this is now moved to XaCommandReader, XaCommandWriter
 and XaCommandExecutor classes which can implement whichever way is necessary to go
 about their task. Currently there is only one, which is what the Command
 subclasses did on their own.
Commands no longer need to be created in each usage, although they currently are. An
 init() call can bind it to a proper context, allowing future pooling of Command objects,
 or even having just a single one passed around.
XaLogicalLog now requires and uses factories for the command reader and command writer
 to use, since eventually that will be provided from the outside so rolling upgrades
 can work. The factory is necessary since the LogExtractor must use a separate
 scratch buffer.
Transaction reading and writing from XaLogicalLog now happens through a LogReader/LogWriter
 pair which can accept different handlers, abstracting operations in a way that allows
 for random rewriting of incoming or outgoing transactions. This way, master and slave
 operations are practically the same except that they set a different handler in each case.
Merge branch 'master' into 2.1-rolling-upgrade

Conflicts:
	community/kernel/src/test/java/org/neo4j/test/LogTestUtils.java
Introduces log entry reading/writing versioning and a Cursor abstraction

Removed LogIoUtils, instead having separate classes that do the reading
 and writing of log entries. The reason is that we need to have versioned
 log entries to enable rolling upgrades when the log format changes.
Logical log reading and iteration over entries happens in its own class,
 LogDeserializer. This class will be responsible for recognizing
 log entry versions and use the appropriate reader.
LogReader now returns a Cursor that accepts a Consumer. This pattern
 allows for controlling the flow of log entries from the caller
 while leaving the responsibility of the iteration with the
 LogReader. This change causes ripples all over the code base since we
 did all iteration by hand by using static methods in LogIoUtils.
LogEntry instances now have a type field which allows for switching
 on them instead of instanceof checks.
LogExtractor now also exposes a Cursor over an extracted transaction
Merge branch 'master' into 2.1-rolling-upgrade

Conflicts:
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/TransactionWriter.java
	enterprise/consistency-check/src/test/java/org/neo4j/consistency/checking/GraphStoreFixture.java
Another round of refactorings, to allow for versioned command reading

LogDeserializers delegate the version read to the VersionAwareLogEntryReader
LogEntries carry a version field
LogDeserializers no longer require a CommandReader - they require a
 CommandReaderFactory that knows about versions
CommandReaderFactory must now know about versions
LuceneXaCommandFactory no longer depends on LuceneDataSource
Merge branch 'master' into 2.1-rolling-upgrade

Conflicts:
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/Command.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/NeoStoreTransaction.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/NeoStoreXaDataSource.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/LogExtractor.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/LogIoUtils.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/PartialTransactionCopier.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/XaLogicalLog.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/util/DumpLogicalLog.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/index/TestIndexCommand.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/nioneo/xa/LogTruncationTest.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/nioneo/xa/NeoStoreTransactionTest.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/TestXaFramework.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/LogMatchers.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/TestLogPruneStrategy.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/TestPartialTransactionCopier.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/TestTxTimestamps.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/XaLogicalLogTest.java
	community/kernel/src/test/java/org/neo4j/test/LogTestUtils.java
	community/lucene-index/src/main/java/org/neo4j/index/impl/lucene/LuceneDataSource.java
	enterprise/backup/src/main/java/org/neo4j/backup/BackupService.java
	enterprise/cluster/src/main/java/org/neo4j/cluster/statemachine/StateTransitionLogger.java
First set of changes needed to rewrite entries on the fly

Introduces Command reader for previous version commands
CommandReaderFactory is aware of entry version and returns the appropriate
 command reader. Currently not pooled but should be.
LogEntryConsumer is now aware of entry versions and keeps them
 around if they are of previous versions, so it can translate them.
The DenseNodeTransactionInterceptor now works for adding and removing
 relationships. There is still work to do, but all changes but
 adding/removing properties and labels should work.
Merge branch 'master' into 2.1-rolling-upgrade
LogEntry translation now also respects Property changes

Introduces RecordChanges.setTo so that whole record entries can be set,
 avoiding the need to go over each field for incoming records
Moves away from instanceof checks in DenseNodeTransactionInterceptor and
 instead uses a visitor for the same purpose
RelationshipGroups are no longer kept around when empty. Updates
 tests to reflect that.
Fixed Cypher tests that depended on list order, when set is enough
Renamed and refactored DenseNodeTransactionTranslator
Created Lucene translator that just upgrades the version number
Wired in the translators
Merge branch 'master' into 2.1-rolling-upgrade

Conflicts:
	community/kernel/src/main/java/org/neo4j/kernel/InternalAbstractGraphDatabase.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/Command.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/NeoStoreTransaction.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/nioneo/xa/NeoStoreXaDataSource.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/InterceptingXaLogicalLog.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/LogEntry.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/NoOpLogicalLog.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/XaFactory.java
	community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/xaframework/XaLogicalLog.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/nioneo/xa/LogTruncationTest.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/nioneo/xa/NeoStoreTransactionTest.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/TestXaFramework.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/LogBackedXaDataSourceLogBufferFactoryTest.java
	community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/xaframework/XaLogicalLogTest.java
	community/neo4j/src/test/java/recovery/TestRecoveryVerification.java
	enterprise/consistency-check/src/test/java/org/neo4j/consistency/checking/full/FullCheckIntegrationTest.java
Fixes issue with role election in cluster

Introduces tests and fixes for some edge cases that role election
 may come up against
Votes received that are actually delayed responses from a previous
 election could lead to wrong results. This is now guarded against
 by having versions marking elections and vote requests/responses
Election results could be reordered if one would fail to be
 broadcasted. Now this is guarded against by an election epoch, allowing
 election results to be ignored.
Instance and vote count could become wrong if an instance voted
 and then was marked as failed before the election finished. That could
 lead to cases where the role holder was not asked for a vote. Now,
 ElectionContext registers as a HeartbeatListener and will invalidate
 votes of instances that have failed.
This is added with backwards compatibility, so elections initiated by
 previous version instances will still go through and receive proper
 responses.
Fixes RelationshipGroupCommand serialization and adds some tests
Merge branch 'master' into 2.1-rolling-upgrade

Conflicts:
	enterprise/ha/src/main/java/org/neo4j/kernel/ha/cluster/HighAvailabilityModeSwitcher.java
Introduces handling of records that are not interesting for rolling upgrades

While nodes and relationships should be handled specially, the rest of the
 records that can be present in a transaction should be passed as is. This
 commit takes care of that, along with tests.
Fixes node record management to allow for changes in labels and properties
 without any other changes in the transaction. Tests for those, as well as
 some necessary test harness.
Merge branch 'master' into 2.1-rolling-upgrade