From 56a021bc9a924cd8f6ab58167acf535e6d349d7c Mon Sep 17 00:00:00 2001 From: DJ Houghton Date: Fri, 3 Sep 2010 17:47:23 +0000 Subject: Bug 324353 - [query] Repository query takes a long time when deleting a lot of IUs (from dropins) --- .../provisional/p2/directorywatcher/RepositoryListener.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bundles/org.eclipse.equinox.p2.directorywatcher') diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java index 36302dd32..08a5d8fdc 100644 --- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java +++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java @@ -213,10 +213,14 @@ public class RepositoryListener extends DirectoryChangeListener { metadataRepository.removeInstallableUnits(changes); // create a query that will identify all ius related to removed files. - // It's safe to compare a String with a File since the auto coercion will - // first convert the String into a File. + // We convert the java.io.File objects to Strings before doing the comparison + // because when we have large numbers of files, the performance is much better. + // See bug 324353. + Collection paths = new HashSet(removedFiles.size()); + for (File file : removedFiles) + paths.add(file.getAbsolutePath()); IQuery removeQuery = QueryUtil.createMatchQuery( // - "$1.exists(x | properties[$0] == x)", FILE_NAME, removedFiles); //$NON-NLS-1$ + "$1.exists(x | properties[$0] == x)", FILE_NAME, paths); //$NON-NLS-1$ IQueryResult toRemove = metadataRepository.query(removeQuery, null); metadataRepository.removeInstallableUnits(toRemove.toUnmodifiableSet()); } -- cgit v1.2.3