Ensure read-only transactions

Closes #2142
Merge pull request #2304 from strk/2.3.x-readonly

Ensure read-only transactions