MySQL question

Explain what is meant by “two-phase commit”, and under what circumstances this is required in a distributed DBMS architecture. Be sure to discuss this in the context of the MySQL database engine, and describe the XA specification and storage engine requirements. Your essay must explain commit and rollback operations in the context of two-phase commit.