Detect Transaction Modifications With the Transaction Log API

TimesTen Classic provides a Transaction Log API (XLA) that enables applications to monitor the transaction log of a database to detect changes made by other applications.

XLA also provides functions that enable XLA applications to apply the detected changes to another database. XLA is a C language API. TimesTen Classic provides a C++ wrapper interface for XLA as part of TTClasses, as well as a separate Java wrapper interface.

Applications use XLA to implement a change notification scheme. In this scheme, XLA applications can monitor a database for changes and then take actions based on those changes. For example, a TimesTen database in a stock trading environment might be constantly updated from a data stream of stock quotes. Automated trading applications might use XLA to monitor the database for updates on certain stock prices and use that information to determine whether to process orders. See TimesTen Classic Application Scenario for a complete example.

XLA can also be used to build a custom data replication solution in place of the TimesTen replication. Such XLA-enabled replication solutions might involve replicating data to a non-TimesTen database.

See XLA and TimesTen Event Management in the Oracle TimesTen In-Memory Database C Developer's Guide and Using JMS/XLA for Event Management in Oracle TimesTen In-Memory Database Java Developer's Guide.

For more information about TTClasses, see Using XLA in TTClasses in the Oracle TimesTen In-Memory Database TTClasses Guide.

The following sections describe how XLA works in TimesTen Classic:

How XLA Works

XLA obtains update records for transactions directly from the transaction log buffer. If the records are not present in the buffer, XLA obtains the update records from the transaction log files.

Readers use bookmarks to maintain their position in the log update stream. Bookmarks are stored in the database, so they are persistent across database connections, shutdowns, and failures. As described in When Are Transaction Log Files Deleted?, the presence of an XLA bookmark prevents transaction log files from being deleted until the XLA log records in that transaction log file have been read and acknowledged by the XLA application.

See Figure 8-1.

Log Update Records

Update records are available to be read from the log as soon as the transaction that created them commits.

A log monitoring application can obtain groups of update records written to the log. Each returned record contains a fixed-length update header and one or two rows of data stored in an internal format. The update header describes:

  • The table to which the updated row applies

  • Whether the record is the first or last commit record in the transaction

  • The type of transaction it represents

  • The length of the returned row data

  • Which columns in the row were updated