funky-eyes commented on PR #8007: URL: https://github.com/apache/incubator-seata/pull/8007#issuecomment-4001633209
Regarding your first point: if the database-level local lock is not exclusive, the generated undo log will be incorrect. The global lock and the local lock (i.e., the database’s exclusive lock) must cooperate to ensure undo logs are correct in AT mode; they form a reciprocal relationship. The local lock prevents other transactions from interfering with the current branch transaction so that a correct undo log can be created. After producing the undo log, the branch registers with the server and then acquires the corresponding global lock. Only when the global lock is obtained—which indicates no other distributed transactions hold the resources associated with that branch lock—can the local transaction be committed. This prevents dirty writes and allows the local lock to be released safely. Only by holding both the local lock and the global lock can correctness be guaranteed in a distributed scenario and the corresponding local lock be safely released. If you obtain only the global lock without the loca l lock, that does not mean the undo log was created correctly; this will lead to incorrect data during two-phase rollback. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
