close
Skip to content

Partial import-ldif with --includeBranch/--excludeBranch destroys all entries outside the imported scope #692

Description

@vharseko

Summary

A partial import — import-ldif with --includeBranch and/or --excludeBranchsilently destroys all existing entries outside of the imported scope, then aborts with:

The import has been aborted because the entry '...ou=people' does not have a parent entry

leaving the backend without the pre-existing data.

Steps to reproduce

  1. Import a full base DN, e.g. dc=example,dc=com with several branches (ou=people, ou=groups, ...).
  2. Run a partial re-import of one branch:
import-ldif --backendID userRoot --includeBranch ou=people,dc=example,dc=com --ldifFile people.ldif

Expected (and 2.x behaviour): only ou=people,dc=example,dc=com is replaced by the LDIF content; the base entry and the sibling branches are preserved.

Actual: the import aborts with the "does not have a parent entry" error above (the parent dc=example,dc=com no longer exists at phase-2 time), and the entries outside the include branch are gone.

Root cause

Since the import was rewritten around OnDiskMergeImporter (DJ 3.x), the importer deletes the whole entry container (beforePhaseOneentryContainer.delete()) before rebuilding it from the filtered LDIF content. The 2.x importer used to migrate the entries outside of the imported scope into the new container (MigrateExistingTask / MigrateExcludedTask in the old jeb/Importer.java, removed in OPENDJ-2337): --includeBranch defines the scope of the replacement, everything else in the base DN must be preserved.

How it was found

Running the slow TestNG group (excluded from CI): TestImportAndExport.testImportExport fails on the include-branch: ou=people,dc=example,dc=com case with STOPPED_BY_ERROR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdata-lossData integrity / loss of entries

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions