Ticket/master/kahadb fixes and resource rels cherry pick

This PR backports more bug fixes to the 1.1.x in relation to:

* KahaDB journal corruption work-arounds and documentation
* Resource reference fixes in puppetdb terminus

And also pulls across subsequent commits to solve any documentation and test fixes
relating to the aforementioned patches.