Execute stored queries on master server switch.

Execute all stored commands, both queries and writes (currently on stored writes are executed), when the master server is switched.