Test db->mc only once and store result on stack.

This reduces the possibility of race conditions in multi threaded
client code, where one thread opens a cursor while another thread
operates on the DB without cursors. In that case, db->mc changes
in the middle of the operation.

This is a quick workaround, the correct fix is to either remove this
optimization or protect the db structure with a mutex.
Merge pull request #1673 from vohi/mitigate_racecondition

Test db->mc only once and store result on stack.
Remove all transaction sharing code between cursor and regular updates.

Modifying the db structure makes the individual functions non-reentrant,
and can cause race conditions and data corruptions in multi threaded
programs, such as cf-serverd.
Merge pull request #1674 from vohi/mitigate_racecondition

Remove all transaction sharing code between cursor and regular updates.
Initialize the global transaction to null at initialization.

Otherwise, we have an uninitialized pointer in case of error.
Also abort the opening transaction in case of error.

No need to reset the pointer on the stack at end of function.
Disable irrelevant migration tests for LMDB builds.