1. Introduction to Database Link#
This chapter explains the concept of database links and the database link components of Altibase.
Related Terms#
This section introduces the terms you need to know to use Altibase database links.
-
Altibase Distributed Database System
This is a system composed of two or more database server nodes, including at least one or more Altibase server nodes.
-
Remote Node
This is the target server or system connected through the database link. An Altibase server or a heterogeneous database system can be used as the remote node. In this case, it is not necessary for the target server or system connected through the database link to exist in a physically separate machine. The target database server can be referred to as the remote node even when both the local server and the target database server exist in one machine.
-
Remote Server
Altibase Database link distinguishes between the meaning of remote node and a remote server. A remote node refers only to a target database server connected by a database link, whereas a remote server refers to a database server that is logically divided regardless of the database link connection.
-
Link
This is the connection between servers through the database link.
-
Link Object
This is the database link object created on the local database, to connect to the target database server
-
Local Server
This is the database server that creates and uses the database link object. Only Altibase server can be the local server.
-
Linker Process
This takes charge of the communication between the local server and the remote server, when a database system composed of heterogeneous DBMSs is built. This process runs on the local server and is also referred to as AltiLinker.
-
Linker Session
This is the 1:1 session created between the Altibase server and the AltiLinker process. The Linker Session is classified as either a Linker Control Session or a Linker Data Session.
-
Location Descriptor (@)
This is a character used to express the database link in a SQL statement. The location descriptor can be used by placing an '@' between the object name and the database link name.
-
Global Transaction
This transaction is composed of a SQL statement which is executed on the local server and a SQL statement which is executed at the remote node.
-
Local Transaction
This is a transaction which is composed of statements executed and completed on the local server.
-
Remote Transaction
This transaction is composed of a SQL statement which is executed on the local server and a SQL statement which is executed at the remote node.
-
Global Commit Node
This node commits or rolls back global transactions. This is the node on which the user usually creates the database link and starts a global transaction.
-
REMOTE Statement
This is the SQL statement which is passed through the database link and executed on the remote server.
-
Remote Statement
This is the SQL statement which is passed through the database link and executed on the remote server.
-
Participant
The participant indicates a remote database system of a global transaction performed among database systems.
Definition of Database Links#
This section introduces the concept of database links, how it processes and describes the Altibase distributed database system.
Concept of Database Links#
Altibase Database Link is a technical element of two or more independently running database servers connected through the network, wherein the local server requests for logically relevant data to and receives results from the remote server.
To run independently means that each database system has its own data storage area and is capable of processing the user's request independently. To be connected through the network means that two logically separate systems or servers are capable of accessing each other. To be logically related means that a correlation exists among the distributed data in the individual node.
How Database Links Process#
The following is an overview of how the Altibase database link is processed:
When a query is entered into the server that created the link object, the required data is retrieved from the remote server through the database link process, and the final query result is returned to the user. In the process, the end user logically perceives that one server is running.
The Altibase database link is primarily composed of the following four elements, shown in the dark in the figure below. The DK module and the AltiLinker process are described in detail in the following sections.
-
DB-Link Module
-
AltiLinker: a linker process implemented in Java
-
ADLP: Altibase Database Link Protocol
-
dblink.conf: the properties file for database links
[Figure 1-1] The database link process (Heterogeneous Link)
Concept of the Altibase Distributed Database System#
The Altibase distributed database system is composed of two or more logically separate database servers, with at least one server being an Altibase server. It is mandatory for the database creating and using the database link to be Altibase. The connection target server can be either the Altibase server or a heterogeneous database system of another company.
Depending on whether or not the remote server, which is connected through the database link by Altibase in a local server, is an Altibase server of the same version, the database link is classified as either a Homogeneous Link or a Heterogeneous Link. Each link contains the following mechanisms.
Heterogeneous Link#
A Heterogeneous Link refers to the connection between the Altibase server and a heterogeneous database server. If the version of the remote server database and the local server is different, regardless of the remote server database being Altibase, a heterogeneous link is established. A Heterogeneous Link is possible between Altibase servers of the same version.
Homogeneous Link#
A Homogeneous Link refers to the connection between Altibase servers using protocol of the same version.
A Homogeneous Link directly connects to servers without passing through AltiLinker. Thus, its performance is better than the Heterogeneous Link, and the performance gap gets bigger as the remote node is accessed more frequently.
Altibase 6.5.1 does not support Homogeneous Links.
The following table displays the full names and meanings of the notations used in this document.
Notation | Full Name | Meaning |
---|---|---|
DB-Link | Altibase Database Link | Altibase Database Link |
Heterogeneous-Link | Heterogeneous Database Link | Database link between an Altibase server and a heterogeneous database system |
Homogeneous-Link | Homogeneous Database Link | Database link between Altibase servers of the same version |
Heterogeneous DBMS | Heterogeneous database management system | Heterogeneous database management system, which includes Altibase servers of versions that differ from the local server |
Components of Altibase Database Link#
Among the components of the Altibase DB Link, this section describes the Database Link Module and the AltiLinker process.
Database Link Module#
The Database Link Module(DK Module) is a module which implements the database link within the Altibase server. This module manages sessions for connection to the remote server in a distributed database system environment, database link objects which represent connection to the remote server, transactions processed through the database link, information to be provided to various performance views, record sets retrieved as the result of a remote query execution and so on. Further information for each of the following is provided in the next section.
- Link Object Management
- Linker Session Management
- Information Management of Performance Views
- Global Transaction Management
- Recovery of Distributed Transaction
- Data Management of Result Sets
Link Object Management#
In Altibase, link objects are schema objects. The creation and deletion of link objects are possible with SQL statements; further information on each SQL statement is provided in Chapter 4. How to Use Database Links.
Altibase provides the following two privileges on link objects.
Type | Granted Users | Description |
---|---|---|
PRIVATE Database Link | The user who created the link object and the SYS user | Only the user who created the given link object or the SYS user can use or delete PRIVATE link object |
PUBLIC Database Link | All user | All users can use the PUBLIC link object. However, only the user who created the given link object or the SYS user can delete it. |
Linker Session Management#
The Altibase DK Module creates a linker session to connect to the AltiLinker process, and monitors the connection status of the linker session whenever a user session refers to the database link.
The following figure shows the sessions that are created in the DK Module and the AltiLinker process for the purpose of handling a SQL statement using the database link that is executed by the client.
[Figure 1-2] Sessions within the DK module and the AltiLinker process
Information Management of Performance Views#
The user can check database-related information by referring to the performance views. Information of the performance views managed for database links by Altibase is listed below.
Database Link Object Information#
This is information on the database link object created in the database and is provided to the user through the V$DBLINK_DATABASE_LINK_INFO performance view.
Linker Session Information#
This is information on the linker session created in the DK module and is provided to the user through the V$DBLINK_LINKER_SESSION_INFO performance view.
The linker session can be classified as either a Linker Control Session or a Linker Data Session. The Linker Control Session is a singular creation and exists between the Altibase server and the AltiLinker process, until the AltiLinker process is terminated. On the other hand, one Linker Data Session is created for each user session that uses the database link.
-
Linker Control Session Information
This is information on the status of the Linker Control Session and is provided to the user through the V$DBLINK_LINKER_CONTROL_SESSION_INFO performance view. The Linker Control Session terminates the AltiLinker process, requests status information of the AltiLinker, changes settings of the AltiLinker, and etc.
-
Linker Data Session Information
This is information related to the Linker Data Session and is provided to the user through the V$DBLINK_LINKER_DATA_SESSION_INFO performance view.
Transaction Information#
-
Global Transaction Information
This is information on the status of global transactions and is provided to the user through the V$DBLINK_GLOBAL_TRANSACTION_INFO performance view.
-
Remote Transaction Information
This is information on the status of all remote transactions being executed on the remote node through the database link and is provided to the user through the V$DBLINK_REMOTE_TRANSACTION_INFO performance view.
-
Remote Statement Information
This is information on all statements being executed on the remote node through the database link and is provided to the user through the V$DBLINK_REMOTE_STATEMENT_INFO performance view.
AltiLinker Process Information#
This is information on the dynamic status of the AltiLinker process, and is provided to the user through the V$DBLINK_ALTILINKER_STATUS performance view. Apart from information related to the connection status, information related to the JVM memory currently being used by the AltiLinker process is also included.
Global Transaction Management#
The concept of transactions in Altibase Database Link can be classified as either global transactions or remote transactions.
A global transaction is a transaction which contains one or more remote transactions being executed on the remote server through the database link that exists in a local server. Altibase Database Link implements ADLP, a protocol for Altibase Database Link, to process global transactions.
A remote transaction is a transaction composed of statements executed on the remote server through the database link, and make up the global transaction.
ADLP (Altibase Database Link Protocol)#
ADLP defines the methods for data exchange and process between the Altibase server and the AltiLinker process. The following tasks are included:
- Linker Session Control
- Remote Transaction Control
- Remote Statement Execution
- AltiLinker Process Control
To complete a global transaction, transactions on every server(local and remote) participating in the global transaction must be completed(committed or rolled back) at once. This can lead to data integrity being at risk if an error occurs on any one of the servers. Altibase Database Link provides the following three levels of execution mechanisms for global transactions, depending on how much of the protocol is shared between the local server and the remote server.
-
Remote Statement Execution Level
The Remote Statement Execution Level guarantees, not the global consistency of global transactions, but the execution of statements on a remote node through the database link. At this level, a statement being executed on the local server and a statement being executed on a remote server through the database link within one global transaction are processed as separate transactions.
When the DBLINK_GLOBAL_TRANSACTION_LEVEL property is set to this level, autocommit mode is set to ON by default for the session which AltiLinker connects to the remote server. -
Simple Transaction Commit Level
Of Altibase Database Link, the Heterogeneous Link implements the simple transaction commit mechanism to enforce the principle of atomicity of the transaction between the Altibase and the heterogeneous database system. This level is similar to the Two-Phase Commit Level. Whereas the Two-Phase Commit Protocol exchanges messages between servers to prepare for the COMMIT command, the Simple Transaction Commit only checks whether or not the COMMIT or rollback command can be sent to the remote node.
For the Simple Transaction Commit Level to operate, the database system making up the remote node must support setting the auto-commit mode to OFF.
When the DBLINK_GLOBAL_TRANSACTION_LEVEL property is set to this level, autocommit mode is set to OFF by default for the session which AltiLinker connects to the remote server. -
Two-Phase Commit Level
This feature provides the Two-Phase Commit protocol which ensures interoperable compatibility of the global transaction between Altibase server and other database system. This feature is available after setting the DBLINK_GLOBAL_TRANSACTION_LEVEL property to 2(Two-Phase Commit). The Two-Phase Commit process is demonstrated in the figure below.
[Figure 1‑3] Two-Phase Commit Level
-
Prepare Phase
Altibase writes prepare log after the user has executed a commit, and sends a requesting message to AltiLinker for preparation. Then, the AltiLinker receives the message, and sends a preparation message to all the participants related to the global transactions. After the participants have been prepared, AltiLinker delivers a ready message for system to Altibase, which has received results from all the participants, in order to perform the next phase.
-
Commit Phase
Altibase writes a commit log and sends commit requesting message to AltiLinker. Then, AltiLinker enables all the participants to execute, and sends the commit message until the participants will have executed. When the participants successfully commit, a success message will be sent to Altibase, and this means the transaction has been completed; thus, the end log is recorded applying the results. That is to say, the transaction recorded with end log cannot be able to conduct fault restoration.
-
Altibase provides information on global transactions, remote transactions and the transaction process status through performance views.
Recovery Of Distributed Transaction#
A point of failure is based upon the 2PC, and the failure target should be both Altibase and participant, the remote database system. It is considered that a failure occurred to a participant when there is no response during a certain period of time specified by ALTILINKER_RECEIVE_TIMEOUT during the exchanging messages of Altibase and the participant.
Before writing the preparation logs#
When failure occurs in Altibase, a distributed transaction is written in the log, but all the remote transactions participating with no trace in the log are called off. Besides, the local transactions being executed are also called off writing the end log.
After writing the preparation logs - Before writing the commit log#
In the case of failure in Altibase, a distributed transactions is recorded in the log; however, the commit log and roll back log are not recorded. All the remote transactions are recovered in order to ensure the interoperable compatibility in a situation in which the commit logs are not written. If there is failure occurred to a participant, Altibase attempts to conduct recovery of the remote transaction by transmitting messages until the participant receives a rollback message. Then, Altibase writes the end log in order to ensure the recovery. In the case of failure occurred to a participant, Altibase sends a message for the participant's transaction to recover. Moreover, when an error raised on AltiLinker, the status of all remote transactions cannot be figured out, and roll back is executed. Then, the end log is written since the commit logs of all the transactions had not been recorded.
After writing the commit log - Before writing the end log#
Commit and roll back logs of the distributed transactions are written, but the end log is not written in the case of the failure in the commit phase. Altibase consistently attempts to commit or roll back not receiving a response of the commit message. Afterwards, Altibase writes the end log when the commit or rollback is completed.
Data Management of Result Sets#
The Altibase DK Module provides the functionality of processing data exchanged between the local server and the remote server through the database link. The DK Module processes the following data:
-
Control Data
The data required for each operation defined in the ADLP which is internally created and exchanged between the DK module and the AltiLinker process.
-
User Data
Property values, strings of statements to be executed on the remote server, bind variable values, and etc.
-
Remote Data
The result data executed on the remote server which the DK Module receives.
The process of such data is largely classified into the buffering of remote data received as the result of a query executed on the remote server, and the conversion of all data types exchanged between the Altibase server and the AltiLinker process.
The conversion of types is executed according to the data specification of each operation defined in the ADLP. In the case of remote data, each type within the result set of the query executed by the remote server is converted to the mapping Altibase server type.
The buffering of remote data uses a memory buffer (DK buffer) of a fixed size which is internally managed by the DK Module and the disk temporary table. The user can adjust the size of the DK buffer to be used for the database link with properties. Once the buffer size is set, it cannot be changed while Altibase is running; therefore, it should be decided before starting the server, giving due consideration to memory resources and performance. The DK buffer is composed of more than one data buffer block, and the minimum size and number of data buffer blocks can be specified with properties.
The AltiLinker Process#
AltiLinker is a java application program, included and distributed with the Altibase package. The AltiLinker process operates for the Heterogeneous Link, and is responsible for the communication between the heterogeneous database system or the remote server connected through the link object and the Altibase server in which the link object exists.
AltiLinker is a feature provided by Altibase Database Link for the Heterogeneous Link and has the following characteristics:
- Errors raised on a heterogeneous database server connected through the database link do not affect the Altibase server.
- AltiLinker accesses remote databases via the JDBC interface; thus, all database systems supportive of JDBC are accessible through Altibase Database Link.
To activate the AltiLinker process, the following two properties must be set.
Property | Value | Properties File |
---|---|---|
DBLINK_ENABLE | 1 (0 : disable) | altibase.properties |
ALTILINKER_ENABLE | 1 (0 : disable) | dblink.conf |
The following is a brief summary of the role of the AltiLinker process.
- Connects to the heterogeneous database system through the JDBC driver.
- Executes operations requested from the Altibase server through the ADLP protocol.
- Delivers the results of queries executed on the remote node to the Altibase server
Notes#
- Since the AltiLinker process accesses the database of the remote server with the JDBC interface, the JDBC driver provided by the given database vendor is a prerequisite.
- The AltiLinker process only runs on the same server as the local server.