Redmine #5763: Regenerate plucked.cf.sub with "make pluck".

(Following 060a5050835ecfe27cef5a0db30be7d6bc19cda3 in master).
Add assert against mixing cursor and regular DB calls.

Only active in debug mode.
(cherry picked from commit a73669c1afd4da1db3c9ed8310416bb2f072547e)

Strictly cherry-picked to make the next cherry-pick conflictless.
Rewrite transaction handling for LMDB.

The old transaction handling had numerous problems:

  1. It was slow, because we open a new transaction for every single
     read/write. Especially writes would cause fsync() which is very
     I/O intensive.

  2. It was not thread safe, due to the way that transactions were
     handled when using DBWriteNoCommit. The transaction was stored
     in a globally shared structure.

After the rewrite, we store a pthread key in the global structure
instead, and use Thread Local Storage to keep the transaction pointer.
This has the added advantage of reusing the same transaction for
cursors, which means that cursors and regular DB calls can now be
mixed in LMDB. However, the other DB backends may not support this,
so it's still not recommended.

Additionally changed wrong include style at top of file, and also
removed a few stubs from tests that are not needed anymore after
libutils is included in the test build.
(cherry picked from commit 1c3d1171a7d6cf76bde858457f7f4a046ef34646)
Rename write_txn to rw_txn to make its meaning clearer.
(cherry picked from commit 761c72fcaf172387173fc061cf9acbb2221cfc48)
Redmine#5486 Better support for LMDB >= 0.9.11

API has changed slightly, "key" is now required even with MDB_CURRENT.
It was ignored in older versions, so enable it everywhere.

Based on a patch by jeffali <hichame.jeffali@cfengine.com>.
(cherry picked from commit 87dd768569a925e9607c56abc902c945ee334616)
Redmine#5486 Re-enable db_concurrent_test
(cherry picked from commit 685a11c8bdf202d876f31edd0c17ee9cb6606b55)
Rename shell script to .sh extension.
(cherry picked from commit 907697d685d927f73d74ad6541f18cdb4ea616c7)
Introducing lastseen_threaded_load.
(cherry picked from commit 8727eff894c8a9dea47fe30fb3beeb25800f1de9)
Disallow no-lock and file-input options in cf-agent when called via cfruncommand.

This hardens the already existing limitation, which is enforced in
cf-runagent and cf-serverd, but has a holes. Ie. --no-loc is accepted by
cf-runagent and cf-serverd, and interpreted by cf-agent as --no-lock
as is standard for unix command line tools.

(cherry picked from commit d6f8766c0630f2efdcbf119c9733e1e30b3046c4)
Update ChangeLog

(cherry picked from commit c15a82eef0f22cdbda073906c4011c6f7ff757d6)
Restore pre-3.6 compliance behavior for commands promises.

Commands that exit with 0 result in a repaired promise, unless the
return code interpretation is explicitly overriden via body classes
attributes.

This effectively reverts ce463506e4795f1007a31720afd3300de9bca18e,
adds commentary for generations to come.

Redmine #5761

(cherry picked from commit 851527b37cca0bbf3cc55311921bd5c1235f9931)
fix db_concurrent_test

(cherry picked from commit 458dd89c5dc906bb2ae0bbeed9880eb11ad91f63)

Conflicts:
	tests/unit/Makefile.am
Redmine#5761: pluck kept_successful_command body

(cherry picked from commit f108f644a26921f70d03667ea8c76021aad55b85)

Conflicts:
	tests/acceptance/Makefile.am