Transaction Management Support in the VMS Operating System Kernel. Digital VAX 6000, VAX TPC Benchmark A, VAX DECtp, VAX DECdta, VAX ACMS, VAX Server, VAX ft, VAX 9000, VAX cluster, VAX KODA
विज्ञापन
विज्ञापन
William A. Laing
James E. Johnson
Robert
Transaction Management
Support in the
WMS
operating System Kernel
Distributed transaction management support is an enhancement to the
VMS
oper- ating system. This supportprovides services in the
VMS
operating system for atomic transactions that may span multiple resource managers, such as those forfitfiles, network databases, and relational databases. These transactions
may
also be dt3trib uted across multiple nodes in a network, independent of the communications mechanisms used by either the application programs or the resource managers.
The Digital distributed transaction manager (DECdtm) services implement an opti- mized variant of the twophase commit protocol to ensure transaction atomicity.
Additionally, these services take advantage of the unique VAXcluster capabilities to greatly reduce thepotential for blocking that occurs with the traditional two-phase commitprotocol. These features, now part of the
VMS
operating system, are readily available to multiple resource managers and to many applications outside the traditional transaction processing monitor environment.
Businesses are becoming critically dependent on the availability and integrity of data stored on com- puter systems. As these businesses expand and merge, they acquire ever greater amounts of on-line data, often on disparate computer systems and often in disparate databases. The Digital distributed trans- action manager (DECdtm) services described in this paper address the problem of integrating data from multiple computer systems and multiple databases while maintaining data integrity under transaction control.
The DECdtm services are a set of transaction pro- cessing features embedded in the
VMS operating system. These services support distributed atomic transactions and implement an optimized variant of the well-known, two-phase commit protocol.
Design
Goals
Our overall design goal was to provide base services on which higher layers of software could be built.
This software would support reliable and robust applications, while maintaining data integrity.
Many researchers report that an atomic trans- action is a very powerful abstraction for building robust applications that consistently update data.'.l
Supporting such an abstraction makes it possible both to respond to partial failures and to maintain data consistency. Moreover, a simplifying abstrac- tion is crucial when one is faced with the complex- ity of a distributed system.
With increasingly reliable hardware and the influx of more general-purpose, fault-tolerant sys- tems, the focus on reliability has shifted from hardware to software.+ Recent discussions indicate that the key requirements for building systems with a 100-year mean time between failures may be
(1)
software-fault containment, using processes, and (2) software-fault masking, using process check- pointing and transactions."
It was clear that we could use transactions as a pervasive technique to increase application avail- ability and data consistency. Further, we saw that this technique had merit in a general-purpose oper- ating system that supports transaction processing, as well as timesharing, office automation, and tech- nical computing.
The design of DECdtm services also reflects sev- eral other Digital and
VMS design strategies:
Pervasive availability and reliability. As organi- zations become increasingly dependent on their information systems, the need for all applica- tions to be universally available and highly reli- able increases. Features that ensure application
Digital Technical
Journal Vol.
3
No.l
Winter I991
Transaction Processing, Databases, and Fault-tolerant Systems availability and data integrity, such as journaling and two-phase commit, must be available to
all
applications, and not limited to those tradition- ally thought of as "transaction processing."
Operating environment consistency. Embedding features in the operating system that are required by a broad range of utilities ensures consistency in two areas: first, in the functionality across all layered software products, and, second, in the interface for developers. For instance, if several distributed database products require the two- phase commit protocol, incorporating the protocol into the underlying system allows programmers to focus on providing "value- added" features for their products instead of re-creating a common routine or protocol.
Flexibility and interoperability. Our vision includes making DECdtm interfaces available to any developer or customer, allowing a broad range of software proclucts to take advantage of the
VMS environment. Future DECdtm services are also being designed to conform to de facto and international standards for transaction pro- cessing, thereby ensuring that
VMS applications can interoperate with applications on other vendors' systems.
Transaction Manager
-
Definitions
To grasp the concept of transaction manager, some basic terms must first be understood:
Resource manager.
A software entity that con- trols both the access and recovery of a resource.
For example, a database manager serves as the resource manager for a database.
Transaction. The execution of a set of opera- tions with the properties of atomicity, serializ- ability, and durability on recoverable resources.
Atomicity. Either all the operations of a trans- action complete, or the transaction has no effect at all.
Serializability. All operations that executed for the transaction must appear to execute serially, with respect to every other transaction.
Durability. The effects of operations that exe- cuted on behalf of the transaction are resilient to failures.
A
transaction manager
supports the
transaction abstraction by providing the following services:
Demarcation operations to start, commit, and abort a transaction
=
Execution operations for resource managers to declare themselves part of a transaction and for transaction branch managers to declare the dis- tribution of a transaction
Two-phase commit operations for resource man- agers and other transaction managers to change the transaction state (to either "preparing" or
"committing") or to acknowledge receipt of a request to change state
Benefits of Embedding Transaction
Semantics i n the Kernel
Several benefits are achieved by embedding trans action semantics in the kernel of the
VMS
operating system. Briefly, these benefits include consistency, interoperability, and flexibility. Embedding trans action semantics in the kernel makes a set of services available to different environments and products in a consistent manner. As a consequence, interoperability between products is encouraged, as well as investment in the clevelopment of "value- added" features. The inherent flexibility allows a programmer to choose a transaction processing monitor, such as
VAX ACMS, and to access multiple databases anywhere in the network. The program- mer may also write an application that reads a
VAX DBMS CODASYL database, updates an Rdb/VivlS relational database, and writes report records to a sequential
VAX
RMS file action. Because all database and transaction pro- cessing products use DECdtm services, a failure at any point in the transaction causes all updates to be backed out and the files to be restored to their original state.
Two-phase Commit Protocol
DECdtm services use an optimized variant of the technique referred t o as two-phase commit. The technique is a member of the class of protocols known as Atomic Commit Protocols. This class guarantees two outcomes: first, a single yes or no decision is reached among a distributed set of par- ticipants; and, second, this decision is consistently propagated to all participants, regardless of s u b sequent machine or communications failures. This guarantee is used in transaction processing to help achieve the atomicity property of a transaction.
The basic two-phase commit protocol is straight- forward and well known. It has been the subject of considerable research and technical literature for
Vo1.3 No.
I
Winter
1991
Digital Technical
Jourrral
Transaction Management Support in the
VMS
Operating System Kernel
in detail this general two-phase commit protocol for those who wish to have more information on the subject.
The Basic Two-phase Commit
Protocol
The two-phase commit protocol occurs between two types of participants: one coordinator and one or more subordinates. The coordinator must arrive at a yes or no decision (typically called the "com- mit decision") and propagate that decision to all subordinates, regardless of any ensuing failures.
Conversely, the subordinates must maintain cer- tain guarantees (as described below) and must defer to the coordinator for the result of the com- mit decision. As the name suggests, two-phase commit occurs in two distinct phases, which the coordinator drives.
In the first phase, called the prepare phase, the coordinator issues "requests to prepare" to all sub- ordinates. The subordinates then vote, either a "yes vote" or a "veto." Implicit in a "yes vote" is the guar- antee that the subordinate will neither commit nor abort the transaction (decide yes or no) without an explicit order from the coordinator. This guarantee must be maintained despite any subsequent fail- ures and usually requires the subordinate to place sufficient data on disk (prior to the "yes vote") to ensure that the operations can be either completed or backed out.
The second phase, called the commit phase, begins after the coordinator receives all expected votes. Based on the subordinate votes, the coor- dinator decides to commit if there are no "veto" votes; otherwise, it decides to abort. The coordina- tor propagates the decision to all subordinates as either an "order to commit" or an "order to abort."
SUBORDINATE
END-TRANS FROM
COORDINATOR
-1
APPLICATION
J
'I
FORCE WRITE
"PREPARE"
RECORD
\
YES VOTE
INCREASING
TIME
I
COMMIT POINT
NOTIFY
APPLICATION
C
I -'
LAZY WRITE
"COMMIT"
RECORD
\
DONE
I
FORCE WRITE
"COMMIT"
RECORD
LAZY WRITE
"FORGET"
RECORD
Figure
I
Simple Two-phase Commit Time Line
Digital Technical Journal Vo1.3 No.
1 Winter
1771
35
36
Transaction Processing, Databases, and Fault-tolerant Systems
Because the coordinator's decision must
survive
failures, a record of the decision
is
usually stored on disk before the orders
are
sent to the subordi- nates. When the subordinates
complete
process- ing, they send an acknowledgment back to the coordinator that they are "done." This allows
the
coordinator to reclaim disk storage from com- pleted transactions. Figure
1 shows
a
time line of the two-phase commit sequence.
A subordinate node may also function as a supe- rior (intermediate) node to follow-on subordinates.
In such cases, there is a tree-structured relation- ship between the coordinator and the full set of sub- ordinates. Intermediate nodes must propagate the messages down the tree and collect responses back up the tree. Figure
2
shows a time line for a two- phase commit sequence with an intermediate node.
Most of us have had direct contact with the two- phase commit protocol. It occurs in many activities.
Consider the typical wedding ceremony as pre- sented below, which is actually a very precise two- phase commit.
I
INCREASING
SUBORDINATE
L
REQUES
FORCE WRlTE
"PREPARE"
RECORD
\
YES
INTERMEDIATE
I
END-TRANS FROM
APPLICATION
-
FORCE WRlTE
"PREPARE"
RECORD
YES VOTE
COMMIT POINT
NOTIFY
APPLICATION
/
ORDER TO COMMIT
FORCE WRlTE
"COMMIT"
RECORD
LAZY WRlTE
"COMMIT"
RECORD
ORDER TO COMMIT
LAZY WRlTE
"COMMIT"
RECORD
LAZY WRlTE
"FORGET"
RECORD
LAZY WRlTE
"FORGET"
RECORD
LAZY WRlTE
"FORGET"
RECORD
Figure 2 Three-node Two-phase Commit Time Line
Vo1.3 No. I
Winfer
I991
Digital Technical Journal
Transaction Management Support in the
ViMS
Operating System Kernel
Official:
Bride:
Official:
Groom:
Official:
Will you, Mary, take John.
I will.
I will.
. .
?
Will you, John, take Mary.. . ?
I now pronounce you man and wife.
The above dialog can be viewed as a two-phase commit:
Coordinator: Request to Prepare?
Participant
1 :
Yes Vote.
Coordinator: Request to Prepare?
Participant
2:
Yes Vote.
Coordinator: Commit Decision.
Order to Commit.
The basic two-phase commit protocol is straight- forward, survives failures, and produces a single, consistent yes or no decision. However, this proto- col is rarely used in commercial products. Opti- mizations are often applied to minimize message exchanges and physical disk writes. These optimi- zations are important particularly to the trans- action processing market because the market is very performance sensitive, and two-phase com- mit occurs after the application is complete. Thus, two-phase commit is reasonably considered an added overhead cost. We have endeavored to reduce the cost in a number of ways, resulting in low overhead and a scalable protocol embodied in the
DECdtm services. Some of the optimizations are described later in another section.
Components of the DECdtm Services
The DECdtm services were developed as three sep- arate components: a transaction manager, a log manager, and a communication manager. Together, these components provide support for distributed transaction management. The transaction manager is the central component. The log manager ser- vices enable the transaction manager to store data on nonvolatile storage. The communication man- ager provides a location-independent interprocess communication service used by the transaction and log managers. Figure 3 shows the relationships among these components.
The Digital Distributed Transaction
Manager
As the central component of the DECdtm services, the transaction manager is responsible for the application interface to the DECdtm services. This section presents the system services the trans- action manager comprises.
The transaction coordinator is the core of the transaction manager. It implements the transaction state machine and knows which resource man- agers and subordinate transaction managers are involved in a transaction. The coordinator also con- trols what is written to nonvolatile storage and manages the volatile list of active transactions.
The user services are routines that implement the
START-TRANSACTION, END-TRANSACTION,
and
ABORT-TRANSACTION
transaction system services.
RESOURCE
MANAGER
RESOURCE
4
MANAGER
SERVICES
I
1 gdFJ2TlON
I
TRANSACTION
COORDINATOR
VOLATILE
REGISTRY
-
LOGGING
INTERFACE
TO REMOTE
DECDTM
-
TO HARDENED
REGISTRY
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EXTERNAL
INTERFACE
Figure
3
Components of the DECdtm Services
Digital Tecbnlcal Journal Vo1.
.?
No.
1
Winter I991
37
Transaction Processing, Databases, and Fault-tolerant Systems
They validate user parameters,
dispense
a trans-
action
identifier,
pass
state transition requests to the transaction coordinator, and return informa- tion about the transaction outcome.
The branch management services support the creation and demarcation of branches in the dis- tributed transaction tree. New branches are con- structed when subordinate application programs are
invoked in
a distributed
environment.
The ser- vices are called
on
to
attach
an
application
pro-
gram
to the transaction, to
demarcate
the work
done
in that application as
part
of
the
transaction, and finally to return information about the trans- action
outcome.
The resource manager services are routines that
provide the
interface between
the
DECdtm services
and
the cooperating resource managers. This inter- f ~ c e resource managers
to
cleclarc them-
selves
to the transaction manager and to register their involvement in the "voting" stage of the two- phase commit process of a specific transaction.
Finally, the information services routines are
the interface
that allows
resource
managers to query and update transaction information stored by DECdtm services. This information is stored in
either
the volatile-active transaction list or the nonvolatile transaction log. Resource managers may
resolve
and possibly modify the state of
"in-doubt" transactions
through
these
services.
The Log Manager
The log manager provides the transaction manager with an interface for storing sufficient information in nonvolatile storage to ensure that the outcome of a transaction can be consistently resolved. This interface is available to operating system compo- nents. The log manager also slipports the creation, deletion, and general management of the trans action logs used by the transaction manager.
An
additional utility enables operators to examine transaction logs and, in extreme cases, makes i t possible to change the state of any transaction.
The
Communication Manager
The communication manager provides a command/ response message-passing facility to the trans- action manager and the log manager. The interface is specifically designed to offer high-performance, low-latency services to operating system com- ponents. The command/response, connection- oriented, message-passing system allows clients to exchange messages. The clients may reside on the same node, within the same cluster, or within a homogeneous
VMS
wide area network. The com- munication manager also provides highly optimized local (that is, intranode) and intracluster trans ports. In addition, this service component multi- plexes communication links across a single, cached
DECnet virtual circuit to improve the performance of creating and destroying wide area links.
Transaction Processing Model
Digital's transaction processing model entails the cooperation of several distinct elements for correct execution of a distributed transaction. These ele- ments are (1) the application programmer,
(2)
the resource managers,
(3) the integration of the
DECdtm services into the
VMS operating system,
(4) transaction trees, and
(5) vote-gathering and the final outcome.
Application Programmer
The application programmer must bracket a series of operations with STAlZT-TRANSACTION and
END-TRANSACTION calls. This bracketing demar- cates the unit of work that the system is to treat as a single atomic unit. The application programmer may call the DECdtm services to create the branches of the tlistributed transaction tree.
Resource Managers
Resource managers, such as
VAX
RMS,
VAX
RdbfWl~, and
VAX
DBMS, that access recoverable resources during a transaction inform the DECdtm services of their involvement in the transaction. The resource managers can then participate in the voting phase and react appropriately to the decision on the final outcome of the transaction. Resource managers must also provide recovery mechanisms to restore resources they manage to a transaction-consistent state in the event of a failure.
Integration in the Operating System
The DECdtm services are a basic component of the
VMS operating system. These services are responsi- ble for maintaining the overall state of the distrib uted transaction and for ensuring that sufficient information is recorded on stable storage. Such information is essential in the event of a failure so that resource managers can obtain a consistent view of the outcome of transactions.
Each
VMS
node in a network normally contains one transaction manager object. This object main- tains a list of participants in transactions that are active on the node. This list consists of resource managers local t o the node and the transaction manager objects located on other nodes.
1/01,
.3
No. I
Witrler
1991
Digital Technical Journal
Transaction Management Support in the VMS Operating System Kernel
Transaction Trees
The node on which the transaction originated (that is, the node on which the
START_TRANSACTION a distributed transaction tree. The transaction manager object on this node is usually for coordinating the transaction commit phase of the transaction. The transaction tree grows as applications call on the branch management ser- vices of the transaction manager object.
The transaction identifier dispensed by the to the branch services. This parameter identifies two concerns for the local transaction manager object: (I) to which transaction tree the new branch should be added, and
(2) which transaction man- ager object is the immediate superior in the tree.
Resource managers join specific branches in a transaction tree by calling the resource manager services of the local transaction manager object.
Vote-gathering and the Final Outcome
When the "commit" phase of the transaction is entered (triggered by an application call to
END-TRANSACTION), each transaction manager object involved in the transaction must gather the
"votes" of the locally registered resource managers and the subordinate transaction manager objects.
The results are forwarded to the coordinating trans- action manager object.
The coordinating transaction manager object eventually informs the locally registered resource managers and the subordinate transaction manager objects of the final outcome of the transaction. The subordinate transaction manager objects, in turn, propagate this information to locally registered resource managers as well as to any subordinate transaction manager objects.
Protocol Optimizations
The DECdtm services use several previously pub- lished optimizations and extend those optimiza- tions with a number that are unique to VAXcluster systems. In this section we present these general optimizations, a discussion of VAXcluster consider- ations, and two VAXcluster-specific optimizations.
General Optimizations
The following sections describe some previously published optimizations.
PresumedAbort DECdtm services use the "pre- states that, if no information can be found for a transaction by the coordinator, the transaction aborts. This removes the need t o write an abort decision to disk and to subsequently acknowledge the order to abort. In addition, subordinates that do not mod* any data during the transaction (that is, they are "read only"), avoid writing information to disk or participating in the commit phase.
Lazy Commit Log Write The DECdtm services can act as intermediate nodes in a distributed trans- action. In this mode, they write a "prepare" record prior to responding with a "yes vote." They also write a "commit" record upon receipt of an order to commit. This latter record is written so that the coordinator need not be asked about the commit decision should the intermediate node fail. This refinement isolates the intermediate node's recov- ery from communication failures between it and the coordinator.
Performance is enhanced when the DECdtm ser- vices write the commit record on an intermediate node in a "nonurgent" or "lazy" manner."' The lazy write buffers the information and waits for an urgent request to trigger the group commit timer to write the data to disk. vpically, this operation avoids a disk write at the intermediate node. The increase in the length of time before the commit record is written is negligible.
One-phase Commit
A
key consideration in the design of the DEcdtm services was to incur mini- ma1 impact on the performance of Digital's data- base products. We exploited two attributes to achieve this goal. First, all current users are limited to non-distributed transactions (those that involve only a single subordinate). Second, the two-phase commit protocol requires that all subordinates respond with a "yes vote" to commit the trans- action. This allows a highly optimized path for single subordinate transactions. Such transactions require no writes to disk by the DECdtm services and execute in one phase. The subordinate is told that it is the only voting party in the transaction and, if it is willing to respond with a "yes vote," it should proceed and perform its order to commit processing.
V3Xcluster Considerations
The optimizations listed above (and others not described here) provide the DECdtm services with a competitive two-phase commit protocol.
VAXcluster technology, though, offers other untapped potential. VAXcluster systems offer sev- eral unique features, in particular, the guarantee
Digital Technical Journal
VoI.
3
N o 1 Winter
I991
39
Transaction Processing, Databases, and Fault-tolerant Systems against partitioning, the distributed lock manager, and the ability to share disk access between
CPUs."
Within a VAXcluster
system,
use of these unique features allows
the
DECdtm
services
to avoid a blocked condition which occurs during the short period of time when a subordinate node responds with a "yes vote" and communication with its coordinator is lost. Normally, the subordinate
is
unable to proceed with
that
transaction's commit until communications have been restored.
Outside a VAXcluster system, the DECdtm ser- vices would indeed be blocked.
If, however, the subordinate and its coortlinator are in the same
VAXcluster system, this will not occur.
If communi- cation is
lost,
a subordinate node knows, as a result of the guarantee against partitioning, that
its
coor- dinator has failed.
Because a subordinate node can access the trans- action log of the failed coordinator, i t may imme- diately "host" its failed coordinator's recovery.
Communications to the hosted coordinator are quickly restored, and the subordinate node is able to complete the transaction commit.
VMcluster-specific Optimizations
Once the blocking potential was removed from i n t r a - v ~ c l u s t e r several
additional
protocol optimizations became practical. The optimizations
described
in this section are
dynam-
ically enabled if the subordinate and its coordina- tor are both in the same VAXcluster system.
Early Prepare
Log
Write
As mentioned earlier, an intermediate node must write a "prepare" record prior to responding with a "yes vote."
The
pres- ence of this record in an intermediate node's log indicates that the node must get the outcome of the transaction from the coordinator and,
thus,
i t is subject to blocking. Therefore, the prepare record is typically written after all the expected votes are returned, which adds to
commit-time
latency.
The DECdtm
services
are free from blocking con- cerns within a VAXcluster system; the vast
majority
of transactions do commit. This factor
prompted
an optimization that writes a prepare record while simultaneously
collecting
the subordinate votes.
This reduces
commit-time latency.
No Comfnit Log
Write The lazy commit log write optimization described above causes the inter- mediate node's commit record to be written and, thus, minimizes the potential for blocking should the intermediate node fail. Note that this is not a concern for the intra-VAXcluster case. Therefore, no commit record is written at the intermediate node.
Performance Evaluation
Table
1
describes
the
message
and log write costs of the DECdtm
services
protocol and compares i t to the
basic two-phase commit protocol,
as well as to the standard presumed
abort
variant previ- ously
described."'
Table 1 Logging and Message Cost by Two-phase Commit (2PC) Protocol Variant
Coordinator
Basic 2PC:
Presumed Abort:
(RO intermediate)
- -
Coordinator
Log Write Message
2 , l
forced
2 , l
forced
2 , l
forced
2 N
2N
1
N
Intermediate
Log Write Message
-
2, 2 forced
2, 2 forced
0
2
2
1
Normal DECdtm:
(RO
(RO intermediate)
Intracluster: intermediate)
DECdtm
1
PC:
2 , l
forced
2 , l
forced
2 , l
forced
2 , l
forced
2 , l
forced
0
1
0
,
1 forced*
Notes:
Log writes are total writes, forced. The table entry 2.1 forced means that there are two total log writes, one of which is forced. A forced write must complete before the protocol makes a transition to the next state.
RO means Read Only.
Where a message is listed as xN, N represents the number of intermediates that fit that category.
In this instance, forced means that the log write 1s initiated optimistically; thus, it has lower latency
4
0
Vol.
.3
No.
1 Winter
1991 Digital TechnicalJournal
Trnnsaction Management Support in the VMS Operating System Kemel
Ease-of-use Evaluation
A
primary goal in providing transaction processing primitives within the
VMS
kernel was to supply many disparate applications with a straightforward interface to distributed transaction management.
This contrasts with most commercially available systems, where distributed transaction manage- ment functionality is available on1 y from a trans- action processing monitor. This latter form restricts cute under the control of the transaction process- ing monitor, and it effectively precludes other applications from making use of the technology.
From the outset of development, we endeavored to provide an interface that was suitable for as many applications as possible. We made early ver- sions of the DECdtm services available within
Digital to decrease the "time to market" for soft- ware products that wished to exploit distributed transaction processing technology. As of July
1990, at least seven Digital software products have been modified to use the DECdtm services. These products are
VAX
RdbfVMS,
VAX
DBMS,
VAX
RMS
Journaling,
VAX
ACMS,
DECintact,
VAX RALLY, and
VAX
SQL.
In general, the modifications to these products have been relatively minor, as might be inferred from the short time i t took to make the required changes. Based on this experience, we expect third- party software vendors to rapidly take advantage of the DECdtm services as they become available as part of the standard
VMS operating system.
To incorporate the DECdtm services into a recoverable resource manager, the existing inter- nal transaction management module with calls to the DECdtm services must be replaced. The resource manager must also be modified to cor- rectly respond to the prepare and commit callbacks by the DECdtm services. Further, the recovery logic of the resource manager must be modified to obtain from the DECdtm services the state of "in doubt" transactions.
Example of DECdtm Usage
The model and pseudocode shown in Figures 4a and b illustrate the use of UECdtm services in a simple example of a distributed transaction. The transaction spans two nodes, NODE-A and NODE-B, in a
VMS network. During the course of the trans- action, recoverable resources managed by resource managers,
RM-A and RM-B, are modified. Two
"application" programs, APPL-A and
APPL-B, that run on
NODE-A and NODE-B, respectively, make normal procedural calls to
RM-A and
RM-B.
APPL-A
- _ _ - - - - _ - - - _ _ - - - - _ -
I
I
NODE A i
I
I 1
RESOURCE
SERVICES
1 1
EZ: ;ES
DECDTM
11
.%!ICES
1 I
I
I
I
I
1
I
I _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
NODE
B
DECDTM
I
I
KEY:
-
- - - -
IPC CONNECTION
.......
RPC
SYSTEM SERVICE CALL
-
- - - -
PROCEDURE CALL
RM RESOURCE MANAGER
APPL APPLICATION
Figure 4a Model Illustrating the Use of DECdtm Services
Digital Technical Joztrnal
I'ol.
.3
Xo. I
Winter 1991
Transaction Processing,
PROGRAM APPL-A
! E s t a b l i s h c o m m u n i c a t i o n s w i t h r e m o t e a p p l i c a t i o n
I
I P C - L I N K ( n o d e = " N O D E - B " , a p p l i c a t i o n = " A P P L - B " , L i n k = l i n k - i d ) ;
! E x c h a n g e t r a n s a c t i o n m a n a g e r n a m e s
!
L I B $ G E T J P I
( J P I ~ ~ C O M M I T ~ D O M A I N , , , m y Y c d ~ ;
I P C - T R A N S C E I V E ( L i n k = L i n k - i d , s e n d - d a t a = r n y - c d , r e c e i v e - d a t a = y o u r - c d ) ;
!
S t a r t a t r a n s a c t i o n
!
$START-TRANSW ( i o s b = s t a t u s , t i d = t i d ) ;
!
M a k e a p r o c e d u r a l c a l l t o RM-A t o p e r f o r m a n o p e r a t i o n
!
RM-A ( t i d , r e q u e s t e d - o p e r a t i o n ) ;
!
Now c r e a t e a t r a n s a c t i o n b r a n c h f o r t h e r e m o t e a p p l i c a t i o n
!
$ADD-BRANCHW ( i o s b = s t a t u s , t i d = t i d , b r a n c h = b i d , c d - n a m e = y o u r - c d ) ;
!
A s k APPL-B t o d o s o m e t h i n g a s p a r t o f t h i s t r a n s a c t i o n
I
I P C - T R A N S C E I V E ( L i n k = L i n k - i d , s e n d - d a t a = ( t i d , b i d , d a t a ) , r e c e i v e - d a t a = s t a t u s ) ;
!
A n d e n d t h e t r a n s a c t i o n
I
PROGRAM APPL-B ( L i n k - i d )
! E x c h a n g e t r a n s a c t i o n m a n a g e r n a m e s
!
I P C - R E C E I V E ( l i n k = L i n k - i d , d a t a = s u p - c d ) ;
L I B $ G E T J P I ( J P I S - C O M M I T - D O M A I N , , , m y _ c d ) ;
IPC-REPLY ( L i n k = L i n k - i d , d a t a = m y - c d ) ;
!
Now we e x e c u t e t r a n s a c t i o n r e q u e s t s
I l o o p ;
I P C - R E C E I V E ( L i n k = l i n k - i d , d a t a = ( t i d , b i d , d a t a ) ) ;
! S t a r t t h e t r a n s a c t i o n b r a n c h c r e a t e d b y APPL-A.
!
M a k e a p r o c e d u r a l c a l l t o RM-B t o p e r f o r m a n o p e r a t i o n
!
RM-B ( t i d , r e q u e s t e d - o p e r a t i o n ) ;
! T e l l APPL-A we a r e d o n e
!
IPC-REPLY ( L i n k = L i n k - i d , d a t a = S S $ - N O R M A L ) ;
!
D e c l a r e t h a t we a r e f i n i s h e d f o r t h i s t r a n s a c t i o n a n d
! w a i t f o r i t t o c o m p l e t e
I
$READY-TO-COMMITW e n d - l o o p ;
( i o s b = s t a t u s , t i d = t i d ) ;
Vol.
.$
No. 1 Winler 1991
Digital Technical Journal
Transaction Managentent Szrpport in the VMS Operating System K m e l
ROUTINE RM-A ( t i d , r e q u e s t e d - o p e r a t i o n )
!
I f t h i s i s t h e f i r s t o p e r a t i o n , r e g i s t e r w i t h DECdtm s e r v i c e s a s a
! r e s o u r c e m a n a g e r . As p a r t o f t h e r e g i s t r a t i o n we d e c l a r e a n e v e n t
! r o u t i n e t h a t
! w i l l b e c a l l e d d u r i n g t h e v o t i n g p r o c e s s . i f f i r s t t i m e w e ' v e b e e n c a l l e d t h e n
$DECLARE-RMW ( i o s b = s t a t u s , name="RM-A", r m - i d = r m - h a n d l e ) ; evtrtn=RM-A-EVENT,
! I n f o r m DECdtm s e r v i c e s o f o u r i n t e r e s t i n t h i s t r a n s a c t i o n
I i f t i d h a s n o t p r e v i o u s l y b e e n s e e n t h e n
$JOIN-RMW ( i o s b = s t a t u s , r m - i d = r m - h a n d l e , p a r t - i d = p a r t i c i p a n t ) ; t i d = t i d ,
! P e r f o r m t h e r e q u e s t e d o p e r a t i o n
!
DO-OPERATION ( r e q u e s t e d - o p e r a t i o n ) ;
RETURN
ROUTINE RM-A-EVENT ( e v e n t - b l o c k )
! S e l e c t a c t i o n f r o m t h e DECdtm s e r v i c e s e v e n t t y p e
I
CASE
e v e n t - b l o c k . D D T M $ L - O P T Y P E
F R O M
. . .
TO
. . .
!
Do " r e q u e s t t o p r e p a r e " p r o c e s s i n g
!
CDDTM$K-PREPARE]:
DO-PREPARE-ACTIVITY ( r e s u l t = s t a t u s ,
t i d = e v e n t - t y p e . D D T M $ A - T I D ) ;
! Do " o r d e r t o c o m m i t " p r o c e s s i n g
!
CDDTMSK-COMMIT]:
DO-COMMIT-ACTIVITY ( r e s u l t = s t a t u s ,
t i d = e v e n t - t y p e . D D T M $ A - T I D ) ;
!
Do " o r d e r t o a b o r t " p r o c e s s i n g
!
CDDTMSK-ABORT]:
DO-ABORT-ACTIVITY ( r e s u l t = s t a t u s ,
t i d = e v e n t - t y p e . D D T M $ A - T I D ) ;
E S A C ;
! I n f o r m t h e DECdtm s e r v i c e s o f t h e f i n a l s t a t u s o f o u r e v e n t
! p r o c e s s i n g .
!
$FINISH-RMOPW ( i o s b = i o s b ,
p a r t - i d = e v e n t - t y p e . D D T f l $ L - P A R T - I D ,
r e t s t s = s t a t u s ) ;
RETURN
Figure 4b Pseudocode Illustrating the Use of
DECdtnz
Services
and
APPL-B
use an interprocess communication mechanism to communicate information across the network. The DECdtm service calls are pre- fixed with a dollar sign
($).
The code for the resource managers,
KM-A
and
RM-B,
is identical with respect t o calls for the
DECdtm services. The resource manager routine,
ROUTINE RM-A-EVENT, is invoked by the DECdtm services during transaction state transitions.
Conclusions
The addition of a distributed transaction manager to the kernel of the general-purpose
VMS
operating system makes distributed transactions available
Digital Technical Journal
1'0f.3
No.
1
Winter 1991
4
3
Transaction Processing, Databases, and Fault-tolerant Systems
ant1 implementation was accomplished with com- parative ease and with quality performance. In addition t o utilizing the most commonly described optimizations of t h e two-phase c o m m i t protocol, we 11;1ve used optimizations that exploit s o m e of the unique benefits of t h e VAXcluster system.
Acknowledgments
We wish t o gratefully acknowledge the contrib- utions of all t h e transaction processing architects involvecl, and in particular Vijay 'Srehan, for deliver- ing to us an understanclable and implement- able architecture. We also extend o u r thanks t o
Phil Bernstein for his encouragement and advice, and t o o u r initial users,
H i l l
Wright, Peter Spiro, and Lenny Szubouricz, for their persistence and goocl nature.
Finally, and m o s t importantly, w e would like t o thank all t h e DECdtm development engineers and t h e o t h e r s w h o helped s h i p t h e protluct:
Stuart Bayley, Cathy Foley, Mike Grossmith, Torn
Harding, Tony Hasler, Mark Howell, Dave Marsh,
Julian Palmer, Kevin Playfortl, and Chris Whitaker.
References
1 R Haskin,
Y.
Malachi, W Sawdon, and G. Chan,
"Recovery [Management in Quicksilver,"
AC1V.I
Transclctions o n Computer Systems, vol.
6, no. 1 (February 1988).
2. A.
Trclns- action Facility for i k c h and the Internet
-
Interim Report (Pittsburgh: Carnegie Mellon
Universit): Department of Computer Science,
June 1987).
3. W Hruckert, C. d o n s o , and J. Melvin, "Verifi- cation of t h e First Fault-tolerant
\la
System,"
3,
no. 1 (Winter
1991, this issue): 79-85.
4
J Gray,
"A
Census of Tantlem System Availa- brlity between 1985 and 1990," Tandem Techni- cal Report 90.1, part no. 33579 (January 1990).
5.
I? Bernstein, V. Hadzilacos, and N. G o o d m a n ,
base Systems (Reading,
M.4:
Addison-Wesley,
1987).
6. J. Gra): "Notes o n Database Operating Systems,"
(Berlin: Springer-Verlag, 1978).
7. B. Lampson, "Atomic Transactions," In Dis-
tributed Systems-Architecture and Imple-
mentcltion: An Adz)anced Course, edited by
G.
G o o s ant1 J. Hartmanis (Berlin: Springer-
Verlag, 1981).
8. C.
Mohan, B. Lindsay, and R. Obermarck,
"Transaction Management in t h e
R*
Distributed
Database Management System," ACM Trans-
actions on Con?puter Sjlstems, vol. 11, no.
4
(December 1986).
9. C.
Mohan and B. Lindsa): "Efficient Commit
Protocol for t h e Tree of Processes Model of
Distributed Transactions," Proceedings of the
2nd
AChl
SIGACTAT/GOIIS
S ~ ~ m p o s i u m ciples of
Distributed Computing ([Montreal,
August 1983).
10. D. Duchamp, "Analysis of Transaction
manage-
ment Performance," Proceedings of tl7e Tzueljtl7
ACM .Symj,osiurn o n Operating Systenzs Prim
ciples (Special issue), vol. 23, no. 5 (December
1989): 177- 190.
11. N. Kronenberg, H. Levy, and
W
Strecker,
"Vi\Xclusters:
A
Closely-Coupled Distributed
System,"
ACi1.1
Transactions o n Computer
4,
2 (May 1986).
I/ol
.I
No 1
W i ~ z t e r
Digilal Technical Journal
डाउनलोड
विज्ञापन