Limiting the Transaction Log File Size
In releases prior to Netvsior ONE version 6.1.0, Pluribus had not restricted the size of the transaction log files, due to which the transaction files increased in size occasionally on some customer premises, causing memory issues.
This issue occurs when some commands such as stp-port-modify and transaction-settings-modify commands are executed in a loop. These commands do not cause any changes to the configuration after the command is executed for the first time, but the transaction log file is appended every time the command is executed adding duplicate entries and causing the file to grow.
Starting with Netvisor ONE version 6.1.0, this limitation is corrected by enabling you to limit the file size of the transaction logs. You can truncate the transaction log file to a desired number of entries by using the transactions-settings-modify command depending upon your configuration. By default, this functionality is disabled.
Depending upon the limit you set (for example N entries), the transaction log file limits the log entries to the latest N entries. Further, Netvisor ONE adds an additional X entries to the threshold limit of N entries you have configured. When the threshold of N+X limit is crossed, the first X entries gets overwritten by the newest or latest entries.
This functionality is supported only on local xact log file (local scoped configurations).
Warning: If you set the transaction limit (N), you may lose the older entries in the transaction log file and hinder the rollback possibility. However, this feature is available only for local transaction log files.
Note: If you do not set the threshold limit, then this functionality remains disabled and there is no limit enforced on the log file size.
To restrict the transaction log file size, you can set a limit by using the transactions-settings-modify command:
CLI (network-admin@switch) > transactions-settings-modify max-local-xact-log-entries max-local-xact-log-entries-number
Where, the max-local-xact-log-entries is the maximum number of entries (N) to be added to the transaction log file (xact_log file).
Note: The default value of max-local-xact-log-entries is 0, which means, the feature is disabled.
As explained earlier, an additional X entries are saved by Netvisor ONE before truncating the log file size. Netvisor ONE has set the value of X to 100 entries. That is, for example, if you set the max-local-xact-log-entries to 500 entries, then an additional 100 entries are also saved (see N+X explanation above) to the log file before Netvisor enforces the truncation process of the local-xact-log file. When the threshold is crossed, the file gets truncated by deleting the previously stored additional X (100) entries.
A warning message is written to the nvOSd.log/perror.log file:
- When the entries in the transaction log file exceeds the configured value (N).
- When the entries exceed the N+X value and Netvisor truncates the X entries.
To truncate the local xact log file to a given tid (N), use the command:
CLI (network-admin@switch) > transaction-log-file-truncate-to trunc_tid trunc_tid-number
Where the trunc_tid is the transaction ID (the latest tid entries are retained when this feature is enabled)
Note: All truncated commands are written to a new file /nvOS/log/xact-truncate.log.
To view the total entries in the file, use the command:
CLI (network-admin@switch) > transaction-show transaction-scope local count-only
Where, count-only is the formatting option to display only the number of transaction entries.
General Guidelines while Configuring this Feature:
- Only the transactions in transaction-show transaction-scope local output and in /var/nvOS/etc/Local/xact_config.log file are removed. All the configurations remain intact.
- Transaction rollback is possible even after the log file is truncated to an available TID. Note that the TIDs get renumbered after truncation.
Sample Configuration
Below is a sample configuration for further understanding:
- First view the transaction details using the command:
CLI (network-admin@switch) > transaction-show transaction-scope local count-only
Count: 3
- Use the below command to view the transaction details:
CLI (network-admin@switch) > transaction-show transaction-scope local
start-time: 2021-03-04,16:07:58.030
tid: 1
trunc_tid: 0
state: commit
command: switch-setup-modify eula-accepted true eula_timestamp 2021-03-04,16:07:57
undo-command: switch-setup-modify eula-accepted false eula_timestamp 1969-12-31,16:00:00
----------------------------------------
start-time: 2021-03-09,06:05:23.932
tid: 2
trunc_tid: 0
state: commit
command: stp-port-modify port 31 edge
undo-command: stp-port-modify port 31 no-edge
----------------------------------------
start-time: 2021-03-12,01:56:30.020
tid: 3
trunc_tid: 0
state: commit
command: vlan-create id 3040 type public vxlan-mode standard scope local stats
undo-command: vlan-delete id 3040
- Use the command to set the max-local-xact-log-entries to 50:
CLI (network-admin@switch) > transactions-settings-modify max-local-xact-log-entries 50
View the details using the command:
CLI (network-admin@switch) > transaction-show transaction-scope local count-only
Count: 150
The count 150 indicates the additional 100 (N+X).
You can verify the transactions using REST API commands as well.