[GitHub] [sling-whiteboard] dependabot[bot] closed pull request #81: Bump minimist from 1.2.5 to 1.2.6 in /slingpost
dependabot[bot] closed pull request #81: Bump minimist from 1.2.5 to 1.2.6 in /slingpost URL: https://github.com/apache/sling-whiteboard/pull/81 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-whiteboard] dependabot[bot] commented on pull request #81: Bump minimist from 1.2.5 to 1.2.6 in /slingpost
dependabot[bot] commented on PR #81: URL: https://github.com/apache/sling-whiteboard/pull/81#issuecomment-1459313543 Superseded by #104. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-whiteboard] dependabot[bot] opened a new pull request, #104: Bump minimist from 1.2.5 to 1.2.8 in /slingpost
dependabot[bot] opened a new pull request, #104: URL: https://github.com/apache/sling-whiteboard/pull/104 Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.8. Changelog Sourced from https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md;>minimist's changelog. https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8;>v1.2.8 - 2023-02-09 Merged [Fix] Fix long option followed by single dash https://github-redirect.dependabot.com/minimistjs/minimist/pull/17;>[#17](https://github.com/minimistjs/minimist/issues/17) [Tests] Remove duplicate test https://github-redirect.dependabot.com/minimistjs/minimist/pull/12;>[#12](https://github.com/minimistjs/minimist/issues/12) [Fix] opt.string works with multiple aliases https://github-redirect.dependabot.com/minimistjs/minimist/pull/10;>[#10](https://github.com/minimistjs/minimist/issues/10) Fixed [Fix] Fix long option followed by single dash (https://github-redirect.dependabot.com/minimistjs/minimist/issues/17;>#17) https://github-redirect.dependabot.com/minimistjs/minimist/issues/15;>[#15](https://github.com/minimistjs/minimist/issues/15) [Tests] Remove duplicate test (https://github-redirect.dependabot.com/minimistjs/minimist/issues/12;>#12) https://github-redirect.dependabot.com/minimistjs/minimist/issues/8;>[#8](https://github.com/minimistjs/minimist/issues/8) [Fix] Fix long option followed by single dash https://github-redirect.dependabot.com/minimistjs/minimist/issues/15;>[#15](https://github.com/minimistjs/minimist/issues/15) [Fix] opt.string works with multiple aliases (https://github-redirect.dependabot.com/minimistjs/minimist/issues/10;>#10) https://github-redirect.dependabot.com/minimistjs/minimist/issues/9;>[#9](https://github.com/minimistjs/minimist/issues/9) [Fix] Fix handling of short option with non-trivial equals https://github-redirect.dependabot.com/minimistjs/minimist/issues/5;>[#5](https://github.com/minimistjs/minimist/issues/5) [Tests] Remove duplicate test https://github-redirect.dependabot.com/minimistjs/minimist/issues/8;>[#8](https://github.com/minimistjs/minimist/issues/8) [Fix] opt.string works with multiple aliases https://github-redirect.dependabot.com/minimistjs/minimist/issues/9;>[#9](https://github.com/minimistjs/minimist/issues/9) Commits Merge tag 'v0.2.3' https://github.com/minimistjs/minimist/commit/a0267947c7870fc5847cf2d437fbe33f392767da;>a026794 [eslint] fix indentation and whitespace https://github.com/minimistjs/minimist/commit/5368ca4147e974138a54cc0dc4cea8f756546b70;>5368ca4 [eslint] fix indentation and whitespace https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7;>e5f5067 [eslint] more cleanup https://github.com/minimistjs/minimist/commit/62fde7d935f83417fb046741531a9e2346a36976;>62fde7d [eslint] more cleanup https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1;>36ac5d0 [meta] add auto-changelog https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c;>73923d2 [actions] add reusable workflows https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91;>d80727d [eslint] add eslint; rules to enable later are warnings https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4;>48bc06a [eslint] fix indentation https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982;>34b0f1c [readme] rename and add badges https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0;>5df0fe4 [Dev Deps] switch from covert to nyc https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07;>a48b128 [Dev Deps] update covert, tape; remove unnecessary tap https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b;>f0fb958 [meta] create FUNDING.yml; add funding in package.json https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa;>3639e0c [meta] use npmignore to autogenerate an npmignore file https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e;>be2e038 Only apps should have lockfiles https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf;>282b570 isConstructorOrProto adapted from PR https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11;>ef9153f [Dev Deps] update @ljharb/eslint-config, aud https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79;>098873c [Dev Deps] update @ljharb/eslint-config, aud https://github.com/minimistjs/minimist/commit/3124ed3e46306301ebb3c834874ce0241555c2c4;>3124ed3 [meta] add safe-publish-latest https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6;>4b927de [Tests] add aud in posttest
[GitHub] [sling-org-apache-sling-discovery-oak] sonarcloud[bot] commented on pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
sonarcloud[bot] commented on PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#issuecomment-1458654183 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-discovery-oak=13) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [22 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![85.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '85.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [85.0% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-discovery-oak] sonarcloud[bot] commented on pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
sonarcloud[bot] commented on PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#issuecomment-1458610540 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-discovery-oak=13) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [19 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![76.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '76.5%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [76.5% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-discovery-oak] sonarcloud[bot] commented on pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
sonarcloud[bot] commented on PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#issuecomment-1458606054 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-discovery-oak=13) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [19 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![76.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '76.6%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [76.6% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#issuecomment-1458589196 @joerghoh thx a lot for the review! I've addressed or commented on all now -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128308189 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128291733 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128288686 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128278311 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128274084 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128270693 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128270317 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128269430 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128268791 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128261618 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128259831 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli commented on a diff in pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli commented on code in PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#discussion_r1128259111 ## src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java: ## @@ -0,0 +1,484 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.discovery.oak; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.sling.api.resource.LoginException; +import org.apache.sling.api.resource.ModifiableValueMap; +import org.apache.sling.api.resource.PersistenceException; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.commons.scheduler.ScheduleOptions; +import org.apache.sling.commons.scheduler.Scheduler; +import org.apache.sling.discovery.InstanceDescription; +import org.apache.sling.discovery.TopologyEvent; +import org.apache.sling.discovery.TopologyEvent.Type; +import org.apache.sling.discovery.TopologyEventListener; +import org.apache.sling.discovery.TopologyView; +import org.apache.sling.discovery.commons.providers.util.ResourceHelper; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A background task that cleans up garbage slingIds after topology changes. + * + * A slingId is considered garbage when: + * + * it is not in the current topology + * it is not in the current idmap (where clusterNodeIds are reused hence + * that list stays small and does not need cleanup) + * its leaderElectionId was created more than 7 days ago (the + * leaderElectionId is created at activate time of the discovery.oak bundle - + * hence this more or less corresponds to the startup time of that + * instance) + * + * The garbage accumulates at the following places, where it will thus be + * cleaned up from: + * + * as child node under /var/discovery/oak/clusterInstances : this is the + * most performance critical garbage + * as a property key in /var/discovery/oak/syncTokens + * + * The task by default is executed: + * + * only on the leader + * 10min after a TOPOLOGY_INIT or TOPOLOGY_CHANGED event + * with a maximum number of delete operations to avoid repository overload - + * that maximum is called batchSize and is 50 by default + * in subsequent intervals of 10min after the initial run, if that had to + * stop at the batchSize of 50 deletions + * + * All parameters mentioned above can be configured. + */ +@Component +@Designate(ocd = SlingIdCleanupTask.Conf.class) +public class SlingIdCleanupTask implements TopologyEventListener, Runnable { + +/** + * default age is 1 week : an instance that is not in the current topology, + * started 1 week ago is very unlikely to still be active + */ +private static final long DEFAULT_MIN_CREATION_AGE_MILLIS = 60480; // 1 week + +/** + * initial delay is 10min : after a TOPOLOGY_INIT or TOPOLOGY_CHANGED on the + * leader, there should be a 10min delay before starting a round of cleanup. + * This is to not add unnecessary load after a startup/change. + */ +private static final int DEFAULT_CLEANUP_INITIAL_DELAY = 60; // 10min + +/** + * default cleanup interval is 10min - this is together with the batchSize to + * lower repository load + */ +private static final int DEFAULT_CLEANUP_INTERVAL = 60; // 10min + +/** + * default batch size is 50 deletions : normally there should not be much + * garbage around
[GitHub] [sling-org-apache-sling-discovery-oak] sonarcloud[bot] commented on pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
sonarcloud[bot] commented on PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#issuecomment-1458502912 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-discovery-oak=13) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [17 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![76.2%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '76.2%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [76.2% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-discovery-oak] sonarcloud[bot] commented on pull request #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
sonarcloud[bot] commented on PR #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13#issuecomment-1458431940 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-discovery-oak=13) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-discovery-oak=13=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [17 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-discovery-oak=13=false=CODE_SMELL) [![72.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '72.4%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [72.4% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_coverage=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-discovery-oak=13=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (SLING-11797) Log Jobs Added with No Assigned Topology Capability at Info
[ https://issues.apache.org/jira/browse/SLING-11797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17697505#comment-17697505 ] Carsten Ziegeler commented on SLING-11797: -- I'm not against changing the log level, but keep in mind that this can be misleading. I wouldn't use the log for monitoring, but rather look for unassigned jobs through the API > Log Jobs Added with No Assigned Topology Capability at Info > --- > > Key: SLING-11797 > URL: https://issues.apache.org/jira/browse/SLING-11797 > Project: Sling > Issue Type: Bug > Components: Event >Affects Versions: Event 4.3.6 >Reporter: Dan Klco >Assignee: Dan Klco >Priority: Minor > Fix For: Event 4.3.8 > > > When creating a job where the topology does not provide a capability for the > topic, the JobManagerImpl logs the following message at the DEBUG level: > {quote}Persisting job {} into queue {}{quote} > > This makes it challenging to identify/diagnose issues with jobs not being > assigned as: * It requires enabling debug logging on the JobManagerImpl which > can be quite verbose, especially under load > * Since most production instances do not run with DEBUG, these situations > will not be available in logs > * The log message does not indicate that this job will not be immediately > assigned to be processed > Instead, the JobManagerImpl should log a message at least at INFO level which > indicates that the Job being persisted does not have an assigned target. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (SLING-10854) Introduce cleanup job of old slingId data in discovery
[ https://issues.apache.org/jira/browse/SLING-10854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17697504#comment-17697504 ] Stefan Egli commented on SLING-10854: - * draft PR created at https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13 > Introduce cleanup job of old slingId data in discovery > -- > > Key: SLING-10854 > URL: https://issues.apache.org/jira/browse/SLING-10854 > Project: Sling > Issue Type: Improvement > Components: Discovery >Affects Versions: Discovery Oak 1.2.34 >Reporter: Stefan Egli >Priority: Major > Fix For: Discovery Oak 1.2.44 > > Time Spent: 10m > Remaining Estimate: 0h > > Discovery.oak stores nodes and properties per slingId under > {{/var/discovery/oak}}. In a scenario where the slingIds are stable things > are fine. If the slingIds change frequently, old slingId-related data stays > as garbage and accumulates. > We should introduce a cleanup job to delete old slingId data. The leader > could execute this to avoid race conditions. We might need to add some > additional property to indicate age of slingIds (there's already the > {{/var/discovery/oak/clusterInstances/leaderElectionIdCreatedAt}} property > which gets updated upon each discovery.oak bundle activation - but it's > somewhat indirect. Having a new, dedicated property sounds cleaner (this one > could be used to clean up old data though) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-discovery-oak] stefan-egli opened a new pull request, #13: SLING-10854 : introducing SlingIdCleanupTask to clean up old slingIds…
stefan-egli opened a new pull request, #13: URL: https://github.com/apache/sling-org-apache-sling-discovery-oak/pull/13 … under /var/discovery/oak automatically -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Updated] (SLING-10854) Introduce cleanup job of old slingId data in discovery
[ https://issues.apache.org/jira/browse/SLING-10854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Egli updated SLING-10854: Priority: Major (was: Minor) > Introduce cleanup job of old slingId data in discovery > -- > > Key: SLING-10854 > URL: https://issues.apache.org/jira/browse/SLING-10854 > Project: Sling > Issue Type: Improvement > Components: Discovery >Affects Versions: Discovery Oak 1.2.34 >Reporter: Stefan Egli >Priority: Major > Fix For: Discovery Oak 1.2.44 > > > Discovery.oak stores nodes and properties per slingId under > {{/var/discovery/oak}}. In a scenario where the slingIds are stable things > are fine. If the slingIds change frequently, old slingId-related data stays > as garbage and accumulates. > We should introduce a cleanup job to delete old slingId data. The leader > could execute this to avoid race conditions. We might need to add some > additional property to indicate age of slingIds (there's already the > {{/var/discovery/oak/clusterInstances/leaderElectionIdCreatedAt}} property > which gets updated upon each discovery.oak bundle activation - but it's > somewhat indirect. Having a new, dedicated property sounds cleaner (this one > could be used to clean up old data though) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Created] (SLING-11798) Clarify Job Topic Validity Rules
Dan Klco created SLING-11798: Summary: Clarify Job Topic Validity Rules Key: SLING-11798 URL: https://issues.apache.org/jira/browse/SLING-11798 Project: Sling Issue Type: Improvement Components: Site Reporter: Dan Klco Assignee: Dan Klco Our [documentation on Sling Jobs|https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html#jobs-guarantee-of-processing-1] mentions that: {quote}The job topic follows the conventions for the topic of an OSGi event. {quote} Which, after finding and reviewing the relevant documentation: [https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.event.html#d0e46909] [https://docs.osgi.org/specification/osgi.core/7.0.0/ch01.html#framework.general.syntax] One could determine means a string which: - Does not start or end with a slash - Contains only ASCII alphanumeric, underscore, dash, and slash characters - Does not contain double slashes However, it would be more convenient for users of Apache Sling to document the rules on the Jobs page for easy reference and to indicate that attempting to add a Job with an invalid topic with JobManager#addJob will return null. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Assigned] (SLING-11797) Log Jobs Added with No Assigned Topology Capability at Info
[ https://issues.apache.org/jira/browse/SLING-11797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dan Klco reassigned SLING-11797: Assignee: Dan Klco > Log Jobs Added with No Assigned Topology Capability at Info > --- > > Key: SLING-11797 > URL: https://issues.apache.org/jira/browse/SLING-11797 > Project: Sling > Issue Type: Bug > Components: Event >Affects Versions: Event 4.3.6 >Reporter: Dan Klco >Assignee: Dan Klco >Priority: Minor > Fix For: Event 4.3.8 > > > When creating a job where the topology does not provide a capability for the > topic, the JobManagerImpl logs the following message at the DEBUG level: > {quote}Persisting job {} into queue {}{quote} > > This makes it challenging to identify/diagnose issues with jobs not being > assigned as: * It requires enabling debug logging on the JobManagerImpl which > can be quite verbose, especially under load > * Since most production instances do not run with DEBUG, these situations > will not be available in logs > * The log message does not indicate that this job will not be immediately > assigned to be processed > Instead, the JobManagerImpl should log a message at least at INFO level which > indicates that the Job being persisted does not have an assigned target. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Created] (SLING-11797) Log Jobs Added with No Assigned Topology Capability at Info
Dan Klco created SLING-11797: Summary: Log Jobs Added with No Assigned Topology Capability at Info Key: SLING-11797 URL: https://issues.apache.org/jira/browse/SLING-11797 Project: Sling Issue Type: Bug Components: Event Affects Versions: Event 4.3.6 Reporter: Dan Klco Fix For: Event 4.3.8 When creating a job where the topology does not provide a capability for the topic, the JobManagerImpl logs the following message at the DEBUG level: {quote}Persisting job {} into queue {}{quote} This makes it challenging to identify/diagnose issues with jobs not being assigned as: * It requires enabling debug logging on the JobManagerImpl which can be quite verbose, especially under load * Since most production instances do not run with DEBUG, these situations will not be available in logs * The log message does not indicate that this job will not be immediately assigned to be processed Instead, the JobManagerImpl should log a message at least at INFO level which indicates that the Job being persisted does not have an assigned target. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Resolved] (SLING-11794) ResourceCollection Cannot Get Properties with Read-Only User
[ https://issues.apache.org/jira/browse/SLING-11794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dan Klco resolved SLING-11794. -- Resolution: Fixed Fixed in https://github.com/apache/sling-org-apache-sling-resourcecollection/pull/3 > ResourceCollection Cannot Get Properties with Read-Only User > > > Key: SLING-11794 > URL: https://issues.apache.org/jira/browse/SLING-11794 > Project: Sling > Issue Type: Bug > Components: Extensions >Affects Versions: Resource Collections 1.0.0 >Reporter: Dan Klco >Assignee: Dan Klco >Priority: Major > Fix For: Resource Collections 1.0.4 > > Time Spent: 1.5h > Remaining Estimate: 0h > > The ResourceCollection has a method > [getProperties|https://github.com/apache/sling-org-apache-sling-resourcecollection/blob/dfcfd3ca53a7ffec1146a09e850893beea15716e/src/main/java/org/apache/sling/resource/collection/ResourceCollection.java#L72], > which returns a > [ModifiableValueMap|https://github.com/apache/sling-org-apache-sling-api/blob/24c26e15c534e323a57eb2386befa96a323840a1/src/main/java/org/apache/sling/api/resource/ModifiableValueMap.java], > when adapting a > [JcrNodeResource|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/0ce0fb850b3a71d800bc6d9c1e3a869fc5748cb1/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java] > to a ModifiableValueMap, the JcrNodeResource [checks to see if the session > has write > permissions|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/0ce0fb850b3a71d800bc6d9c1e3a869fc5748cb1/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java#L137]. > and returns null if not. > Therefore effectively, if you only have read permissions for the Resource > referenced by the Resource collection you cannot get the properties of a > ResourceCollection. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-resourcecollection] klcodanr merged pull request #3: SLING-11794 - Adding a new method to get the properties as an adapted type
klcodanr merged PR #3: URL: https://github.com/apache/sling-org-apache-sling-resourcecollection/pull/3 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-jcr-base] jsedding commented on a diff in pull request #9: [SLING-11741] Provide alternative terminology for inequitable terms
jsedding commented on code in PR #9: URL: https://github.com/apache/sling-org-apache-sling-jcr-base/pull/9#discussion_r1127721115 ## src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java: ## @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.jcr.base.internal; + +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Map; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Component(service = ConfigurationUpdater.class, immediate = true) +public class ConfigurationUpdater { Review Comment: Could this be a POJO that is manually instantiated in the `ConfigurationListener` instances? I see no need or value for it to be a service, but I may be missing something. ## src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java: ## @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.jcr.base.internal; + +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Map; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Component(service = ConfigurationUpdater.class, immediate = true) +public class ConfigurationUpdater { +private static final Logger LOG = LoggerFactory.getLogger(ConfigurationUpdater.class); + +private final ConfigurationAdmin configurationAdmin; + +@Activate +public ConfigurationUpdater(@Reference ConfigurationAdmin configurationAdmin) { +this.configurationAdmin = configurationAdmin; +} + +public void updateProps(Map propsToReplace, String targetConfigPid, String sourceConfigPid) { +try { +Configuration sourceConfiguration = configurationAdmin.getConfiguration(sourceConfigPid, null); +updateProps(propsToReplace, targetConfigPid, sourceConfiguration); +} catch (IOException e) { +LOG.warn("Failed to retrieve configuration for PID: {}. PID's {} configuration is not updated.", +sourceConfigPid, targetConfigPid, e); +} +} + +public void updatePropsForFactoryPid(Map propsToReplace, String targetConfigFactoryPid, String sourceConfigFactoryPid) { +final String pidFactoryFilter = MessageFormat.format("(service.factoryPid={0})", sourceConfigFactoryPid); Review Comment: ```suggestion final String pidFactoryFilter = String.format("(service.factoryPid=%s)", sourceConfigFactoryPid); ``` ## src/main/java/org/apache/sling/jcr/base/internal/ConfigurationUpdater.java: ## @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more
RE: [VOTE] Release Apache Sling Servlet Helpers 1.4.4
+1 stefan
[GitHub] [sling-org-apache-sling-servlet-helpers] sonarcloud[bot] commented on pull request #11: Bump commons-io from 2.4 to 2.7
sonarcloud[bot] commented on PR #11: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/11#issuecomment-1457964927 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-servlet-helpers=11) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=11=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=11=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=11=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=11=false=CODE_SMELL) [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=11=coverage=list) No Coverage information [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=11=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=11=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Updated] (SLING-11486) Allow to use a Writer that check for close as used in Response Context Support
[ https://issues.apache.org/jira/browse/SLING-11486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Munteanu updated SLING-11486: Fix Version/s: Servlet Helpers 1.4.6 (was: Servlet Helpers 1.4.4) > Allow to use a Writer that check for close as used in Response Context Support > -- > > Key: SLING-11486 > URL: https://issues.apache.org/jira/browse/SLING-11486 > Project: Sling > Issue Type: Improvement > Components: Testing >Affects Versions: Servlet Helpers 1.4.2 >Reporter: Andreas Schaefer >Assignee: Andreas Schaefer >Priority: Major > Fix For: Servlet Helpers 1.4.6 > > Time Spent: 20m > Remaining Estimate: 0h > > A problem with testing GraphQL is that the Unit test does not fail when the > Writer was closed during the invocation. So the Mock Servlet Http Response > should provide a Writer that checks if the writer was already closed to mimic > the actual behavior. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[VOTE] Release Apache Sling Servlet Helpers 1.4.4
Hi, We solved 1 issue in this release: https://issues.apache.org/jira/browse/SLING/fixforversion/12348413 Staging repository: https://repository.apache.org/content/repositories/orgapachesling-2722/ You can use this UNIX script to download the release and verify the signatures: https://gitbox.apache.org/repos/asf?p=sling-tooling-release.git;a=blob;f=check_staged_release.sh;hb=HEAD Usage: sh check_staged_release.sh 2722 /tmp/sling-staging Please vote to approve this release: [ ] +1 Approve the release [ ] 0 Don't care [ ] -1 Don't release, because ... This majority vote is open for at least 72 hours. Regards, Robert Munteanu
[GitHub] [sling-org-apache-sling-servlet-helpers] rombert merged pull request #10: Update to parent pom 49
rombert merged PR #10: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/10 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] sonarcloud[bot] commented on pull request #10: Update to parent pom 49
sonarcloud[bot] commented on PR #10: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/10#issuecomment-1457931332 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-servlet-helpers=10) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=10=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=10=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=10=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=CODE_SMELL) [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=10=coverage=list) No Coverage information [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=10=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=10=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-commons-threads] rombert commented on pull request #5: SLING-11149 - Expose information about cleaned up leftover ThreadLocal values
rombert commented on PR #5: URL: https://github.com/apache/sling-org-apache-sling-commons-threads/pull/5#issuecomment-1457923673 @senn - ooops :-) I've added myself as a reviewer to include this on my TODO list. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] dependabot[bot] opened a new pull request, #11: Bump commons-io from 2.4 to 2.7
dependabot[bot] opened a new pull request, #11: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/11 Bumps commons-io from 2.4 to 2.7. [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=commons-io:commons-io=maven=2.4=2.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/apache/sling-org-apache-sling-servlet-helpers/network/alerts). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Resolved] (SLING-11745) Sling Mocks: allow setting parts for a request
[ https://issues.apache.org/jira/browse/SLING-11745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Munteanu resolved SLING-11745. - Resolution: Fixed > Sling Mocks: allow setting parts for a request > -- > > Key: SLING-11745 > URL: https://issues.apache.org/jira/browse/SLING-11745 > Project: Sling > Issue Type: Improvement > Components: Testing >Reporter: Robert Munteanu >Assignee: Robert Munteanu >Priority: Minor > Fix For: Servlet Helpers 1.4.4 > > Time Spent: 1h 20m > Remaining Estimate: 0h > > The Sling Mocks currently do not support setting one or multiple parts for > the request. These are useful when testing upload functionality. > The {{Part}} interface contains multiple methods, but I guess the following > would make a nice minimal implementation: > - getInputStream > - getName / getSubmittedFileName > with the others being stubbed out. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-servlet-helpers] rombert merged pull request #9: SLING-11745 - Sling Mocks: allow setting parts for a request
rombert merged PR #9: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/9 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Updated] (SLING-11796) The ResourceResolverFactory dependency should be dynamic
[ https://issues.apache.org/jira/browse/SLING-11796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Radu Cotescu updated SLING-11796: - Description: The {{BundledScriptTracker}} requires the {{ResourceResolverFactory}} to determine servlets for resource types should be added to the servlets hierarchy. However, in a system with a large number of servlets a restart of the {{ResourceResolverFactory}} forces the servlets' reregistration. This is an expensive operation which should happen if really required. Since the tracker only needs the search path information from the {{ResourceResolverFactory}}, this reference should be made dynamic and the tracker should reregister the servlets only in the case the search paths array has changed. (was: The {{BundledScriptTracker}} requires the {{ResourceResolverFactory}} to determine servlets for resource types should be added to the servlets hierarchy. However, in a system with a large number of servlets a restart of the {{ResourceResolverFactory}} forces the servlets' reregistration. This is an expensive operation which should only happen if really required. Since the tracker only needs the search path information from the {{ResourceResolverFactory}}, this reference should be made dynamic and the tracker should only reregister the servlets if a search paths array change has been detected.) > The ResourceResolverFactory dependency should be dynamic > > > Key: SLING-11796 > URL: https://issues.apache.org/jira/browse/SLING-11796 > Project: Sling > Issue Type: Improvement > Components: Servlets >Affects Versions: Servlets Resolver 2.9.4 >Reporter: Radu Cotescu >Priority: Major > Fix For: Servlets Resolver 2.9.12 > > > The {{BundledScriptTracker}} requires the {{ResourceResolverFactory}} to > determine servlets for resource types should be added to the servlets > hierarchy. However, in a system with a large number of servlets a restart of > the {{ResourceResolverFactory}} forces the servlets' reregistration. This is > an expensive operation which should happen if really required. Since the > tracker only needs the search path information from the > {{ResourceResolverFactory}}, this reference should be made dynamic and the > tracker should reregister the servlets only in the case the search paths > array has changed. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Created] (SLING-11796) The ResourceResolverFactory dependency should be dynamic
Radu Cotescu created SLING-11796: Summary: The ResourceResolverFactory dependency should be dynamic Key: SLING-11796 URL: https://issues.apache.org/jira/browse/SLING-11796 Project: Sling Issue Type: Improvement Components: Servlets Affects Versions: Servlets Resolver 2.9.4 Reporter: Radu Cotescu Fix For: Servlets Resolver 2.9.12 The {{BundledScriptTracker}} requires the {{ResourceResolverFactory}} to determine servlets for resource types should be added to the servlets hierarchy. However, in a system with a large number of servlets a restart of the {{ResourceResolverFactory}} forces the servlets' reregistration. This is an expensive operation which should only happen if really required. Since the tracker only needs the search path information from the {{ResourceResolverFactory}}, this reference should be made dynamic and the tracker should only reregister the servlets if a search paths array change has been detected. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-servlet-helpers] sonarcloud[bot] commented on pull request #10: Update to parent pom 49
sonarcloud[bot] commented on PR #10: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/10#issuecomment-1457893654 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-servlet-helpers=10) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=10=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=10=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=10=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=10=false=CODE_SMELL) [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=10=coverage=list) No Coverage information [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=10=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=10=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] sonarcloud[bot] commented on pull request #9: SLING-11745 - Sling Mocks: allow setting parts for a request
sonarcloud[bot] commented on PR #9: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/9#issuecomment-1457889829 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-servlet-helpers=9) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=9=false=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=9=false=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlet-helpers=9=false=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlet-helpers=9=false=CODE_SMELL) [![82.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '82.6%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=9=new_coverage=list) [82.6% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=9=new_coverage=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=9=new_duplicated_lines_density=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlet-helpers=9=new_duplicated_lines_density=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] rombert commented on pull request #10: Update to parent pom 49
rombert commented on PR #10: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/10#issuecomment-1457860930 > i think the version for `org.jetbrains:annotations` can be removed, it's defined in the parent POM. You're right, fixed in 6337c07. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] rombert commented on pull request #9: SLING-11745 - Sling Mocks: allow setting parts for a request
rombert commented on PR #9: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/9#issuecomment-1457834879 Converted tabs to spaces where I had accidentally introduced them, thanks for the review @stefanseifert -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] stefanseifert commented on a diff in pull request #9: SLING-11745 - Sling Mocks: allow setting parts for a request
stefanseifert commented on code in PR #9: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/9#discussion_r1127525553 ## src/main/java/org/apache/sling/servlethelpers/ByteArrayPart.java: ## @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.servlethelpers; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; + +import javax.servlet.http.Part; + +/** + * Simple Part implementation backed by an in-memory byte array + * + */ +public class ByteArrayPart implements Part { + + /** Review Comment: this file is using tab indentation - please use 4 spaces ## src/test/java/org/apache/sling/servlethelpers/ByteArrayPartTest.java: ## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.servlethelpers; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; + +import org.junit.Test; + +public class ByteArrayPartTest { + + private static final String TEST_CONTENT = "test input"; Review Comment: this file is using tab indentation - please use 4 spaces -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-servlet-helpers] stefanseifert commented on pull request #10: Update to parent pom 49
stefanseifert commented on PR #10: URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/10#issuecomment-1457761221 i think the version for `org.jetbrains:annotations` can be removed, it's defined in the parent POM. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
RE: Unable to solve "No OSGi SCR metadata found for class"
personally i'm using eclipse, which has incremental build support which is used by bnd-maven-plugin to automatically update the metadata files on each class change and works very well. not sure if Intellij IDE supports something similar. doing this automatically with the osgi-mock/sling-mock logic is not trivial: detecting missing metadata is easy, but invoking a bnd process out of the unit test context respecting all custom project settings from the POM is either very difficult to do it right, or very expensive e.g. if you just trigger a full maven call. stefan > -Original Message- > From: Roy Teeuwen > Sent: Monday, March 6, 2023 10:05 PM > To: Sling Developers > Subject: Re: Unable to solve "No OSGi SCR metadata found for class" > > @Stefan, is there any way that it is feasible for Intellij IDE to run the > sling mock unit tests without first doing a compile with maven (and thus > triggering the bnd-maven-plugin to create the OSG-INF files)? It would be > handy if SlingContext could compile them "at runtime" of the junit test if > they aren't available