-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add on-demand import and new retention rules
- Loading branch information
Showing
28 changed files
with
700 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>sanecleanup</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.springframework.ide.eclipse.core.springbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.springframework.ide.eclipse.core.springnature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> | ||
<name>sanecleanup</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.springframework.ide.eclipse.core.springbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.springframework.ide.eclipse.core.springnature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
<filteredResources> | ||
<filter> | ||
<id>1606724818477</id> | ||
<name></name> | ||
<type>30</type> | ||
<matcher> | ||
<id>org.eclipse.core.resources.regexFilterMatcher</id> | ||
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments> | ||
</matcher> | ||
</filter> | ||
</filteredResources> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [2.0.0] - 2021-03-23 | ||
|
||
### Changed | ||
|
||
- Cleanup jobs / retention rules are now imported on-demand based on the extensions the project uses. | ||
|
||
### Added | ||
|
||
- Custom retention cronjob to replace CMS Version [Garbage Collection][versiongc].\ | ||
The ootb garbage collection mechanism is over-engineered and should be a regular cronjob. | ||
|
||
- Retention rules and jobs for the promotion engine, based on [Top 10 Recommendations for Improving the Performance of your Commerce Cloud Promotion Engine][top10] | ||
|
||
[versiongc]: https://help.sap.com/viewer/9d346683b0084da2938be8a285c0c27a/2011/en-US/9089116335ac4f4d8708e0c5516531e3.html | ||
[top10]: https://www.sap.com/cxworks/article/538808299/top_10_recommendations_for_improving_the_performance_of_your_commerce_cloud_promotion_engine | ||
|
||
## [1.0.1] - 22020-12-09 | ||
|
||
### Added | ||
|
||
- Bulk cleanup cronjob for log files - useful for a one-time cleanup before the retention | ||
job for job logs is enabled | ||
|
||
## [1.0.0] - 2020-11-26 | ||
|
||
Initial release | ||
|
||
### Added | ||
|
||
- Cleanup for: | ||
|
||
- CronJobs | ||
- CronJob Histories | ||
- Lob Logs / Log Files | ||
- Impex Media | ||
- HTTP Sessions | ||
- Business Processes | ||
- Carts | ||
|
||
[Unreleased]: https://github.com/sap-commerce-tools/sanecleanup/compare/v2.0.0...HEAD | ||
[2.0.0]: https://github.com/sap-commerce-tools/sanecleanup/compare/v1.0.1...v2.0.0 | ||
[1.0.1]: https://github.com/sap-commerce-tools/sanecleanup/compare/v1.0.0...v1.0.1 | ||
[1.0.0]: https://github.com/sap-commerce-tools/sanecleanup/releases/tag/v1.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
sanecleanup.application-context=sanecleanup-spring.xml | ||
|
||
# disable change history entries / "Last Changes" | ||
# hmc.storing.modifiedvalues.size=0 | ||
|
||
# replaced with mpern.sap.cleanup.cms2.CMSVersionGCPerformable | ||
version.gc.enabled=false | ||
|
||
sanecleanup.jobs.sessionlanguage=en |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
resources/impex/essentialdata-cleanup-businessprocess.impex
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
resources/impex/essentialdata-cleanup-cronjobhistory.impex
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
INSERT_UPDATE ServicelayerJob;code[unique=true];springId; | ||
;cmsVersionGCJob;cmsVersionGCPerformable; |
11 changes: 11 additions & 0 deletions
11
resources/impex/sanecleanup/cms2/001-optimized-versiongc.impex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
# Import config properties into impex macros | ||
UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true] | ||
$sessionLanguage=$config-sanecleanup.jobs.sessionlanguage | ||
$cronExpression=$config-version.gc.cron | ||
|
||
INSERT_UPDATE CronJob;code[unique=true];job(code);sessionLanguage(isoCode)[default = $sessionLanguage] | ||
;cmsVersionGCCronJob;cmsVersionGCJob; | ||
|
||
INSERT_UPDATE Trigger;cronjob(code)[unique=true];cronExpression | ||
;cmsVersionGCCronJob; $cronExpression |
36 changes: 36 additions & 0 deletions
36
resources/impex/sanecleanup/commerceservices/001-cleanup-oldcarts.impex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# based on de.hybris.platform.commercewebservices.core.cronjob.OldCartRemovalJob | ||
# and de.hybris.platform.commerceservices.order.dao.impl.DefaultCommerceCartDao.getCartsForRemovalForSiteAndUser | ||
# | ||
# - cleanup anonymous carts after two weeks for *every* site (excluding saved carts) | ||
# - cleanup carts of registered users after four weeks for *every* site (excluding saved carts) | ||
|
||
# Import config properties into impex macros | ||
UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true] | ||
$sessionLanguage=$config-sanecleanup.jobs.sessionlanguage | ||
|
||
$twoWeeks = 1209600 | ||
$fourWeeks = 2419200 | ||
INSERT_UPDATE FlexibleSearchRetentionRule; code[unique = true]; searchQuery; retentionTimeSeconds; actionReference ; | ||
; cartRule ; " | ||
SELECT {c:pk}, {c:itemtype} | ||
FROM { Cart AS c LEFT JOIN User AS u ON {c:user} = {u:pk} } | ||
WHERE {c:saveTime} IS NULL | ||
AND {u:uid} <> 'anonymous' | ||
AND {c:modifiedTime} < ?CALC_RETIREMENT_TIME" ; $fourWeeks ; basicRemoveCleanupAction ; | ||
; anonymousCartRule ; " | ||
SELECT {c:pk}, {c:itemtype} | ||
FROM {Cart AS c LEFT JOIN User AS u ON {c:user} = {u:pk}} | ||
WHERE {c:saveTime} IS NULL | ||
AND ( {u:uid} = 'anonymous' OR {u:uid} IS NULL ) | ||
AND {c:modifiedTime} < ?CALC_RETIREMENT_TIME" ; $twoWeeks ; basicRemoveCleanupAction ; | ||
|
||
INSERT_UPDATE RetentionJob; code[unique = true] ; retentionRule(code); batchSize | ||
; cartCleanupJob ; cartRule ; 1000 | ||
; anonymousCartCleanupJob ; anonymousCartRule ; 1000 | ||
INSERT_UPDATE CronJob; code[unique = true] ; job(code) ; sessionLanguage(isoCode)[default = $sessionLanguage] | ||
; cartCleanupCronJob ; cartCleanupJob ; | ||
; anonymousCartCleanupCronJob ; anonymousCartCleanupJob ; | ||
INSERT_UPDATE Trigger; cronJob(code)[unique = true]; cronExpression | ||
# every day at midnight | ||
; cartCleanupCronJob ; 0 0 0 * * ? | ||
; anonymousCartCleanupCronJob ; 0 0 0 * * ? |
18 changes: 18 additions & 0 deletions
18
resources/impex/sanecleanup/core/001-cleanup-httpsession.impex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# delete all stored sessions one day after there last update | ||
|
||
# Import config properties into impex macros | ||
UPDATE GenericItem[processor = de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor]; pk[unique = true] | ||
$sessionLanguage = $config-sanecleanup.jobs.sessionlanguage | ||
|
||
$oneDay = 86400 | ||
INSERT_UPDATE FlexibleSearchRetentionRule; code[unique = true] ; searchQuery; retentionTimeSeconds; actionReference ; | ||
; storedHttpSessionRule ; "select {s:pk}, {s:itemtype} | ||
from {StoredHttpSession as s} | ||
where {s:modifiedTime} < ?CALC_RETIREMENT_TIME" ; $oneDay ; basicRemoveCleanupAction ; | ||
INSERT_UPDATE RetentionJob; code[unique = true] ; retentionRule(code) ; batchSize | ||
; storedHttpSessionCleanupJob ; storedHttpSessionRule ; 1000 | ||
INSERT_UPDATE CronJob; code[unique = true] ; job(code) ; sessionLanguage(isoCode)[default = $sessionLanguage] | ||
; storedHttpSessionCleanupCronJob ; storedHttpSessionCleanupJob ; | ||
INSERT_UPDATE Trigger; cronJob(code)[unique = true] ; cronExpression | ||
# every 30 minutes | ||
; storedHttpSessionCleanupCronJob ; 0 0/30 * * * ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
$twoWeeks = 1209600 | ||
INSERT_UPDATE FlexibleSearchRetentionRule; code[unique = true]; searchQuery; retentionTimeSeconds; actionReference ; | ||
; impexMediaRule ; " | ||
SELECT {i:pk}, {i:itemtype} | ||
FROM {ImpexMedia AS i} | ||
WHERE {i:code} LIKE '00______' | ||
AND {i:modifiedTime} < ?CALC_RETIREMENT_TIME" ; $twoWeeks ; basicRemoveCleanupAction ; | ||
INSERT_UPDATE RetentionJob; code[unique = true] ; retentionRule(code); batchSize | ||
; impexMediaCleanupJob ; impexMediaRule ; 1000 | ||
INSERT_UPDATE CronJob; code[unique = true] ; job(code) ; sessionLanguage(isoCode)[default = en] | ||
; impexMediaCleanupCronJob ; impexMediaCleanupJob ; | ||
INSERT_UPDATE Trigger; cronJob(code)[unique = true]; cronExpression | ||
# every day at midnight | ||
; impexMediaCleanupCronJob ; 0 0 0 * * ? |
Oops, something went wrong.