Skip to content

Conversation

joerghoh
Copy link
Contributor

When controlling both package creation, transport and import checking the filters in import can be time-consuming activity. For that reason it should be possible to skip the validation of the filters, as it will always match. In my test case this reduced the package import time by about 25%.

Right now it only skips the validation of properties, but we could think about skipping the validation of node paths as well. Given that in my case we had around 10 properties per node in average, skipping the filters for adding nodes will just add some small benefit on top.

@joerghoh
Copy link
Contributor Author

I moved the skip logic out of the workspace filter class, and into the DocViewImporter.

this.skipFilterChecksOnImport = skipFilterChecksOnImport;
}

public boolean getSkipFilterChecksOnImport() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this only affects import I would rather move it to ImportOptions and also clarify that this only affects checks against package items not about existing repo items.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImportOptions already has such a method; i clarified the javadoc as recommended

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add new methods/fields to WorkspaceFilter then, just use the one from ImportOptions directly (i.e. pass as boolean argument to DocViewImporter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those methods should not be added to DefaultWorkspaceFilter either. Rather pass that as dedicated boolean flag to the importer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean extending the (already quite long) constructor of the DocViewImporter by this flag? That would make the patch much more complicated, as I would need to pass through that parameter through a series of other methods.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see these methods only being used once each....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to backtrack from the constructor of the DocViewImporter, which methods would need to be changed, and the list is getting long; where annotated with ... I stopped (line numbers might not be 100% accurate, as my eclipse behaves sometimes a bit strange (eclipse-platform/eclipse.platform.ui#3039).

But it shows, that passing this parameter through the entire call chain(s) would be quite an effort, and for that reason I augmented the DefaultWorkspaceFilter.

DocViewImporter.java (l249)
  -> AbstractArtifactHandler:importDocView (l170)
     -> AbstractArtifactHandler:importDocView (l166)
        -> FileArtifactHandler:accept (l231)
           -> ...
        -> FileArtifactHandler:importDocView (l236)
           -> FileArtifactHandler::accept (l231) -> see above
     -> GenericArtifactHandler:accept (l88)
        -> AbstractArtifactHandler:accept (l126)
           -> ...
        -> AbstractArtifactHandler:accept (l136)
           -> ...
        -> Importer:commit (l1085)
           -> Importer:commit (l1058)
              -> Importer:commit (recursion)
              -> Importer:run (l537)
                 -> ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But both FileArtifactHandler:accept and GenericArtifactHandler:accept have access to the ImportOptions which expose that already, so it needs to be passed along DocViewImporter, AbstractArtifactHandler:importDocView and FileArtifactHandler:importDocView which seems acceptable to me. Right now it really is duplicate in ImporterOptions and WorkspaceFilter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try to take a stab at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through and changed them ... a bit less changes than I actually anticipated.

@joerghoh joerghoh marked this pull request as ready for review September 4, 2025 12:21
this.skipFilterChecksOnImport = skipFilterChecksOnImport;
}

public boolean getSkipFilterChecksOnImport() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add new methods/fields to WorkspaceFilter then, just use the one from ImportOptions directly (i.e. pass as boolean argument to DocViewImporter

@kwin
Copy link
Member

kwin commented Sep 10, 2025

Looks much better now, I think long term it makes sense to pass the full ImportOptions object to the ArtifactHandlers and also use that as argument for the DocViewImporter constructor, however that can be done outside this PR.

I am still wondering how the skipFilterChecksOnImport affect
a) node/property deletions
b) direct data serializations of files/folders

@joerghoh
Copy link
Contributor Author

Right now this does only affect the case when properties are added to a new node or updated on an existing node, the codepath for the deletion of properties is not affected. So for that I don't see anything which changes the result of a package installation.

Also it is only supposed to work under the assumption, that you control both the creation and the consumption of the package, and that in both cases the same filter rules are used. In other words: when matching the content of the package to the filters, the result is expected to be always true.

@kwin
Copy link
Member

kwin commented Sep 10, 2025

Would be nice to cover that in a test case as well. Not only that deletion of properties no longer contained in the package still works but also that nodes below filter roots not contained in the package are still removed. Also this makes the name skipFilterChecksOnImport a bit misleading as actually the filter check is only skipped in very few cases during import.

admin.save();
}
assertNodeExists("/tmp/foo");
assertPropertyMissing("/tmp/foo/bar/tobi/excludeddProp");
Copy link
Member

@kwin kwin Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some assertions what happens to nodes/properties below filter roots not contained in the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants