MS SQL Server: Transaction Treatment Concept and MS DTC Overview (Briefly)

xiaoxiao2021-03-06  40

MS SQL Server: Transaction Treatment Concept and MS DTC Overview (Briefly)

White Paper from Desktop and Business System Division

introduction

It is difficult to write applications. Over time, we have continuously discovered the concepts and techniques for establishing large applications. Modular, or to build an application to build a separate module so that we can build complex systems from a simple part and make the software reuse. Object-Oriented Concepts and Microsoft® Component Object Modules (COM) can provide technology to write modular applications.

When an application is constructed as a component, each individual sections can reside on a single computer, or can communicate on the network via remote procedure. Therefore, components provide modular and natural distributions.

Building an application is built into a separate component generates management issues of components. After a single program fails, it will be restarted as a unit. However, when using a modular system, failures of a component should not undermine other components. This must have a method of isolating a fault and restricting a fault spread. The transaction provides modular execution, thus simplifying troubleshooting and automatically implements the fault. They provide a simple conceptual implementation framework for executors and users.

The user thinks that the transaction is a single either or no change event. The executor believes that the transaction is a programming form that allows them to write modules that can participate in distributed computing. Assume that you want to transfer funds from a bank account to another account. Executors and users need to make sure that both accounts have changed or do not change. It is difficult to complete this work in a distributed system - the computer may fail and will lose information. The transaction provides a method that can set a set of operations into atomic execution units.

Atomicity is either either or not, the property is not fresh: it can be seen everywhere in life. For example, if you enter a contract, ESCROW (Contract of the Third Party Save Conditions) Officials will coordinate this transaction: Escrow official will collect the signature of each contract. This contract is completed when the Escrow official announces that everyone has signed. The priest of the hosted wedding ceremony first asked the bride and groom. "Would you like this person a spouse?" If they all answer "Willingness", the pastor will announce they married. The movie director saw "the foundation is ready for a scene" "If you have answered it, the director will shout" start shooting! "The helmsman who prepared to turn off the sailing will ask the crew," Ready to turn it. " ? "If you have an answer is ready, the helmsman will call" steering! ", Change the direction of the ship.

These scenarios explain the basic principles of the transaction: several independent entities must agree. If any party disagree, the transaction will fail. Once agreed, the transaction will happen. Microsoft Distributed Transaction Coordinator (MS® DTC) performs this transaction coordination task for other components of the COM structure.

In MS DTC terms, the executor is called a transaction manager. In transactions that perform transaction protection resources, their participants (such as relational databases) are called resource managers.

The application starts transactions by calling the BEGINTRANSACTION method of the Transaction Manager. This creates a transaction object representing transaction. The application then calls the resource manager to complete the transaction.

The application determines the current transaction of the application for the first call of each resource manager. For example, if the application is using a relational database, it calls the ODBC interface, which associates the transaction object with the ODBC connection. After that, all database calls that are connected to this connection will represent the transaction until the end of the transaction.

When a resource manager first represents a transaction, it will be invoked to the transaction. With the development of the transaction, the transaction manager tracks each resource manager registered to the transaction.

Typically, the application uses a commit service method to complete the transaction. If the application cannot be completed, the Abort transaction method is called, which can withdraw the operation of the transaction. If the application fails, MS DTC will discard this transaction. When the application successfully completed the work of the transaction, it called the MS DTC to "submit" transaction. The MS DTC will then carefully check the "two-stage" "submission protocol" to make all registered resource managers submitted. Two-stage submission protocol ensures that all resource managers submit this transaction, or all abandon this transaction. In the first phase, the MS DTC asks if each resource manager is "prepared" commit. If all participants answer "Yes", then in the second phase MS DTC will be submitted to all participant broadcast information. If any part of the transaction fails, or the resource manager responds to preparation request, or the resource manager responds to "No", the MS DTC will notify all resource manager The transaction has been abandoned.

Transaction Manager is a key part of most database systems. The transaction manager is still an optional part of some operating systems. Microsoft believes that the transaction is critical to distributed applications - transactions provide modular execution to make COM modular programming more complete. Microsoft provides transaction management software for Microsoft Windows® 95 and Microsoft Windows NT® operating systems.

Combine the transaction concept with COM necessary innovation. Traditional transaction systems require high installation and management skills. The difficulty of integrated MS DTC and Microsoft operating systems is to automatically implement installation, management, and use. Many concepts and technologies must be re-created for new client / servers, object-oriented and visual management environments.

In the first edition, MS DTC uses an resource manager: Microsoft SQL Server®. It also uses several transactional monitoring, including Encina®, Top End, and Tuxedo®. The MS DTC implements the OLE transaction interface. All OLE transaction interfaces are public, so any resource manager can become OLE Transaction Explorer. In the future, Microsoft and other software will add other transaction resource managers, such as distributed object systems, transaction file systems, transaction queen systems, and business process management systems.

转载请注明原文地址:https://www.9cbs.com/read-53998.html

New Post(0)