Prune transaction log

Problem:

An UCS master records each transaction done by the univention-directory-notifier. In larger environments with a high count of LDAP changes, the size grows steadily.

Possible footnotes can be:

  • The join of new UCS systems is slow.
  • The start of the univention-directory-notifier daemon may be slow.

Solution:

If each system in the domain is (mostly) at the same replication level (see UCS manual: Analysis of listener/notifier problems for further analysis in doubt) you can safely downsize the transaction file by keeping only the last 10000 transactions. To do so you may use these steps at the DC Master:

root@ucs:~# tail -n 10000 /var/lib/univention-ldap/notify/transaction | head -n1
80802 relativeDomainName=ucs-sso,zoneName=domain.tld,cn=dns,dc=domain,dc=tld m

# /usr/share/univention-directory-notifier/univention-translog [-v] prune <TID>
root@ucs:~# /usr/share/univention-directory-notifier/univention-translog -v prune 80802
2019-07-15 12:44:06,103:INFO:Index of size 818018 contains 90802 entries
2019-07-15 12:44:06,104:INFO:Purging/keeping 1..80802..90802
2019-07-15 12:44:06,169:INFO:Deleted reqSession=1,cn=translog
2019-07-15 12:44:06,170:INFO:Deleted reqSession=2,cn=translog
...
2019-07-15 12:48:22,100:INFO:Deleted reqSession=80800,cn=translog
2019-07-15 12:48:22,101:INFO:Deleted reqSession=80801,cn=translog

Optionally, after that the free pages can be cleaned up. But technically that’s not required and the necessity should be considered in relation to downtime. Anyway these would be the steps:

root@ucs:~# mkdir /var/lib/univention-ldap/translog-new
root@ucs:~# systemctl stop univention-directory-notifier.service
root@ucs:~# systemctl stop slapd.service
root@ucs:~# mdb_copy -c /var/lib/univention-ldap/translog /var/lib/univention-ldap/translog-new
root@ucs:~# mv /var/lib/univention-ldap/translog /var/lib/univention-ldap/translog-old
root@ucs:~# mv /var/lib/univention-ldap/translog-new /var/lib/univention-ldap/translog
root@ucs:~# systemctl start slapd.service
root@ucs:~# systemctl start univention-directory-notifier.service

Recheck with nagios the space is freed
/usr/lib/nagios/plugins/check_univention_slapd_mdb_maxsize