Problem: Problems With UDN Replication

DRAFT!

Problem:

The UMC diagnostic module reports problems with UDN replication:
Bildschirmfoto%20vom%202019-03-18%2014-53-39
There might be similar symptoms referring to a failing replication. The solution should apply.

Environment

This solution only applies to UCS starting from version 4.3-3 errata427. For earlier versions please refer to this article.

Solution

Step 1

First, we will check if the transaction file itself has corrupt entries or is otherwise broken.

Step 1a

Create the following script and name it “transaction_check.py”:

#!/usr/bin/env python
with open('/var/lib/univention-ldap/notify/transaction', 'r') as transaction:
  lc = 1
  for line in transaction:
    (head, tail) = line.strip().split(' ', 1)
    try:
      cur_lc = int(head)
    except ValueError:
      print 'ERROR at line %d: "%s"' % (lc, line)
      break
    if len(tail.rsplit(' ', 1)) != 2:
      print 'ERROR missing third column at line %d: "%s"' % (lc, line)
      break
    if cur_lc != lc:
      print 'ERROR numbers not in order at line %d: "%s"' % (lc, line)
      break
    lc += 1

Step 1b

Execute the script by:
python transaction_check.py

It will output the first line where an error in the file appears.

Step 2

Identify the errors and fix them.

Step 2a

ERROR numbers not in order
Note: The following commands will bring the OpenLDAP service down for a while. Consider to perform these steps during maintenance time if possible.
Re-enumerate the transactions by the following commands:

systemctl stop univention-directory-notifier
systemctl stop univention-directory-listener 
systemctl stop slapd

# Now re-enumerate the transaction file:
cd /var/lib/univention-ldap/notify
cut -d ' ' -f 2- transaction | awk '{print NR " " $0}' > transaction.new
mv transaction transaction.bak
mv transaction.new transaction
rm -f transaction.index

# And set last_id to the last value:
tail -n 1 transaction | awk '{print $1}' > /var/lib/univention-ldap/last_id
systemctl start univention-directory-notifier
systemctl start slapd
systemctl start univention-directory-listener
Mastodon