delete_old_transaction_logs.py

The delete_old_transaction_logs.py script deletes transaction log files that are obsolete because they are included in a checkpoint file. The log files are deleted until the specified target is reached or all obsolete transaction logs are removed.

The delete_old_transaction_logs.py script only removes transaction log files when it runs on the publishing pod. MATRIXX suggests adding a crontab entry to the publishing pod that periodically executes the script with the appropriate parameters.
Note: The delete_old_transaction_logs.py script does not delete transaction logs if the corresponding MATRIXX Event File (MEF) was not created. The script also removes old MEFs based on configuration settings.

Syntax

delete_old_transaction_logs.py -f min_free_space | -u max_used_space | -t max_retention_time | -m max_txn_logs | -d checkpoint_dir | -t txn_log_dir | -w seconds | -g min_GTC_to_keep | -p | -F | -n | -D ] 

Parameters

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.

Examples

Refer to the following examples for deleting old transaction logs:

Restrict transaction Log Disk Usage to 2.5 Gigabytes on Server 1:1:1

run_cmd_on_blade.py -b 1:1:1 "delete_old_transaction_logs.py -u 2.5G"

Delete Obsolete Transaction Log Files on the Local Server

delete_old_transaction_logs.py -u 0B

Keep at least 10% of the Disk Free

delete_old_transaction_logs.py -f 10%