Bug 2057929 - "dsconf replication restore-changelog" does not work in RHDS11
Summary: "dsconf replication restore-changelog" does not work in RHDS11
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Directory Server
Classification: Red Hat
Component: 389-ds-base
Version: 11.3
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
: dirsrv-11.6
Assignee: LDAP Maintainers
QA Contact: RHDS QE
Marc Muehlfeld
URL:
Whiteboard: sync-to-jira
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-24 08:16 UTC by kyoneyama
Modified: 2023-07-04 14:13 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-03 15:45:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 4176 0 None closed move CL followup (3) - import ldif2cl task should not close all changelogs 2022-02-24 13:43:26 UTC
Red Hat Issue Tracker IDMDS-2044 0 None None None 2022-02-24 08:36:23 UTC
Red Hat Issue Tracker IDMDS-2045 0 None None None 2022-02-28 10:26:37 UTC

Description kyoneyama 2022-02-24 08:16:26 UTC
Description of problem:

To recreate changelogdb, I tried exporting changelogdb to LDIF and then importing it per documents.

  - https://access.redhat.com/documentation/en-us/red_hat_directory_server/11/html/administration_guide/exporting-up-the-replication-changelog
  - https://access.redhat.com/documentation/en-us/red_hat_directory_server/11/html/administration_guide/importing-the-replication-changelog-from-an-ldif-formatted-changelog-dump


I was able to run the commands without error, but the restore does not succeed.
"dsconf ... restore-changelog" command only exports the changelogdb, but does not seem to recreate the changelogdb.



Version-Release number of selected component (if applicable):

- Red Hat Enterprise Linux 8
- Red Hat Directory Server 11
- 389-ds-base-1.4.3.27-2.module+el8dsrv+12690+c6df6d1b.x86_64
- python3-lib389-1.4.3.27-2.module+el8dsrv+12690+c6df6d1b.noarch
- libdb-5.3.28-42.el8_4.x86_64


How reproducible:

  Always

Steps to Reproduce:

1. Get the replica-root and replica-name.

  # ldapsearch ... -LLL -b cn=config objectClass=nsds5Replica nsds5ReplicaRoot
  dn: cn=replica,cn=dc\3Dad\2Cdc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
  nsds5ReplicaRoot: dc=ad,dc=example,dc=com

  # ldapsearch ... -LLL -b cn=config objectClass=nsds5Replica nsds5ReplicaName
  dn: cn=replica,cn=dc\3Dad\2Cdc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
  nsds5ReplicaName: 03976a03-741611ec-b0489357-92c04aa1

2. Dump changelogdb to LDIF file.

  # dsconf rhds11 replication dump-changelog > /tmp/changelog.ldif

3. Prepare the file in advance to avoid errors.

  # touch /var/lib/dirsrv/slapd-rhds11/changelogdb/03976a03-741611ec-b0489357-92c04aa1.ldif
  # chown dirsrv:dirsrv /var/lib/dirsrv/slapd-rhds11/changelogdb/03976a03-741611ec-b0489357-92c04aa1.ldif

4. Restore changelogdb from LDIF file

  # dsconf rhds11 replication restore-changelog from-ldif -r "dc=ad,dc=example,dc=com" /tmp/changelog.ldif 

5. Make sure that the db file in the changelogdb directory is updated.

  # ls -l /var/lib/dirsrv/slapd-rhds11/changelogdb


Actual results:

The changelogdb won't be recreated.

When "dsconf ... restore-changelog" is executed, the LDIF export is performed by "cl2ldif" task.

  -- errors --
  [22/Feb/2022:17:06:39.819473308 +0900] - INFO - NSMMReplicationPlugin - replica_execute_cl2ldif_task - Beginning changelog export of replica "03976a03-741611ec-b0489357-92c04aa1"
  [22/Feb/2022:17:06:39.831641891 +0900] - INFO - NSMMReplicationPlugin - replica_execute_cl2ldif_task - Finished changelog export of replica "03976a03-741611ec-b0489357-92c04aa1"

Expected results:

The changelogdb will be recreated.


Additional info:

After I investigated the source code, restore_changelog() method only sets "cl2ldif" task at the end and it completes.
I expect that it has to do the "ldif2cl" task to import it.

  -- /usr/lib/python3.6/site-packages/lib389/cli_conf/replication.py --
  1102 def restore_cl_ldif(inst, basedn, log, args):
  :
  1124     replicas.restore_changelog(replica_roots=args.replica_root, log=log)
  1125     os.remove(target_ldif)
  1126     if target_ldif_exists:
  1127         os.rename(f'{target_ldif}.backup', target_ldif)


  -- /usr/lib/python3.6/site-packages/lib389/replica.py --
  1737     def restore_changelog(self, replica_roots, log=None):
  :
  1759         # Dump the changelog for the replica
  1760         for repl_root in replica_roots:
  :
  1766 
  1767             if changelog_ldif:
  1768                 replica.begin_task_cl2ldif()
  1769             elif changelog_ldif_done:
  1770                 ldif_done_file = os.path.join(cl_dir, changelog_ldif_done[0])
  1771                 ldif_file = os.path.join(cl_dir, f"{replica_name}.ldif")
  1772                 ldif_file_exists = os.path.exists(ldif_file)
  1773                 if ldif_file_exists:
  1774                     copy_with_permissions(ldif_file, f'{ldif_file}.backup')
  1775                 copy_with_permissions(ldif_done_file, ldif_file)
  1776                 replica.begin_task_cl2ldif()
  1777                 os.remove(ldif_file)
  1778                 if ldif_file_exists:
  1779                     os.rename(f'{ldif_file}.backup', ldif_file)
  1780             else:
  1781                 log.error(f"Changelog LDIF for '{repl_root}' was not found")
  1782                 continue
  1783 

  1605     def begin_task_cl2ldif(self):
  1606         """Begin the changelog to ldif task
  1607         """
  1608         self.replace('nsds5task', 'cl2ldif')
  1609


Note You need to log in before you can comment on or make changes to this bug.