Delete Old Transaction Logs

After a checkpoint is created and has a consistent state of the database for all transactions in one or more logs, run the delete_old_transaction_logs.py script to delete the old logs. This helps to prevent the shared storage from filling up.

About this task

Note: Be sure you save or process the events you need before deleting their transaction files. Deleting old transaction logs limits the recovery of Streamed Event Files (SEFs) that are the basis for streamed events, MATRIXX Event Files (MEFs), and events loaded into the Event Repository.

The delete_old_transaction_logs.py script uses several default values to delete transaction logs, which are listed in the following parameter table. When running the script, only specify the -f or -u parameter and any other parameters for which to override the default value.

This procedure describes how to run the script manually. You can also run the delete_old_transaction_logs.py script as a crontab entry or specify it in a wrapper script. Running the script with a dry-run option provides information about the operations the script performs, without performing them, allowing you to confirm that the script deletes the correct transaction logs when it runs.

Important: Perform this task only on a publishing server.

Procedure

In a terminal, run the following command to run the script across all servers in the active cluster. Only specify the command line options for the values to change, providing the necessary values.
delete_old_transaction_logs.py {-f min_free_space | -u max_used_space }[-d checkpoint_dir | -w seconds | -p | -F | -n | -D] 
Command Line Option Description
-f, --min_free Removes all obsolete transaction logs until the specified amount of free disk space is reached. Specify the value as a floating point number followed by one of the following unit specifiers:
  • B — Bytes (1024^0 bytes)
  • K — Kilobytes (1024^1 bytes)
  • M — Megabytes (1024^2 bytes)
  • G — Gigabytes (1024^3 bytes)
  • T — Terabytes (1024^4 bytes)
  • % — Percent of the usable file system
-u, --max_used Removes obsolete transaction logs until the allowable amount of disk space used by transaction logs is reached. Specify the value as a floating point number followed by one of the listed unit specifiers.
-m --max_txn_logs (Optional) The maximum number of transaction logs to keep before deleting logs. The default script value is 1000.
-t --max_retention_time (Optional) The maximum number of days or hours to keep transaction logs before deleting them, for example, 20d for 20 days or 10h for 10 hours. The default script value is 30 days.
-d, --shared_directory The full path in the shared storage where the checkpoints and transaction logs are stored. This directory exists in the shared storage and must match the value defined in the MATRIXX configuration file (mtx_config.xml). Normally, the default value in the mtx_config.xml file is correct and this parameter is not needed. The default script value is mnt/mtx/shared_01
-w, --wait_time The number of milliseconds to wait between file deletions. This option is used to limit the impact of the script on the disk subsystem. The default script value is 10.
-p, --priority By default, the delete operation runs as the lowest CPU and IO priorities so the operation does not interfere with transaction processing. This option causes the process to run at typical priority.
-F, --force Runs the command even if it is run on a non-publishing pod. Normally, this option is not needed and can result in serious damage to the system. Consult MATRIXX Support representative before running the script with this option.
-n, --dry-run Tests the operation without removing any log files. This parameter returns results information about what the script does when it runs. MATRIXX Support suggests not specifying this parameter in a crontab entry or wrapper script. Consult MATRIXX Support before running the script with this option.
-D, --debug Prints debug messages about the script's progress to help identify any issues. MATRIXX suggests not specifying this parameter in a crontab entry or wrapper script.
-g Deletes all Global Transaction Counters (GTCs) that are smaller than the specified number, for example, -g min_GTC_to_keep.

If you use a crontab entry to run the script, the next time the cron job runs, the new configuration settings are used.