From be8352b320541af8b49d88c525c68f6577ff4582 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 7 May 2021 13:08:09 +0200 Subject: [PATCH] Mark selected GetOperationOptions as cache-neutral The doNotDiscovery, forceRefresh, forceRetry, errorHandling options are currently relevant only at the level of provisioning module. They do not affect processing in repository in any way, so they can be considered neutral (harmless) from the caching point of view. This resolves MID-7040. --- .../midpoint/repo/cache/RepositoryCache.java | 4 +++- .../repo/cache/handlers/PassReason.java | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/RepositoryCache.java b/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/RepositoryCache.java index 4f0d213fedf..cb1d8931ea2 100644 --- a/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/RepositoryCache.java +++ b/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/RepositoryCache.java @@ -147,8 +147,10 @@ public int countContainers(Class type, ObjectQuery //region --- ADD, MODIFY, DELETE and other modifications ------------------------------------------------------- + @NotNull @Override - public @NotNull String addObject(@NotNull PrismObject object, RepoAddOptions options, @NotNull OperationResult parentResult) + public String addObject(@NotNull PrismObject object, RepoAddOptions options, + @NotNull OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException { return modificationOpHandler.addObject(object, options, parentResult); } diff --git a/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/handlers/PassReason.java b/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/handlers/PassReason.java index 13a2f293081..0aa96620631 100644 --- a/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/handlers/PassReason.java +++ b/repo/repo-cache/src/main/java/com/evolveum/midpoint/repo/cache/handlers/PassReason.java @@ -79,15 +79,31 @@ static PassReason determine(Collection> opt } GetOperationOptions cloned = selectorOptions.getOptions().clone(); + // Options considered harmful: + // - retrieve + // - resolve + // - resolveNames + // - raw (because of strange definition handling) + // - tolerateRawData (this is questionable, though) + // - relationalValueSearchQuery + // - distinct + // - attachDiagData + // - definitionProcessing + // - iterationMethod + // Eliminate harmless options + cloned.doNotDiscovery(null); + cloned.setForceRefresh(null); + cloned.setForceRetry(null); cloned.setAllowNotFound(null); cloned.setExecutionPhase(null); cloned.setReadOnly(null); cloned.setNoFetch(null); - cloned.setPointInTimeType(null); // This is not used by repository anyway. + cloned.setPointInTimeType(null); // This is not used by repository anyway. // We know the staleness is not zero, so caching is (in principle) allowed. // More detailed treatment of staleness is not yet available. cloned.setStaleness(null); + cloned.setErrorHandling(null); if (cloned.equals(GetOperationOptions.EMPTY)) { return null; }