Fix race condition between constraint creation and slave write.

This removes two race conditions present in 2.2 where a constraint creation
could be violated by a commit coming from a slave. By grabbing a schema read
lock on every slave commit, we ensure exclusive access to committing schema
transactions.
Merge pull request #3137 from jakewins/2.2-batchblock

[2.2] Fix race condition between constraint creation and slave write.