[#692] Restore partial import semantics for include/exclude branches#689
Open
vharseko wants to merge 1 commit into
Open
[#692] Restore partial import semantics for include/exclude branches#689vharseko wants to merge 1 commit into
vharseko wants to merge 1 commit into
Conversation
Since the import was rewritten around OnDiskMergeImporter, a partial
import (import-ldif with --includeBranch and/or --excludeBranch)
silently destroyed all existing entries outside of the imported scope:
the importer deletes the whole entry container before rebuilding it
from the filtered LDIF content, and then aborts on the orphan check
because the parent of the included branch is gone ("The import has
been aborted because the entry ... does not have a parent entry").
The 2.x importer used to migrate those entries into the new container
(MigrateExistingTask/MigrateExcludedTask).
Restore that behaviour in an architecture-compatible way: before the
import starts, snapshot the entries which must survive - entries
outside of the include branches, plus entries below exclude branches
of an imported branch - into temporary LDIF files using the regular
export machinery, then feed them through the import pipeline together
with the user-provided LDIF via a composite source. Containers not
touched by the import are left alone, as before.
Move TestImportAndExport.testImportExport out of the "slow" group into
the default build.
maximthomas
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #692
Problem
Since the import was rewritten around
OnDiskMergeImporter(DJ 3.x), a partial import —import-ldifwith--includeBranchand/or--excludeBranch— silently destroys all existing entries outside of the imported scope: the importer deletes the whole entry container (beforePhaseOne→entryContainer.delete()) before rebuilding it from the filtered LDIF content, and then aborts on the orphan check because the parent of the included branch is gone:The 2.x importer used to migrate those entries into the new container (
MigrateExistingTask/MigrateExcludedTaskin the oldjeb/Importer.java, removed in OPENDJ-2337):--includeBranchdefines the scope of the replacement, everything else in the base DN is preserved.Found by running the
slowTestNG group (excluded from CI), whereTestImportAndExport.testImportExportfails on theinclude-branch: ou=people,dc=example,dc=comcase withSTOPPED_BY_ERROR.Fix
Restore the 2.x behaviour in a way compatible with the on-disk-merge architecture (trees are rebuilt wholesale, so preserved entries must go through the import pipeline):
exportEntriesToPreserve()snapshots the entries which must survive into temporary LDIF files using the regularExportJobmachinery (the storage is openedREAD_ONLYand closed again beforestartImport()): for each affected base DN, the entries outside of the include branches (unless the branches cover the whole base DN), plus the entries below exclude branches located inside the replaced scope.CompositeSourcechains an unfiltered, non-schema-validatingLDIFReaderSourceover the snapshot files with the main LDIF source, so preserved entries are re-imported through the same phase-1/phase-2 pipeline.Verification
TestImportAndExport: 12/12 pass — the include-branch case completes successfully and the base entry and sibling branches survive (no orphan abort). The test is moved out of theslowgroup into the default build.OnDiskMergeImporterTest: 29/29 pass.JETestCase32/32,PDBTestCase32/32.