Per pull request comment, only create a savepoint in nested transactions.
Also, make sure if a reconnect happens, no matter what the transaction depth is reset to 0.