X100 Write-Ahead Log
X100 keeps information on the internal state of the database in the Write-Ahead Log (WAL), which is stored in the wal directory. The wal directory exists for each database and is located in the database directory of the default data location. The wal directory contains the main.wal file and the pdts subdirectory. The pdts subdirectory contains per-partition wal files that store PDTs.
The WAL is similar to that used by other database systems, but also holds other critical information.
Important! Deleting or modifying the wal directory may lead to irreversible data loss.
Old WAL Files
The main.wal file grows as DDL and DML queries make changes to the database. When the file grows significantly, the system tries to shrink its size by creating a new, smaller version of it. For recovery, previous versions of the file are saved in the main_wal_backups directory of the default data location.
Each file in the main_wal_backups directory is named using its creation timestamp. When the total size of the files in the directory exceeds the configuration parameter
max_old_log_size (on
max_old_log_size), the oldest files in the directory are automatically deleted.
The files in the main_wal_backups directory can be manually removed without adversely affecting the data in the database. Nevertheless, we recommend keeping at least one or two most recent files as backups for database recovery.
WAL Condensation
WAL condensation can be triggered manually by issuing the following statement:
CALL X100 (CONDENSE_LOG)
A backup copy of the main.wal file is stored in the main_wal_backups subdirectory, and then the main.wal file is compacted by dropping unused information.
The files stored in the pdts directory are not affected by the condensation. They are cleaned (removed) automatically when the PDT data stored inside is no longer needed, for example, after update propagation.
wal_backups Directory
The wal_backups directory is created on system startup whenever the system detects that the last condensation of the transaction log did not finish completely. Each subdirectory of wal_backups corresponds to one occurrence of such a situation.
The subdirectories may contain all or a subset of the following files: main.wal, main.wal.orig, location_map, location_map.orig, and the contents of the wal/pdts subdirectory. These are copies of the files found in the wal directory at startup.
The directory and its contents is a fail-safe mechanism that allows the database to be restored to its state following the last unfinished condensation of the transaction log. Normally the system handles such a situation automatically. If the automated mechanism fails, restoration must be performed manually with the assistance of Actian Support. Such a situation is unlikely.
Existence of the wal_backups directory simply means that the server terminated abnormally while the condensation of the transaction log was in process. If the system starts and works correctly, the wal_backups directory can be removed completely. If the system is unable to start, the data in wal_backups should be retained.