autocommit on long transaction after connection failure
It will automatically rollback.

But...  If you do not catch the "go away", but automatically reconnect and proceed with the other statements in the transaction, you could have a mess -- whether it is autocommit or not.

So, always check for errors and take evasive action.