In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What this article shares to you is about what is a distributed transaction. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Distributed transaction means that the participants of the transaction, the server that supports the transaction, the resource server and the transaction manager are located on different nodes of different distributed systems.
In order to implement a distributed transaction, you need to use the two-phase commit protocol described below. * Phase 1: start sending pre-commit information to all resources involved in the transaction. At this point, the resources involved in the transaction have one last chance to end the transaction abnormally. If any resource decides to end the transaction abnormally, the whole transaction is cancelled and the resource is not updated. Otherwise, the transaction will execute normally unless a catastrophic failure occurs. To prevent catastrophic failures, updates to all resources are written to the log. These logs are permanent, so they are spared and all resources can be updated again after failure. * Phase 2: occurs only when there is no exception at the end of Phase 1. At this point, all resource managers that can be located and controlled separately will begin to perform real data updates. In the distributed transaction two-phase commit protocol, a master transaction manager acts as a distributed transaction coordinator. The transaction coordinator is responsible for the entire transaction and makes it work with other transaction managers in the network. In order to implement a distributed transaction, a protocol, such as IIOP, must be used to transfer transaction context information between participants in a distributed transaction. This requires that transaction participants developed by different developers must support a standard protocol in order to achieve distributed transactions.
The structure of distributed transactions started in Transact-SQL is relatively simple:
1. The Transact-SQL script or application connection executes the Transact-SQL statement that starts the distributed transaction.
two。 The Microsoft ®SQL Server ™that executes the statement becomes the master server in the transaction.
3. The script or application then performs a distributed query on the linked server or a remote stored procedure on the remote server.
4. When a distributed query or remote procedure call is executed, the master server automatically calls MS DTC to enlist the linked server and remote server in the distributed transaction.
5. When a script or application issues a COMMIT or ROLLBACK statement, the master SQL Server calls MS DTC to manage the two-phase commit process, or tells the linked server and the remote server to roll back its transaction.
Statement
There are few Transact-SQL statements that control distributed transactions, because most of the work is done internally by Microsoft ®SQL Server ™and MS DTC. The Transact-SQL statements required in a Transact-SQL script or application simply:
● starts a distributed transaction.
● performs distributed queries on linked servers or remote procedure calls on remote servers.
● calls standard Transact-SQL COMMIT TRANSACTION, COMMIT WORK, ROLLBACK TRANSACTION, or ROLLBACK WORK statements to complete the transaction.
● for any Transact-SQL distributed transaction, the Transact-SQL script or connected SQL Server automatically invokes MS DTC to coordinate the commit or rollback of the transaction.
The REMOTE_PROC_TRANSACTIONS option is a compatibility option that only affects remote stored procedure calls to remote servers defined using sp_addserver. For more information about remote stored procedures, see remote stored procedure Architecture. This option does not apply to distributed queries that execute stored procedures on linked servers defined using sp_addlinkedserver. For more information about distributed queries, see distributed queries.
The above is what distributed transactions are, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.