Skip to content

Commit b8f5453

Browse files
authored
#582 Remove intermediateSaves option in OSGi config (#583)
1 parent d090030 commit b8f5453

File tree

4 files changed

+4
-43
lines changed

4 files changed

+4
-43
lines changed

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public interface AceBeanInstaller {
2727
* @param pathBasedAceMapFromConfig map containing the ACE data from the merged configurations path based
2828
* @param session the jcr session
2929
* @param installationLog the installation log
30-
* @param authorizablesToRemoveAcesFor
31-
* @param intermediateSaves whether the session should be saved after each path (for each ACL) */
30+
* @param authorizablesToRemoveAcesFor */
3231
void installPathBasedACEs(final Map<String, Set<AceBean>> pathBasedAceMapFromConfig, final AcConfiguration acConfiguration, final Session session,
33-
final InstallationLogger installationLog, Set<String> authorizablesToRemoveAcesFor, boolean intermediateSaves) throws Exception;
32+
final InstallationLogger installationLog, Set<String> authorizablesToRemoveAcesFor) throws Exception;
3433

3534
}

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ public void installPathBasedACEs(
5252
final Map<String, Set<AceBean>> pathBasedAceMapFromConfig,
5353
final AcConfiguration acConfiguration,
5454
final Session session,
55-
final InstallationLogger history, Set<String> principalsToRemoveAcesFor,
56-
boolean intermediateSaves) throws Exception {
55+
final InstallationLogger history, Set<String> principalsToRemoveAcesFor) throws Exception {
5756

5857
StopWatch stopWatch = new StopWatch();
5958
stopWatch.start();
@@ -65,11 +64,6 @@ public void installPathBasedACEs(
6564

6665
paths = filterReadOnlyPaths(paths, history, session);
6766

68-
if (intermediateSaves) {
69-
history.addMessage(LOG, "Will save ACL for each path to session due to configuration option intermediateSaves=true - "
70-
+ "rollback functionality is disabled.");
71-
}
72-
7367
// loop through all nodes from config
7468
for (final String path : paths) {
7569

@@ -96,10 +90,6 @@ public void installPathBasedACEs(
9690
acConfiguration.getGlobalConfiguration().getDefaultUnmanagedAcePathsRegex());
9791
installAcl(orderedAceBeanSetFromConfig, path, principalsToRemoveAcesForAtThisPath, session, history);
9892

99-
if (intermediateSaves && session.hasPendingChanges()) {
100-
history.addVerboseMessage(LOG, "Saved session for path " + path);
101-
session.save();
102-
}
10393
}
10494

10595
if (history.getMissingParentPathsForInitialContent() > 0) {

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/impl/AcInstallationServiceImpl.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public class AcInstallationServiceImpl implements AcInstallationService, AcInsta
8989
private static final String CONFIG_PID = "biz.netcentric.cq.tools.actool.impl.AcInstallationServiceImpl";
9090
private static final String LEGACY_CONFIG_PID = "biz.netcentric.cq.tools.actool.aceservice.impl.AceServiceImpl";
9191
private static final String LEGACY_PROPERTY_CONFIGURATION_PATH = "AceService.configurationPath";
92-
private static final String LEGACY_PROPERTY_INTERMEDIATE_SAVES = "intermediateSaves";
9392

9493
@Reference(policyOption = ReferencePolicyOption.GREEDY)
9594
AuthorizableInstallerService authorizableCreatorService;
@@ -129,18 +128,13 @@ public class AcInstallationServiceImpl implements AcInstallationService, AcInsta
129128

130129
private List<String> configurationRootPaths;
131130

132-
private boolean intermediateSaves;
133-
134131
@ObjectClassDefinition(name = "AC Tool Installation Service",
135132
description="Service that installs groups & ACEs according to textual configuration files",
136133
id = CONFIG_PID)
137134
protected static @interface Configuration {
138135

139136
@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)")
140137
String[] configurationRootPaths() default {};
141-
142-
@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.")
143-
boolean intermediateSaves() default false;
144138
}
145139

146140
@Activate
@@ -157,16 +151,13 @@ public void activate(Configuration configuration, BundleContext bundleContext) t
157151
configurationRootPaths.add(PropertiesUtil.toString(configDict.get(LEGACY_PROPERTY_CONFIGURATION_PATH), ""));
158152
}
159153
}
160-
161-
intermediateSaves = configuration.intermediateSaves();
162154

163155
// Fallback to old PID: only fall back to legacy config if new config does not exist
164156
if (configDict == null) {
165157
Dictionary<String, Object> legacyProps = configAdmin.getConfiguration(LEGACY_CONFIG_PID).getProperties();
166158
if (legacyProps != null) {
167159
LOG.warn("Using legacy configuration PID '{}'. Please remove this and switch to the new one with PID '{}',", LEGACY_CONFIG_PID, CONFIG_PID);
168160
configurationRootPaths = Arrays.asList(PropertiesUtil.toString(legacyProps.get(LEGACY_PROPERTY_CONFIGURATION_PATH), ""));
169-
intermediateSaves = PropertiesUtil.toBoolean(legacyProps.get(LEGACY_PROPERTY_INTERMEDIATE_SAVES), false);
170161
}
171162
}
172163

@@ -484,7 +475,7 @@ private void installAces(InstallationLogger installLog,
484475
+ aceBeanInstaller.getClass().getSimpleName() + "...");
485476

486477
aceBeanInstaller.installPathBasedACEs(filteredPathBasedAceMapFromConfig, acConfiguration, session, installLog,
487-
principalsToRemoveAcesFor, intermediateSaves);
478+
principalsToRemoveAcesFor);
488479
} else {
489480
installLog.addMessage(LOG, "No relevant ACEs to install");
490481
}
@@ -543,17 +534,6 @@ private void installAuthorizables(InstallationLogger installLog, AcConfiguration
543534
try {
544535
// only save session if no exceptions occurred
545536
authorizableCreatorService.installAuthorizables(acConfiguration, authorizablesConfig, session, installLog);
546-
547-
if (intermediateSaves) {
548-
if (session.hasPendingChanges()) {
549-
session.save();
550-
installLog.addVerboseMessage(LOG, "Saved session after installing authorizables.");
551-
} else {
552-
installLog.addVerboseMessage(LOG,
553-
"After installing authorizables, intermediateSaves is turned on but there are no pending changes.");
554-
}
555-
}
556-
557537
} catch (Exception e) {
558538
throw new AuthorizableCreatorException(e);
559539
}

docs/AdvancedFeatures.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,3 @@ The following examples shows a legitimate example of using `keepOrder: true`:
491491
```
492492
This example gives the group `myproj-editor` edit rights for all content in folder `myproj`, except for the iframe component.
493493

494-
## Intermediate save() calls during ACL installation
495-
496-
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`.
497-
498-
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.
499-
500-
[i257]: https://github.com/Netcentric/accesscontroltool/issues/257
501-
[felix-interpolation-plugin]: https://github.com/apache/felix-dev/blob/master/configadmin-plugins/interpolation/README.md

0 commit comments

Comments
 (0)