Don't use Read/WriteDB inside a cursor loop.

LMDB doesn't allow multiple transactions per thread. Opening a cursor
opens a transaction, and so does Read/WriteDB. So, either re-use values
from cursor, or populate a sequence with keys, and then lookup the
individual values in a separate loop.

Note: Previously, the WriteDB code reused the transaction from an open
cursor, but that is making the entire LMDB driver not thread-safe.

(cherry picked from commit 683df34e32c822e6d26dd4c5cc562881269acd6a)
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.

(cherry picked from commit 48a63e90bf635e78081da97ac61d24f4b5710e65)
Disable irrelevant migration tests for LMDB builds.

(cherry picked from commit fce7530cfa0e5ea1fdc3787f9817fa09d9f7fadb)

These tests fail because the used functions use WriteDB inside
a cursor loop. This opens two transactions at the same time, which
LMDB doesn't allow - the result is a deadlock after removing
transaction sharing between cursors and WriteDB calls.

Since LMDB was introduced in 3.6, the migration code won't work
anyway - the old database would be a TCDB database.