HP NonStop TMF Introduction Abstract This manual introduces the concepts of transaction processing and the features of the HP NonStop™ Transaction Management Facility (TMF). This manual is directed to business professionals, application designers and programmers, and system managers. Product Version TMF G08 Supported Release Version Updates (RVUs) This publication supports G06.26 and all subsequent G-series release version updates (RVUs) until otherwise indicated by its replacement publication.
Document History Part Number Product Version Published 085812 NonStop TM/MP D30 December 1994 124757 NonStop TM/MP D41 April 1996 421952-001 NonStop TM/MP D46 March 2001 522414-001 TMF G07 August 2002 522414-002 TMF G08 April 2005
HP NonStop TMF Introduction Index Examples What’s New in This Manual vii Manual Information vii New and Changed Information Figures Tables vii About This Manual ix Who Should Read This Manual? ix How This Manual is Organized x TMF Documentation x Other Documentation xi Notation Conventions xii 1.
1. TMF Overview (continued) Contents 1. TMF Overview (continued) Database Management Software 1-17 NonStop OS, File System, and Disk Process 1-18 Who Uses TMF? 1-18 Application Designers and Programmers 1-18 Database Administrators and System Managers 1-18 System Operators 1-19 What Are the Benefits of TMF? 1-19 2.
3. Transaction Protection and Database Recovery (continued) Contents 3. Transaction Protection and Database Recovery (continued) Summary of Transaction Protection and Database Recovery TMF Transaction Protection 3-16 Database Recovery 3-16 3-16 4. Application Performance Performance Comparison 4-1 Performance Versus Transaction Size 4-2 Writes to Database Files 4-3 Writes to Audit-Trail Files 4-5 Performance Versus Transaction Rate 4-5 5.
. TMF System Management (continued) Contents 6. TMF System Management (continued) Managing Audit and Online Dumps Monitoring TMF 6-6 Managing the TMF Catalog 6-6 6-6 Index Examples Example 2-1. Transaction Control Using Embedded SQL 2-8 Figures Figure 1-1. Figure 1-2. Figure 1-3. Figure 1-4. Figure 1-5. Figure 1-6. Figure 1-7. Figure 1-8. Figure 1-9. Figure 2-1. Figure 2-2. Figure 2-3. Figure 2-4. Figure 2-5. Figure 2-6. Figure 2-7. Figure 3-1. Figure 3-2. Figure 3-3. Figure 3-4. Figure 3-5.
Figures (continued) Contents Figures (continued) Figure 5-3. Figure 5-4. Figure 5-5. Figure 5-6. Figure 6-1. Figure 6-2. Passing the Current Transaction to a Server 5-11 Mixed Database Access by an HP COBOL Server 5-13 A Long Transaction 5-14 A Context-Saving Transaction 5-15 Managing a Central and Remote Site 6-2 TMF Process Communication 6-4 Tables Table 2-1.
Contents HP NonStop TMF Introduction —522414-002 vi
What’s New in This Manual Manual Information HP NonStop TMF Introduction Abstract This manual introduces the concepts of transaction processing and the features of the HP NonStop™ Transaction Management Facility (TMF). This manual is directed to business professionals, application designers and programmers, and system managers. Product Version TMF G08 Supported Release Version Updates (RVUs) This publication supports G06.
New and Changed Information What’s New in This Manual • • • Section 3, Transaction Protection and Database Recovery, revises the following discussions: ° Restore-Audit Volume on page 3-5 mentions a new option for retaining audittrail files restored from tape on restore-audit volumes indefinitely to enhance performance. ° File Recovery on page 3-13 discusses recovery of files to different volumes, subvolumes, and file IDs than the ones on which they were dumped.
About This Manual This manual introduces the basic concepts of transaction processing and the features of the HP NonStop™ Transaction Management Facility (TMF). TMF is a software product that provides transaction protection, database consistency, and database recovery on HP NonStop servers. Use this manual to learn how TMF works to protect business data in local and distributed databases.
How This Manual is Organized About This Manual How This Manual is Organized This manual begins with the basic concepts of transaction processing and specific details of TMF implementation. Next, the manual covers application programming and system management.
Other Documentation About This Manual • • • • • TMF Planning and Configuration Guide Read this guide for information about how to plan, configure, and manage a TMF environment. This guide also describes how to move your applications between an earlier TMF product version and the current one. TMF Operations and Recovery Guide Read this guide for information about how to perform and monitor standard TMF operations, obtain online and audit dumps, and respond to a variety of TMF exception conditions.
Notation Conventions About This Manual • Various programming languages, including HP COBOL for NonStop Systems, Pathway SCREEN COBOL, FORTRAN, TAL, C, C++, and SQL (NonStop SQL implementation). Notation Conventions Hypertext Links Blue underline is used to indicate a hypertext link within text. By clicking a passage of text with a blue underline, you are taken to the location described. For example: This requirement is described under Backup DAM Volumes and Physical Disk Drives on page 3-2.
1 TMF Overview TMF furnishes transaction protection, database consistency, and database recovery critical in high-volume transaction processing. It sustains high performance for online transaction processing (OLTP) applications, as well as online query processing (OLQP) activities, batch processing applications, and decision-support systems.
TMF Overview For OLTP applications, TMF provides: • • All the complex operations for concurrent transactions and database consistency, making these operations transparent to both users and application programmers. Database recovery through three mechanisms: • • • Transaction backout, which recovers the database from application or transaction failure. Volume recovery, which recovers the database in the most typical recovery situations: a disk volume or system failure.
What Characterizes the TMF Environment? TMF Overview What Characterizes the TMF Environment? TMF works in the OLTP environment to protect transactions for business operations and maintain the consistency of the database. In general, a transaction is a multistep operation that changes the database. For example, a transaction for an airline reservation could include the operations of adding the reservation to the airline passenger list, issuing a ticket, and adding the ticket price to accounts receivable.
Database Distribution TMF Overview TMF features that maintain consistency for distributed databases are transparent to application programmers. TMF equally protects transactions that affect only a local database and transactions that affect a database distributed on many nodes. Figure 1-2. TMF Protecting a Distributed Database \SAN FRANCISCO \CHICAGO TMF TMF SALES MANUF SALES \LONDON \SEOUL TMF TMF MANUF SALES SALES VST002.
Database Consistency TMF Overview Database Consistency When you design a database, you establish criteria for the relationships among its data; for example, an account balance must equal credits to the balance minus debits to the balance. When the database satisfies these criteria, the database is considered to be consistent. The changes a transaction makes to a database should transform the database from one consistent state to a new consistent state.
Transaction Concurrency TMF Overview Transaction Concurrency To process the transaction correctly, an application program must have consistent input from the database, regardless of any concurrent changes being made to the database. To illustrate the problems introduced when there is no protection for concurrency, assume two concurrent transactions each check the balance of an account and then deposit funds to the account (see Figure 1-4).
Transaction Concurrency TMF Overview TMF provides concurrency control by managing locks on data accessed and updated in a TMF transaction. The locks isolate transactions from one another so that each transaction appears to be operating alone on the database. This allows database access by many users. Figure 1-5 illustrates concurrency control. Figure 1-5.
What Does TMF Do? TMF Overview What Does TMF Do? TMF protects transactions and performs database recovery: • • • It ensures database consistency by protecting transactions from many potential hazards, including program failures, system component failures, and communication failures. It protects transactions from one another, thus providing database consistency despite concurrent transactions. It performs database recovery by using transaction-audit information.
Transaction Protection TMF Overview performs an abort operation by backing out all changes the transaction made to the database. TMF Transactions Can Be Serialized TMF protects the transaction from other concurrent transactions so that each transaction appears to operate alone against the database. It provides this protection by locking rows or records that might be inserted, updated, or deleted. The locks are held until the transaction is committed.
Database Recovery TMF Overview TMF Transactions Are Permanent Once a transaction is committed to the database, all the changes made by the transaction remain in the database, despite any subsequent failure. TMF recovery features ensure transaction permanence.
Database Recovery TMF Overview Log of Updates in Audit Trails An audit trail, sometimes called a “transaction log,” is a series of files in which TMF records information about a transaction’s changes to a database. An audit trail contains audit records. Audit records contain information about each transaction, such as the final outcome of transaction commit or abort operations, as well as before-images and after-images of all data records changed by each transaction.
Database Recovery TMF Overview The audit-trail records contain both logical and physical audit information. The records include before-images and after-images of audited data, and records of certain transaction status information. Audit trails also include records about operations that affect the physical structure of data files, such as block splits. If the database is distributed over two or more nodes of a network, TMF maintains separate audit trails on each node.
Database Recovery TMF Overview Transaction Backout Transaction backout reapplies before-images to database records to undo the effects of an aborted transaction. If the transaction affects data distributed over a network, backout occurs independently at each network node. If the transaction is distributed, backout is managed independently by each participating transaction manager or resource manager. The result of backing out a transaction is the same as if the transaction’s changes had never occurred.
Why Use TMF? TMF Overview Why Use TMF? OLTP applications are characterized by concurrent operations on shared data that is often distributed in a network of systems. They require database consistency, almost continuous data availability, and very high performance: all provided by TMF. Each of the following scenarios presents an OLTP problem that can occur, and discusses the TMF solution to that problem.
Insurance Application Scenario TMF Overview Insurance Application Scenario Problem: Communication Failure An insurance agent at a remote site submits information on the sale of a new policy. A fierce storm interrupts all communication lines so that the transaction cannot reach headquarters to record information about the sale. Solution: Transaction Backout TMF detects that the headquarters system is not available and backs out all the operations in the transaction to maintain database consistency.
How Does TMF Integrate With OLTP Software? TMF Overview Solution: File Recovery Applications that require inventory data run with no problems as long as the applications do not require data from the damaged volume. Any transactions in progress that changed data on that volume are backed out by TMF to prevent partial transactions, which can cause the database to be inconsistent. TMF maintains the consistency of the company’s database.
Applications TMF Overview Applications Several different types of applications can use TMF for transaction management, including the following: • • HP NonStop SQL provides SQL preprocessors and a SQL compiler. With these tools, programmers can create their own programmatic interfaces to a SQL database by compiling and executing applications that use embedded SQL statements to query the database.
NonStop OS, File System, and Disk Process TMF Overview Enscribe is a record manager for accessing and changing Enscribe database files. TMF protects user data in audited Enscribe files. NonStop OS, File System, and Disk Process The NonStop OS, file system, and disk process provide several features to maintain data integrity, including continuous availability, structural integrity of files, protection of storage media, and data-sharing protection.
System Operators TMF Overview • Determining how TMF is to be controlled and monitored: • • Through TMFCOM, the command interface for TMF. Through TMFSERVE, which provides programmatic access to TMF through the Subsystem Programmatic Interface (SPI). System Operators System operators are responsible for the following tasks: • • • • • • • Monitoring TMF status. Starting and stopping TMF. Reading event messages to determine the status of recovery and other operations.
What Are the Benefits of TMF? TMF Overview • Increased high performance for transaction processing Because TMF is integrated with the file system and disk process, using it increases performance for high-volume OLTP applications. TMF provides database protection and increased throughput. • Database recovery The volume recovery and file recovery facilities together provide complete protection for database files.
2 Transaction Coordination TMF coordinates transactions to ensure database consistency and provide maximum concurrent access to shared data. This coordination takes place regardless of: • • The location of the data, whether local or remote. The involvement of other software (such as transaction gateways and resource managers) used to support distributed transactions. TMF coordinates transactions through transaction identification, a locking mechanism, and the two-phase commit protocol.
Coordinating Distributed Transactions Transaction Coordination Figure 2-1. Local Transaction \DALLAS $DATA1 User Application $DATA2 TMF $AUDIT VST043.vsd Coordinating Distributed Transactions Distributed transactions are transactions that access data located at multiple nodes of a network, or that access data by means of requesters or servers at multiple nodes of a network.
Resource Managers and Transaction Gateways Transaction Coordination Resource Managers and Transaction Gateways In general, a resource manager is a software entity that manages a certain part of a computer system’s shared resources. Many other software entities can request access to these resources from time to time, using services that the resource manager provides.
How Distributed Transaction Coordination Works Transaction Coordination Transaction gateways translate between one protocol and another; they translate imported transactions and transaction IDs to the local protocol, and translate exported transactions and transaction IDs to the remote protocol.
How Distributed Transaction Coordination Works Transaction Coordination Figure 2-3. Commit Coordinator and Subordinate Transaction Managers Commit Coordinator Subordinate TM Subordinate TM VST053.vsd The transaction management process (TMP) on each participating node records the parent nodes and child nodes for each transaction. A transaction branch refers to that part of a distributed transaction being processed by one resource manager or transaction manager.
Transaction Identification Transaction Coordination Transaction Identification As discussed in Section 1, TMF Overview, an application commonly makes a series of changes to a database and transforms the database from one state to another. During the transformation, some of the intermediate states of the database fail to satisfy one or more application consistency rules.
Transaction Definition by the Application Transaction Coordination Figure 2-4. Transaction Control in a Pathway Environment File System Requester TMF Log of Transaction Records Server Database TCP SCREEN COBOL Program Transaction Entry ... ... BEGIN-TRANSACTION. ... DECLARE CURSOR... ... READ MSG-IN... OPEN cursor... SEND MESSAGE MSG-OUT... REPLY CODE... ... END-TRANSACTION. ... ... FETCH... ON-ERROR-PROCEDURE. ABORT-TRANSACTION. ... UPDATE... CLOSE cursor... ... ... WRITE REPLYMSG... ...
Transaction Definition by the Application Transaction Coordination Abort Transaction The application aborts (cancels) a TMF transaction, indicating that any database changes made since the begin-work designation are to be undone. TMF undoes any of the work performed by the transaction on audited files, and ensures that no part of the work is applied to the database.
Physical Transaction Identification Transaction Coordination Physical Transaction Identification Each TMF transaction is distinguished from other transactions by a transaction identifier or transid. A transaction is a uniquely identified entity known to the system and exists separately from the application that defines the sequence of operations in the transaction. A transaction can span processes; therefore, the system associates a current transaction identifier with each process.
Locking Mechanism Transaction Coordination Each server process tries to satisfy the request by performing an appropriate operation on the database. After satisfying the request, the server replies with a message indicating the disposition of the request. For NonStop OS requesters outside the Pathway environment, the requester sends a message to the server via a WRITEREAD system procedure.
Two-Phase Commit Protocol Transaction Coordination Two-Phase Commit Protocol TMF uses a two-phase commit protocol, which ensures that the whole transaction commits as a unit. In the first phase, TMF asks each participant in the transaction to prepare to commit. In the second phase, if all participants reply that they are prepared, TMF asks each participant to commit the change.
Summary of Transaction Coordination Transaction Coordination A two-phase commit is analogous to the message interaction in the following example: • A manager wants a staff meeting and asks the administrative assistant to arrange one when everyone can attend. The administrative assistant determines that Thursday at 10:00 looks possible but must call to confirm with all attendees: ° Phase 1—The administrative assistant calls you. After checking your calendar, you reply that you can attend.
Transaction Coordination Summary of Transaction Coordination Stage 1 The application issues a request to begin a transaction, thereby creating a new TMF transaction. The transaction is originated and identified as an active recoverable unit. Transaction identifiers are transmitted among processes that do the work of the transaction. Stage 2 The transaction modifies the database by reading, changing, deleting, and inserting rows (records).
Transaction Coordination Summary of Transaction Coordination HP NonStop TMF Introduction —522414-002 2- 14
3 Transaction Protection and Database Recovery TMF protects the database through transaction backout, file recovery, and volume recovery, which together ensure that no partially completed transaction affects the database. Should an error or failure occur, TMF uses audit trails and audit dumps to recover the database.
Audit Trails Transaction Protection and Database Recovery Audit Trails An audit trail is a series of files that TMF uses to record sequential information about a transaction’s changes to an audited file. Only TMF can rename, purge, or alter audittrail files. The disk volumes that contain audit trails are called active-audit volumes.
Transaction Protection and Database Recovery Master Audit Trail Master Audit Trail The master audit trail (MAT) contains TMF control information, such as commit or abort records for each transaction, and information describing the logical ordering of audit information in all audit trails in the system. The master audit trail can also store audit information generated by a set of audited volumes. There must be exactly one master audit trail in a TMF system. The master audit trail is named MAT.
Audit-Trail Files and Rollover Transaction Protection and Database Recovery Figure 3-2.
Transaction Protection and Database Recovery Audit Volumes Audit Volumes Audit volumes are the disk volumes that contain audit-trail files. There are three types of audit volumes: active-audit volumes, overflow-audit volumes, and restore-audit volumes. Active-Audit Volume The disk volumes that contain active-audit-trail files are called active-audit volumes.
Transaction Protection and Database Recovery Audit Dumps Audit Dumps Eventually, as TMF writes more and more audit records, the amount of space required for audit records in the audit trail could exceed the disk space available for them. As transactions are committed, the need decreases for volume recovery to use audit records pertaining to the oldest committed transactions; file recovery, however, typically needs these records.
Automatic Audit Dumping Transaction Protection and Database Recovery Figure 3-3.
Transaction Protection and Database Recovery Transaction Backout Transaction Backout The TMF backout process uses the before-images in the audit trails to undo the effects of an aborted transaction. TMF can back out transactions without affecting database consistency because the record locks and two-phase commit feature prevent transaction interaction, maintaining locks on data until backout completes.
Backout for Distributed Transactions Transaction Protection and Database Recovery Backout for Distributed Transactions For a distributed transaction, loss of communication between participating computer systems (nodes) can result in transaction backout. If a transaction cannot be committed on all participating systems, it is backed out on all participating systems.
Transaction Protection and Database Recovery Volume Recovery Volume Recovery Volume recovery provides relatively quick database recovery after a volume, disk, or node failure occurs in a NonStop system. The precise recovery time varies depending on the number of files to be recovered, the system resources (particularly processors) available, and transaction lengths. Nevertheless, it usually takes only a few minutes to recover a database.
Volume Recovery Transaction Protection and Database Recovery Figure 3-5. Recovering a Database With Volume Recovery Database Updates Failure interrrupts the writing of Transaction 2 database changes.
Online Dumps Transaction Protection and Database Recovery Online Dumps Online dumps preserve copies of audited database files in case of media failure or other damage to a database such as an accidental purge, or in some cases, incorrect application updates. Each online dump of a file provides an image of the file that can be used by the file recovery process to reconstruct the file.
Transaction Protection and Database Recovery File Recovery Online dumps of database files can be initiated manually through the TMFCOM interactive command interface to TMF. Alternatively, they can be started programmatically through the Subsystem Programmatic Interface (SPI). Using SPI, these subsystem management programs are ideal for controlling online dumps at unattended sites. Sites can also manage dumps by using HP Tandem Advanced Command Language (TACL) programs.
File Recovery Transaction Protection and Database Recovery Figure 3-7. Restoring Files With File Recovery File Recovery Environment Audit Dumps Online Dumps $RESTORE $DATA Restore Audit Volume Database Volume Catalog $AUDIT Before-Images and After-Images After-Image File Recovery Process Database Restored Copies of Files VST118.
File Recovery Transaction Protection and Database Recovery File recovery works by first restoring the data to the state of the last online dump of data files. Then, TMF applies audit information, using both audit dumps and the current audit-trail files. By applying audit information, file recovery can recover files to a time very close to when the failure occurred.
Transaction Protection and Database Recovery Summary of Transaction Protection and Database Recovery Summary of Transaction Protection and Database Recovery Database files in a modern transaction-processing environment must always be available: when they are not, businesses can lose revenue. Downtime can be avoided by using hardware such as fault-tolerant disks, achieved by methods such as disk mirroring, and fault-tolerant disk access, achieved through shared disks.
4 Application Performance Despite the overhead of auditing and committing records, TMF sustains top performance for high-volume systems. The performance benefits of using TMF increase as transaction size and rates increase.
Performance Versus Transaction Size Application Performance Without TMF protection, the relative cost for input/output (I/O) operations per transaction increases in direct proportion to the number of I/O operations in the transaction. With TMF protection, the relative cost increases only slightly as the number of I/O operations per transaction increases. Performance Versus Transaction Size The number of records being accessed in a transaction determines the transaction size.
Writes to Database Files Application Performance I/O for these transactions on a database protected by TMF includes writes to the database and writes to audit-trail files. Both types of writes include features that enhance performance for database files under TMF protection.
Writes to Database Files Application Performance Figure 4-3. Unbuffered and Buffered Input/Output Unbuffered I/O One Transaction One Transaction One Transaction One Transaction U U U U R W 1 R 2 W R W R W 3 Time 4 5 3 Time 4 5 Buffered I/O Many Transactions U, U, U, U R W 1 2 Legend R Read data from disk and put into cache U Update data in cache W Write data to disk VST021.
Writes to Audit-Trail Files Application Performance Writes to Audit-Trail Files TMF protects transactions and the integrity of the audit trail while optimizing the performance of writing to audit-trail files. TMF provides audit-writing procedures that minimize physical access time. It does this by writing audit records for multiple transactions at the same time. This is called group commit.
Performance Versus Transaction Rate Application Performance Figure 4-4. Throughput Comparison Depending on Transaction Rate Low Transaction Rate (Few per cycle) High Transaction Rate (Thousands per cycle) Transactions Transactions Legend Time for an I/O cycle — read, update, write Represents I/O for a transaction, assuming all are similar VST022.vsd With a high transaction rate, more records typically are written with every physical access.
5 TMF Application Programming The TMF application programming interface (API) is accessible through commands in the following languages: C, C++, HP COBOL, FORTRAN, SQL, SCREEN COBOL, and TAL. TMF frees application programmers from the tasks of managing concurrency and consistency in case of failure. However, those who use TMF must properly define transactions as they code their application programs.
The Requester/Server Model TMF Application Programming The Requester/Server Model In the Pathway application environment, applications consist of two types of programs: requesters and servers. This design allows application logic to reside near the resources it manages. For example, presentation logic is located near workstations or terminal devices; database logic resides in server programs near the database.
Controlling Transaction Isolation TMF Application Programming Controlling Transaction Isolation Applications can achieve different levels of isolation from concurrent programs by using various locking techniques for transactions. With the lowest level of isolation, a transaction accesses data for read operations only, despite any locks by concurrent transactions.
Controlling Transaction Isolation TMF Application Programming processes to read the same data, but prevents any process from writing to the locked data or reading it without intent to rewrite. An exclusive lock allows only the transaction that holds the lock to access the data. Using shared locks improves concurrency; using exclusive locks improves accuracy. Locks on updated, inserted, or deleted data are retained until the transaction either commits or is backed out.
Accessing SQL Data TMF Application Programming Accessing SQL Data The NonStop SQL interface to TMF is implicit through the SQL data manipulation statements SELECT, FETCH, DELETE, INSERT, and UPDATE. The application selects the level of isolation. The locks to provide the selected isolation are subsequently managed by TMF and the file system. Applications can access a NonStop SQL database by using SQL statements embedded in host language programs, including C, C++, HP COBOL, and TAL.
Accessing Enscribe Data TMF Application Programming The syntax for accessing Enscribe data and specifying isolation level of the application varies depending on the programming language. Typically, servers issue lock requests for all the data they update and for some of the data they read. The servers are responsible for issuing unlock requests when they finish their tasks, but they also need to provide for potential errors.
Managing Deadlock TMF Application Programming After the UNLOCKRECORD request, the locks are released immediately, but only for the unchanged records; locks on updated records are held until the transaction is either committed or backed out. Using File Locks for Repeatable Access If an application issues LOCKFILE in a transaction, updates records while it holds the lock granted by LOCKFILE, and then issues UNLOCKFILE before issuing ENDTRANSACTION, the file lock is held until the transaction commits.
Controlling Transactions TMF Application Programming Because timeout is detectable (the system issues a timeout error message), the program can try the statement again, or abort the transaction and start the whole transaction again. Timeout can be used to detect deadlock in either an SQL database or an Enscribe database. For applications using SQL tables, there is a default time limit that applies if the application does not set one.
TMF Application Programming Transaction Control for Multithreaded Design C, C++, HP COBOL, and FORTRAN use these calls. HP COBOL programmers use the ENTER statement. FORTRAN programmers use calls to the TAL procedures. • • SQL statements are BEGIN WORK, COMMIT WORK, and ROLLBACK WORK. TACL built-in functions are #BEGINTRANSACTION, #ENDTRANSACTION, and #ABORTTRANSACTION.
Assigning Roles to Application Modules TMF Application Programming The roles of the modules are: • • Requester—the module that begins and ends a transaction and specifies the kind of work to be performed in the transaction. Typically, the requester is a SCREEN COBOL program run by a terminal control process (TCP) in the Pathway environment. Server—the module that performs database access on behalf of the requester. The server can be a program written in a number of application languages.
Developing Requesters Using SCREEN COBOL TMF Application Programming as coding requesters and servers, by providing concurrency control, protecting transactions, and managing database recovery. Developing Requesters Using SCREEN COBOL The SCREEN COBOL statements BEGIN-TRANSACTION, END-TRANSACTION, ABORT-TRANSACTION, and RESTART-TRANSACTION enable Pathway/iTS applications to use TMF. BEGIN-TRANSACTION identifies the beginning of a sequence of operations treated as a single transaction.
Developing Servers for Database Access TMF Application Programming If a transaction is aborted for any reason, all of its changes to audited database files are backed out by TMF. In most cases, the requester program restarts the transaction at the BEGIN-TRANSACTION statement. The new transaction is assigned a new transaction identifier by the TCP. ABORT-TRANSACTION stops the processing of a transaction. TMF backs out all database changes made by the transaction and does not restart the transaction.
Developing Servers for Database Access TMF Application Programming Figure 5-4. Mixed Database Access by an HP COBOL Server NonStop SQL Database HP COBOL Server Requester Enscribe Database Procedure Division. ... 200-Access-SQL-DB. *With SQL statements. EXEC SQL FETCH... ... 400-Access-ENSCRIBE-DB. *With HP COBOL statements. READ ... ... VST027.
Developing Servers for Database Access TMF Application Programming A typical sequence of SCREEN COBOL actions for a long transaction is shown in Figure 5-5. Figure 5-5. A Long Transaction Requester Display 1 Operator Action Display 2 Operator Action Display 3 Operator Action ACCEPT data • • • BEGIN-TRANSACTION • • • SEND to server • • • ACCEPT data • • • SEND to server • • • ACCEPT data • • • SEND to server • • • END-TRANSACTION Transaction State Server Server Server Database VST029.
Developing Servers for Database Access TMF Application Programming Disadvantages of long transactions are: • • Resources could be locked for an indeterminate amount of time. Locking resources for seconds or minutes might be acceptable; locking resources for hours is not acceptable. An application should ensure that an operator cannot leave to perform some other task before finishing a transaction so that locked resources can be released. Transaction restart requires the operator to reenter input.
Summary of Transaction Design Tasks for Applications in the Pathway Environment TMF Application Programming Advantages of context-saving transactions are: • • • Locks are held for a short time. Failure at any point during the TMF transaction causes all updates to audited data to be backed out. Transaction recovery does not require operator action.
6 TMF System Management Users typically perform various TMF system management activities such as configuring TMF itself and monitoring and managing its activities on a routine basis. These operations help ensure that applications continue running with full transaction protection. For performing these operations at either local or remote sites, two convenient interfaces are available: • • TMFCOM, the interactive command interpreter used by system managers and operators.
Subsystem Programmatic Interface (SPI) TMF System Management Subsystem Programmatic Interface (SPI) By using the Subsystem Programmatic Interface (SPI), you can construct system management programs that monitor and control the TMF environment for you. Most of the operations available in TMFCOM are also available through SPI. System management programs allow you to transfer as many of the routine management tasks to programs as possible.
TMF Process Communication TMF System Management TMF Process Communication Both TMFCOM and application programs using SPI send their requests to the TMFSERVE process, transmitting them in SPI message format (see Figure 6-1). TMFSERVE is a TMF server process whose main job is to receive and process these requests. TMFSERVE either handles the requests itself, or passes them to other TMF processes through a programmatic messaging system.
Event Management TMF System Management Figure 6-2. TMF Process Communication TMFCOM System Management Program Operator TMFSERVE TMF Volume Recovery File Recovery TMP Backout Catalog Audit Dump Online Dump TMFMON Legend Messages in SPI format VST023.vsd Event Management TMF generates Event Management Service (EMS) messages. These messages convey information about an event or significant occurrence in the system or application.
Tasks for Managing TMF TMF System Management Tasks for Managing TMF Managing TMF typically involves: • • • • • • Configuring TMF Designating audited files for TMF protection Specifying compression of selected audit records Managing audit dumps and online dumps Monitoring TMF Managing the TMF catalog Configuring TMF Through TMFCOM, you can create, alter, and determine the status of audit trails, data volumes, and other objects that TMF requires or uses in its operations.
Managing Audit and Online Dumps TMF System Management When audit compression is used, programs cannot use audit-reading routines as easily. These routines have more difficulty reading the audit trails because of the decompressing work involved. Audit compression is controlled on a file-by-file basis for database files with the AUDITCOMPRESS file attribute. Managing Audit and Online Dumps When an audit trail is configured to have an audit dump process, audit dumps are created automatically, as needed.
Index A C Aborting transactions 2-8 ABORT-TRANSACTION control statement 5-12 Accessing data 5-2/5-8 After-images 1-11 Application programming languages 1-17 transaction isolation 5-3 Applications assigning roles to modules 5-9 languages used for writing servers 2-6 Audit 3-7 Audit dumps 1-13, 3-6/3-7, 3-13, 6-6 Audit records 1-11, 3-2, 6-5 Audit trail rollover 3-3 Audit trails 1-11, 1-12, 3-2/3-4, 4-5 Audit volumes active 3-2, 3-5 overflow 3-5 restore 3-5 types of 3-5 Audited files designation 6-5 dumps 3
E Index E N EMS messages 6-4 END-TRANSACTION control statement 5-12 Enscribe accessing data 5-5 and TMF 1-18 NonStop OS and TMF 1-18 NonStop SQL accessing data 5-5 and TMF 1-17 F OLTP software and TMF 1-16 Online dumps 1-13, 3-12, 3-13, 6-6 Overflow audit volumes 3-5 File recovery 1-13, 1-16, 3-13/3-15 Financial application scenario 1-14 O P G Insurance application scenario 1-15 Interfaces for managing and operating TMF 6-1 Parent Transactions 2-5 Pathmaker and TMF 1-17 Pathway and TMF 1-17 Pat
S Index Requesters (continued) role in application 5-10 single-threaded 5-8 Resource managers 2-3/2-4 RESTART-TRANSACTION control statement 5-12 Restore audit volumes 3-5 Roles of application modules 5-9 Rollover, audit trail 3-3 S Scenarios financial application 1-14 insurance application 1-15 manufacturing application 1-15 point-of-sale application 1-14 problem/solution 1-14/1-16 travel agency application 1-15 SCREEN COBOL 5-11 Serializable access 5-3, 5-4 Servers 2-6 multithreaded 5-9 role in applicat
V Index Transactions (continued) identifiers 2-9, 5-11 local 2-1 long 5-13 parent 2-5 properties of 1-8/1-10 protection 1-8, 3-16 rate versus performance 4-5 serialized 1-9 size versus performance 4-2 stages of 2-12 Travel agency application scenario 1-15 Two-phase commit protocol 2-11 V Volume recovery 1-13, 1-15, 3-10 W Writes to disk, buffered 4-3 to the audit trail, sequential 4-5 Special Characters $RECEIVE system file 2-9, 5-11 HP NonStop TMF Introduction —522414-002 Index -4