diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java index 8c9f3d11..1ead6f9f 100644 --- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java +++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java @@ -27,9 +27,8 @@ public interface AceBeanInstaller { * @param pathBasedAceMapFromConfig map containing the ACE data from the merged configurations path based * @param session the jcr session * @param installationLog the installation log - * @param authorizablesToRemoveAcesFor - * @param intermediateSaves whether the session should be saved after each path (for each ACL) */ + * @param authorizablesToRemoveAcesFor */ void installPathBasedACEs(final Map> pathBasedAceMapFromConfig, final AcConfiguration acConfiguration, final Session session, - final InstallationLogger installationLog, Set authorizablesToRemoveAcesFor, boolean intermediateSaves) throws Exception; + final InstallationLogger installationLog, Set authorizablesToRemoveAcesFor) throws Exception; } \ No newline at end of file diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java index 2ff94bb1..fa230dd8 100644 --- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java +++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java @@ -52,8 +52,7 @@ public void installPathBasedACEs( final Map> pathBasedAceMapFromConfig, final AcConfiguration acConfiguration, final Session session, - final InstallationLogger history, Set principalsToRemoveAcesFor, - boolean intermediateSaves) throws Exception { + final InstallationLogger history, Set principalsToRemoveAcesFor) throws Exception { StopWatch stopWatch = new StopWatch(); stopWatch.start(); @@ -65,11 +64,6 @@ public void installPathBasedACEs( paths = filterReadOnlyPaths(paths, history, session); - if (intermediateSaves) { - history.addMessage(LOG, "Will save ACL for each path to session due to configuration option intermediateSaves=true - " - + "rollback functionality is disabled."); - } - // loop through all nodes from config for (final String path : paths) { @@ -96,10 +90,6 @@ public void installPathBasedACEs( acConfiguration.getGlobalConfiguration().getDefaultUnmanagedAcePathsRegex()); installAcl(orderedAceBeanSetFromConfig, path, principalsToRemoveAcesForAtThisPath, session, history); - if (intermediateSaves && session.hasPendingChanges()) { - history.addVerboseMessage(LOG, "Saved session for path " + path); - session.save(); - } } if (history.getMissingParentPathsForInitialContent() > 0) { diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/impl/AcInstallationServiceImpl.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/impl/AcInstallationServiceImpl.java index 87684281..8fa21c9b 100644 --- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/impl/AcInstallationServiceImpl.java +++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/impl/AcInstallationServiceImpl.java @@ -89,7 +89,6 @@ public class AcInstallationServiceImpl implements AcInstallationService, AcInsta private static final String CONFIG_PID = "biz.netcentric.cq.tools.actool.impl.AcInstallationServiceImpl"; private static final String LEGACY_CONFIG_PID = "biz.netcentric.cq.tools.actool.aceservice.impl.AceServiceImpl"; private static final String LEGACY_PROPERTY_CONFIGURATION_PATH = "AceService.configurationPath"; - private static final String LEGACY_PROPERTY_INTERMEDIATE_SAVES = "intermediateSaves"; @Reference(policyOption = ReferencePolicyOption.GREEDY) AuthorizableInstallerService authorizableCreatorService; @@ -129,8 +128,6 @@ public class AcInstallationServiceImpl implements AcInstallationService, AcInsta private List configurationRootPaths; - private boolean intermediateSaves; - @ObjectClassDefinition(name = "AC Tool Installation Service", description="Service that installs groups & ACEs according to textual configuration files", id = CONFIG_PID) @@ -138,9 +135,6 @@ public class AcInstallationServiceImpl implements AcInstallationService, AcInsta @AttributeDefinition(name="Configuration path(s)", description="JCR path(s) where the config files reside (usually it's just one, can be multiple for multitenant setups)") String[] configurationRootPaths() default {}; - - @AttributeDefinition(name="Use intermediate saves", description="Saves ACLs for each path individually - this can be used to avoid problems with large changesets and MongoDB (OAK-5557), however the rollback is disabled then.") - boolean intermediateSaves() default false; } @Activate @@ -157,8 +151,6 @@ public void activate(Configuration configuration, BundleContext bundleContext) t configurationRootPaths.add(PropertiesUtil.toString(configDict.get(LEGACY_PROPERTY_CONFIGURATION_PATH), "")); } } - - intermediateSaves = configuration.intermediateSaves(); // Fallback to old PID: only fall back to legacy config if new config does not exist if (configDict == null) { @@ -166,7 +158,6 @@ public void activate(Configuration configuration, BundleContext bundleContext) t if (legacyProps != null) { LOG.warn("Using legacy configuration PID '{}'. Please remove this and switch to the new one with PID '{}',", LEGACY_CONFIG_PID, CONFIG_PID); configurationRootPaths = Arrays.asList(PropertiesUtil.toString(legacyProps.get(LEGACY_PROPERTY_CONFIGURATION_PATH), "")); - intermediateSaves = PropertiesUtil.toBoolean(legacyProps.get(LEGACY_PROPERTY_INTERMEDIATE_SAVES), false); } } @@ -484,7 +475,7 @@ private void installAces(InstallationLogger installLog, + aceBeanInstaller.getClass().getSimpleName() + "..."); aceBeanInstaller.installPathBasedACEs(filteredPathBasedAceMapFromConfig, acConfiguration, session, installLog, - principalsToRemoveAcesFor, intermediateSaves); + principalsToRemoveAcesFor); } else { installLog.addMessage(LOG, "No relevant ACEs to install"); } @@ -543,17 +534,6 @@ private void installAuthorizables(InstallationLogger installLog, AcConfiguration try { // only save session if no exceptions occurred authorizableCreatorService.installAuthorizables(acConfiguration, authorizablesConfig, session, installLog); - - if (intermediateSaves) { - if (session.hasPendingChanges()) { - session.save(); - installLog.addVerboseMessage(LOG, "Saved session after installing authorizables."); - } else { - installLog.addVerboseMessage(LOG, - "After installing authorizables, intermediateSaves is turned on but there are no pending changes."); - } - } - } catch (Exception e) { throw new AuthorizableCreatorException(e); } diff --git a/docs/AdvancedFeatures.md b/docs/AdvancedFeatures.md index e22ad3d4..0e12adf2 100644 --- a/docs/AdvancedFeatures.md +++ b/docs/AdvancedFeatures.md @@ -491,11 +491,3 @@ The following examples shows a legitimate example of using `keepOrder: true`: ``` This example gives the group `myproj-editor` edit rights for all content in folder `myproj`, except for the iframe component. -## Intermediate save() calls during ACL installation - -For large installations (> 1000 groups) that use MongoDB, the system possibly may get into an invalid state as older versions of OAK (AEM 6.1/6.2 ootb) do not always correctly fire the post commit hook for very large change sets (OAK-5557). To circumvent this issue it is possible since v1.9.2 to configure the OSGi property `intermediateSaves=true` of PID `biz.netcentric.cq.tools.actool.impl.AcInstallationServiceImpl`. - -NOTE: This is never necessary when using TarMK and also it should only be used for MongoMK for large installations that do not contain a fix for OAK-5557 yet as the rollback functionality is lost when enabling intermediate saves. - -[i257]: https://github.com/Netcentric/accesscontroltool/issues/257 -[felix-interpolation-plugin]: https://github.com/apache/felix-dev/blob/master/configadmin-plugins/interpolation/README.md