A banking database application frequently performs a transaction that includes three writes to database files: a debit to one account, a credit to another account, and a note to a log. The application must complete all three writes to maintain database integrity. However, hardware or power failure can interrupt such a transaction, causing database corruption.
NetWare file servers that include TTS can track transactions and ensure file integrity by backing out (or erasing) interrupted or partially completed transactions. TTS tracks only transactions for transactional files. A file becomes transactional when the file's Transactional extended file attribute is set. See Set File Extended Attribute (function 79) and Scan File Information (function 23, subfunction 15) in the File Services section.
TTS is divided into two categories: implicit transaction tracking and explicit transaction tracking.
Implicit transaction tracking requires no special coding on the part of an application developer. If TTS is installed and enabled on a file server, TTS tracks all transactions to all transactional files (including transactions made by NetWare to bindery files).
Explicit transaction tracking requires applications to make TTS system calls. By making both TTS and locking system calls, an application can bracket file update sequences. An application will most likely use logical or physical record locks in conjunction with TTS system calls.
The following steps describe how TTS tracks each write within a transaction:
The file server repeats these steps for each write within a transaction. The transaction work file grows to accommodate the old data for each write. If the transaction is interrupted, the file server writes the contents of the transaction work file to the target file, restoring the file to its pretransaction condition. In effect, the file server backs out the transaction.
A file server can monitor from 1 to 200 transactions at a time. This value is configurable when the file server operating system is generated and can be set to 50 through 200. A file server can track only one transaction at a time for each workstation DOS task. The file server places transactions that are not being serviced in a queue.
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (3) byte
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Successful 253 0xFD Transaction Tracking Disabled 254 0xFE Transaction Restart 255 0xFF Lock Error
Remarks
This call aborts explicit and implicit transactions. If a transaction is aborted, all writes made since the beginning of a transaction are cancelled, and all files are returned to the state they were in before the transaction began.
This function releases the following record locks:
Physical record locks generated by the file server when an application
tried to write to an unlocked record
Physical or logical locks that have not been released because of a filew write
For explicit transactions, the transaction is backed out, and any locks being held are released.
For implicit transactions, if the number of logical or physical records still locked exceeds the threshold, this function returns a Completion Code of 0xFE (Transaction Restart). In this case, the transaction is backed out, and the file server automatically starts a new implicit transaction.
See Also
TTS Begin Transaction (0x2222 34 01)
TTS End Transaction (0x2222 34 02)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (1) byte
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Successful
Remarks
This call begins an explicit transaction.
After this function is called, TTS tracks all files that are currently open, as well as any files that are opened during the transaction. When an application writes to a transaction file, the file server automatically generates a physical record lock for any file that isn't already locked. Locked files remain locked.
Transaction files are not closed and unlocked until TTS End Transaction or TTS Abort Transaction is executed.
If transaction files are updated, logical and physical record locks are held until the end of the transaction. If a transaction file is not updated, the logical or physical lock on that file can be released.
See Also
TTS Abort Transaction (0x2222 34 03)
TTS End Transaction (0x2222 34 02)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (2) byte
Reply Format
Offset Content Type (reply header) 8 TransactionNumber long (Hi-Lo)
Completion Code
0 0x00 Successful 255 0xFF Lock Error
Remarks
This call ends an explicit transaction and returns a Transaction Number. A transaction is not necessarily completed to disk when this function returns. The returned Transaction Number can be used by TTS Transaction Status (function 34, subfunction 4) to verify a successful transaction completion to disk.
If the file server fails before all transaction updates are written to disk, the transaction will be backed out when the file server is rebooted, unless transaction tracking is disabled.
TTS End Transaction releases the following record locks:
For explicit transactions, the transaction is backed out, and any locks being held are released.
For implicit transactions, if the number of logical or physical records still locked exceeds the threshold, this function returns a Completion Code of 0xFE (Transaction Restart). In this case, the transaction is backed out, and the file server automatically starts a new implicit transaction.
See Also
TTS Abort Transaction (0x2222 34 03)
TTS Begin Transaction (0x2222 34 00)
TTS Transaction Status (0x2222 34 04)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (5) byte
Reply Format
Offset Content Type (reply header) 8 LogicalLockThreshold byte 9 PhysicalLockThreshold byte
Completion Code
0 0x00 Successful
Remarks
This call allows an application to determine the number of logical and physical record locks allowed before an implicit transaction begins. That is, if a threshold value is 0, an implicit transaction will begin when the first lock is made for that particular lock type; if a threshold value is 100, an implicit transaction will begin when the 101st lock is made, and so on.
This call and TTS Set Application Thresholds (function 34, subfunction 6) can be used by applications to change the implicit application thresholds and, later, to restore them.
For example, TTS Get Application Thresholds can query an application for the number of logical and physical record locks allowed before an implicit transaction begins. TTS Set Application Thresholds can then do either of the following:
(Applications that use only explicit transactions, but that sometimes generate
unnecessary implicit transactions, should turn off all implicit transactions.)
The default threshold for logical and physical locks is 0. A threshold value of 0xFF means implicit transactions for that lock type are not in effect.
The thresholds returned by this call are valid for the requesting application only. When the application terminates, the workstation thresholds are restored.
See Also
TTS Set Application Thresholds (0x2222 34 06)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (9) byte
Reply Format
Offset Content Type (reply header) 9 ControlFlags byte
Completion Code
0 0x00 Successful
Remarks
This call returns the transaction bits (Control Flags) for a task. Currently, only bit 0 is used. If bit 0 of the Control Flags byte is set, forced record locking is "on." The default state of forced record locking is "on." Bits 1 through 6 are currently reserved.
See Also
TTS Set Transaction Bits (0x2222 34 10)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (7) byte
Reply Format
Offset Content Type (reply header) 8 LogicalLockThreshold byte 9 PhysicalLockThreshold byte
Completion Code
0 0x00 Successful
Remarks
This call allows a station to determine the number of logical and physical record locks allowed before an implicit transaction begins. That is, if a threshold value is 0, an implicit transaction will begin when the first lock is made for that particular lock type; if a threshold value is 100, an implicit transaction will begin when the 101st lock is made, and so on.
This call and TTS Set Workstation Thresholds (function 34, subfunction 8) can be used by applications to change the implicit workstation thresholds and, later, to restore them.
Logical Lock Threshold and Physical Lock Threshold contain the number of logical and physical record locks allowed before an implicit transaction begins.
For example, TTS Get Workstation Thresholds can get the number of logical and physical locks, and TTS Set Workstation Thresholds can do either of the following:
(Applications that use only explicit transactions, but that sometimes generate unnecessary implicit transactions, should turn off all implicit transactions.)
The default threshold for logical and physical locks is 0. A threshold value of OxFF means implicit transactions for that lock type are not in effect.
The threshold values set by TTS Set Workstation Thresholds are not reset when the application terminates. In other words, all applications on the requesting workstation share these same thresholds.
Threshold numbers are set to zero when the End Of Job function is processed. DOS workstation users normally use the SETTTS.EXE utility to set workstation thresholds.
See Also
TTS Set Workstation Thresholds (0x2222 34 08)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (0) byte
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Transaction Tracking Unavailable 253 0xFD Transaction Tracking Disabled 255 0xFF Transaction Tracking Available
Remarks
This call verifies whether the default file server supports transaction tracking. The status of transaction tracking can be available, not available, or disabled.
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (6) byte 8 LogicalLockThreshold byte 9 PhysicalLockThreshold byte
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Successful 150 0x96 Server Out Of Memory
Remarks
This call allows an application to specify the number of logical and physical record locks allowed before an implicit transaction begins. That is, if a threshold value is set to 0, an implicit transaction will begin when the first lock is made for that lock type; if a threshold value is set to 100, an implicit transaction will begin when the 101st lock is made, and so on.
This call and TTS Get Application Thresholds (function 34, subfunction 5) can be used by applications to change the implicit application thresholds and, later, to restore them.
The thresholds set by this call are valid for the requesting application only. When the application terminates, the workstation thresholds are restored.
This call can be used to turn off implicit transactions or to allow applications that always keep one or more records locked to function. For example, applications that use only explicit transactions, but that sometimes generate unnecessary implicit transactions, can use this function to turn off all implicit transactions.
The default threshold for logical and physical locks is 0. A threshold value of OxFF means implicit transactions for that lock type are not in effect.
See Also
TTS Get Application Thresholds (0x2222 34 05)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (10) byte 8 ControlFlags byte
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Successful
Remarks
This call allows a client to alter the transaction bits represented by the Control Flags byte. Currently, only bit 0 is used. If bit 0 of the Control Flags byte is cleared, forced record locking is "off." To turn forced record locking back on, a client must set bit 0 of the Control Flags byte. The default state of forced record locking is "on." Bits 1 through 6 are currently reserved.
See Also
TTS Get Transaction Bits (0x2222 34 09)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (8) byte 8 LogicalLockThreshold byte 9 PhysicalLockThreshold byte
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Successful
Remarks
This call allows an application to specify the number of logical and physical record locks allowed before an implicit transaction begins. That is, if a threshold value is set to 0, an implicit transaction will begin when the first lock is made for that particular lock type; if a threshold value is set to 100, an implicit transaction will begin when the 101st lock is made, and so on.
This call and TTS Get Workstation Thresholds (function 34, subfunction 7) can be used by applications to change the implicit workstation thresholds.
The thresholds set by this function are valid not only for the requesting application, but for all applications at the requesting workstation.
This call can be used to turn off implicit transactions or to allow applications that always keep one or more records locked to function. For example, applications that use only explicit transactions, but that sometimes generate unnecessary implicit transactions, can use this function to turn off all implicit transactions.
The default threshold for logical and physical locks is 0. A threshold value of OxFF means implicit transactions for that lock type are not in effect.
Threshold numbers are set to zero when an End Of Job call is made. DOS workstation users normally use the SETTTS.EXE utility to set workstation thresholds.
See Also
End Of Job (0x2222 24 --)
TTS Get Workstation Thresholds (0x2222 34 07)
| v2.x | v3.x | v4.x | v5.x |
Request Format
Offset Content Type (request header) 6 FunctionCode (34) byte 7 SubFunctionCode (4) byte 8 TransactionNumber long (Hi-Lo)
Reply Format
Offset Content Type (reply header)
Completion Code
0 0x00 Successful
Remarks
This call verifies whether a transaction has been written to disk. Transaction Number is the number returned by calling TTS End Transaction (0x2222 34 02).
TransactionNumber contains a number assigned and used by the NetWare operating system to track each transaction.
Because of the file server caching algorithms, 3 to 5 seconds (or longer) may elapse before transactions are actually written. Transactions are written to disk in the order in which they are ended.
See Also
TTS End Transaction (0x2222 34 02)