TMDM-7719: "Rollback error may leave MDM server in inconsistent state"

Backport changes from 5.6 branch for safety code added on rollback.
(https://jira.talendforge.org/browse/TMDM-7719)
(cherry picked from commit 02001f6)