BACKPORT Master generates and propagates an epoch

that slaves must use for all further communication with it, or fail with
InvalidEpochException. This is to prevent the scenario where one part of a
transaction or commit communicates with one master, there's a master
switch where the new master instance uses the same host and port as the old one.
If a transaction would continue through such a scenario then unexpected
things and bad things might happen.

(cherry picked from commit b76f8e34f7184e1457e37f6da6137bfbde79c3e5)