Aug. 2 Aug. 3 Aug. 4 Aug. 5 Aug. 6 9:00 Intro & terminology TP m ons & ORBs Logging & res. M gr. Files& BufferM gr. Structured files 11:00 Reliability Locking theory Res. M gr. & Trans. M gr. COM + A ccesspaths 13:30 Fault tolerance Locking techniques CICS & TP & Internet CORBA/ EJB + TP G roupw are 15:30 Transaction models Q ueueing A dvanced Trans. M gr. Replication Perform ance & TPC 18:00 Reception Workflow Cyberbricks Party FREE TP Monitors And ORBs Chapter 5
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
TP-Monitor: This term denotes an operating system extension that understands transactions.
Resource Manager: This is a system component that offers useful services to certain user groups and that protects its resources by transactions. An example of a very important resource manager is a database system.
rmCall: This is used as a generic call to any kind of resource manager. The call specifies the name of the resource manager, the operation that should be executed, and the parameters for the operation. If there is a database containing course information, such a call could look like this:
rmCall (“CourseDB”, “select Course-No, Ctitle from Courses, Offerings where Term = “Summer 1999” and ….”, ...)
Callback: When a module calls some other module and that module in turn invokes the module that called it, the technical term for that mechanism is: callback.
Independent invocations: A server of class S can be called arbitrarily often, and the outcome of each call is independent of whether or not the server has been called before. Moreover, each server instance can forget about the transaction by the time it returns the result. Since the server keeps no state about the call, there is nothing in the future fate of the transaction that could influence the server’s commit decision. Upon return, the server declares its consent to the transaction’s commit, should that point ever be reached.
Invocation sequence: The client wants to issue service requests that explicitly refer to earlier service requests; for example, “Give me the next 10 records.” The requirement for such service requests arises with SQL cursors. First, there is the OPEN CURSOR call, which causes the SELECT statement to be executed and all the context information in the database system to be built up. As was shown, this results in an rmCall to the sql server. After that, the FETCH CURSOR statement can be called arbitrarily often, until the result set is exhausted. If it was an update cursor, then the server cannot vote on commit before the last operation in the sequence has been executed; that is, the server must be called at its rm_Prepare() callback entry, and the outcome of this depends on the result of the previous service call.
Complex interaction: The server class must remember the results of all invocations by client C until commit, because only then can it be decided whether certain deferred consistency constraints are fulfilled. Think of a mail server. The server creates the mail header during the first interaction, the mail body during the next interaction, and so on. The mail server stores the various parts of a message in a database. All these interactions are independent; the client might as well create the body first, and the header next. However, the mail server maintains a consistency constraint that says that no mail must be accepted without at least a header, a body, and a trailer. Since this constraint cannot be determined until commit, there must be some way of relating all the updates done on behalf of the client when the server is called (back) at rm_Prepare.
server class Sa) each call to S is independent of previous calls to S
result of invocation of S1result of invocation of S2
b) the result of each call depends on the result of the previous call
Begin_Work
client
S(.....);S(.....);S(.....);
Commit_Work
S1
S2
S3
server class S
S4result of invocation of S3
S4
results of all invocations needed for commit decision
c) each call to S is independent - except for some global integrity constraints that cannot be checked until commit and that may depend on the results of all previous invocations
a) Context is maintained by a communication session that makes sure that each subsequent request goes to the same server instance as the previous one.
b) Context is passed back and forth explicitly between client and server upon each request and reply.
c) The servers write context information to a database. This might be a private database to the server class or a context database provided by the TP-monitor.
d) All servers of the same class share a segment of read/write memory in which invocation context is kept. Synchronization on this memory is done by the servers.
Client-oriented context: The solutions presented so far implicitly assume that this is the type of context to be managed. Typical examples are cursor positions, authenticated userids, etc.
Transaction-oriented context: Consider the following example: Client C invokes server S1, which in turn invokes server S3—all within T. After return from the service call, C invokes S2 (a different server class), which also invokes S3, but needs the context established by the earlier call to S3 from S1. The point here is that the context needed by S3 is not bound to any of the previous client-server interactions, but it is bound to the transaction as such. This leads back to the argument about the similarities between sessions and transactions in terms of context management. Examples of transaction-oriented context are deferred consistency constraints and locks.
Session management: If context maintenance is handled through communication sessions, then theTP monitor is responsible for binding a server process to one client for the duration of a stateful invocation.
Process management: Even if the TP monitor has no active responsibility for context management, it may use information about the number of existing sessions per server for load balancing. The rationale is that an established session is an indicator for more work in the future.
PID MyProcid(); /* returns ID of process the caller is running in*/ /* this is actually a call to the basic os */
TRID MyTrid(); /* returns the TA ID the caller is executing in */RMID MYRMID(); /* returns RMID of the RM that has called */RMID ClientRMID(); /* returns the RMID of the caller’s client */PCB MyProc(); /* returns a copy of the process control block */
/* descr. the process the caller is running in */TransCB MyTrans(); /* returns copy of the transaction ctl. block. */
/* describing the TA the caller is working for */RMCB MyRM(); /* returns copy of the resource mgr. control */
/* block desc. the RM that issued the call */
RMCB ClientRM(); /* like MyRM, but for the caller’s client */
Current denotes a pseudo object, the methods of which are executed within OTS and ORB.
Invoking begin on an object of class current creates a transaction context that is managed by the ORB until the TA either commits or aborts.
As a result of begin, the newly created context is associated with the client´s “thread of control”, which typically translates into “process”. Multiple threads (in different execution environments) can be associated with the same context at the same time.
Load control: In case of temporary overload put requests into a queue for the server class rather than flood the system with new processes.
End-user control: Queue can maintain the output of asynchronous transactions for delivery until the user explicitly acknowledgs receipt.
Recoverable data entry: Requests put on server’s queue. Server application processes requests as fast as it can.
Multi-transaction requests (Workflow): Requests are processed by a server which passes results on to another server for further processing. This can go on for many steps. If none of the steps interacts with a user, they can all be executed asynchronously.
Request-reply matching: The system guarantees that for each request there is a reply—even if all the reply says is that the request could not be processed.
ACID request handling: Each request is executed exactly once. Storing the response is part of the ACID transaction.
At-least-once response handling: The client is guaranteed to receive each response at least once. As explained previously, there are situations where it might be necessary to present a response repeatedly to the client. This means the client must prepare itself for properly dealing with duplicate responses. The important thing about the at-least-once guarantee, though, is the fact that no responses will be lost.
Boolean send( REQUEST DoThis, RQID rqid, QUID ToQueue, QUID RespQueue);
receive(QUID RespQueue, RESPONSE KeepThat);
RESPONSE reReceive(QUID RespQueue);
Registering a client with a queue establishes a recoverable session between the client and the queue resource manager. This is another example of the stateful interaction between a client and a server. The queue resource manager remembers theRQIDs it has processed, and the client knows whether it can send a request to the server queue, or whether it has to wait for a response from its input queue.
Boolean receive(QUID from_there, QAttrPtr); { exec sql declare cursor dequ on /* def scan over Q */ select * FROM sys_queues where quid = :from_there
and delete_flag = NULL order by rqid ascending for update <some isolation clauses>;
while (TRUE) /* try until entry is found */ { exec sql open dequ; exec sql fetch dequ into :(QAttrPtr->QAttr);
if ( sqlcode == 0 ) /* found an entry */ { exec sql update where current of cursor dequ set delete_flag = ‘D’; exec sql close dequ; return(TRUE); };exec sql CLOSE dequ;wait(1);