You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by js...@apache.org on 2022/07/04 08:49:16 UTC

[unomi] branch master updated: UNOMI-618 : rename property for more consistency (#451)

This is an automated email from the ASF dual-hosted git repository.

jsinovassinnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/master by this push:
     new 573f6a73a UNOMI-618 : rename property for more consistency (#451)
573f6a73a is described below

commit 573f6a73a09cbdbb68175c2bc8d0137aa59ede3a
Author: jsinovassin <58...@users.noreply.github.com>
AuthorDate: Mon Jul 4 10:49:11 2022 +0200

    UNOMI-618 : rename property for more consistency (#451)
---
 package/src/main/resources/etc/custom.system.properties             | 4 ++--
 .../elasticsearch/ElasticSearchPersistenceServiceImpl.java          | 6 +++---
 .../org/apache/unomi/services/impl/profiles/ProfileServiceImpl.java | 2 ++
 services/src/main/resources/OSGI-INF/blueprint/blueprint.xml        | 4 ++--
 services/src/main/resources/org.apache.unomi.services.cfg           | 4 ++--
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/package/src/main/resources/etc/custom.system.properties b/package/src/main/resources/etc/custom.system.properties
index cd5e473d2..bbf08dafa 100644
--- a/package/src/main/resources/etc/custom.system.properties
+++ b/package/src/main/resources/etc/custom.system.properties
@@ -148,8 +148,8 @@ org.apache.unomi.profile.purge.interval=${env:UNOMI_PROFILE_PURGE_INTERVAL:-1}
 org.apache.unomi.profile.purge.inactiveTime=${env:UNOMI_PROFILE_PURGE_INACTIVETIME:-180}
 # Purge profiles that have been created for a specific number of days
 org.apache.unomi.profile.purge.existTime=${env:UNOMI_PROFILE_PURGE_EXISTTIME:--1}
-# Purge all sessions/events that have been created for a specific number of months
-org.apache.unomi.event.purge.existTime=${env:UNOMI_EVENT_PURGE_EXISTTIME:-12}
+# Purge all monthly indexes (sessions/events) that have been created for a specific number of months
+org.apache.unomi.monthly.index.purge.existTime=${env:UNOMI_MONTHLY_INDEX_PURGE_EXISTTIME:-12}
 # Refresh Elasticsearch after saving a profile
 org.apache.unomi.profile.forceRefreshOnSave=${env:UNOMI_PROFILE_REFRESH_ON_SAVE:-false}
 # When performing segment updates, this controls the size of the scrolling query size used to iterate over all the
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index ad4c32cce..bf6efd9fa 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -778,7 +778,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
             }
         }
     }
-    
+
     @Override
     public <T extends Item> T load(final String itemId, final Class<T> clazz) {
         return load(itemId, null, clazz);
@@ -1964,7 +1964,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
     @Override
     public <T extends Item> PartialList<T> continueScrollQuery(final Class<T> clazz, final String scrollIdentifier, final String scrollTimeValidity) {
         return new InClassLoaderExecute<PartialList<T>>(metricsService, this.getClass().getName() + ".continueScrollQuery", this.bundleContext, this.fatalIllegalStateErrors, throwExceptions) {
-            
+
             @Override
             protected PartialList<T> execute(Object... args) throws Exception {
                 List<T> results = new ArrayList<T>();
@@ -2292,7 +2292,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
 
                 SimpleDateFormat d = new SimpleDateFormat("yyyy-MM");
 
-                List<String> toDelete = new ArrayList<String>();
+                List<String> toDelete = new ArrayList<>();
                 for (String currentIndexName : indices) {
                     int indexDatePrefixPos = currentIndexName.indexOf(INDEX_DATE_PREFIX);
                     if (indexDatePrefixPos > -1) {
diff --git a/services/src/main/java/org/apache/unomi/services/impl/profiles/ProfileServiceImpl.java b/services/src/main/java/org/apache/unomi/services/impl/profiles/ProfileServiceImpl.java
index 4903074af..cdfa8c8b3 100644
--- a/services/src/main/java/org/apache/unomi/services/impl/profiles/ProfileServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/impl/profiles/ProfileServiceImpl.java
@@ -371,6 +371,8 @@ public class ProfileServiceImpl implements ProfileService, SynchronousBundleList
                         persistenceService.removeByQuery(purgeProfileQuery, Profile.class);
 
                         if (purgeSessionsAndEventsTime > 0) {
+                            logger.info("Monthly indexes purge: Session and events created before {} months, will be purged",
+                                    purgeSessionsAndEventsTime);
                             persistenceService.purge(getMonth(-purgeSessionsAndEventsTime).getTime());
                         }
 
diff --git a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 60a5b56ae..df30cf716 100644
--- a/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -28,7 +28,7 @@
             <cm:property name="profile.purge.interval" value="1"/>
             <cm:property name="profile.purge.inactiveTime" value="180"/>
             <cm:property name="profile.purge.existTime" value="-1"/>
-            <cm:property name="event.purge.existTime" value="12"/>
+            <cm:property name="monthly.index.purge.existTime" value="12"/>
             <cm:property name="segment.update.batchSize" value="1000"/>
             <cm:property name="profile.forceRefreshOnSave" value="false"/>
             <cm:property name="definitions.refresh.interval" value="10000"/>
@@ -237,7 +237,7 @@
         <property name="purgeProfileInterval" value="${services.profile.purge.interval}"/>
         <property name="purgeProfileInactiveTime" value="${services.profile.purge.inactiveTime}"/>
         <property name="purgeProfileExistTime" value="${services.profile.purge.existTime}"/>
-        <property name="purgeSessionsAndEventsTime" value="${services.event.purge.existTime}"/>
+        <property name="purgeSessionsAndEventsTime" value="${services.monthly.index.purge.existTime}"/>
         <property name="forceRefreshOnSave" value="${services.profile.forceRefreshOnSave}"/>
         <property name="propertiesRefreshInterval" value="${services.properties.refresh.interval}"/>
         <property name="schedulerService" ref="schedulerServiceImpl"/>
diff --git a/services/src/main/resources/org.apache.unomi.services.cfg b/services/src/main/resources/org.apache.unomi.services.cfg
index 6bb76068f..536a9aac4 100644
--- a/services/src/main/resources/org.apache.unomi.services.cfg
+++ b/services/src/main/resources/org.apache.unomi.services.cfg
@@ -27,8 +27,8 @@ profile.purge.existTime=${org.apache.unomi.profile.purge.existTime:--1}
 # Refresh Elasticsearch after saving a profile
 profile.forceRefreshOnSave=${org.apache.unomi.profile.forceRefreshOnSave:-false}
 
-# Purge all sessions/events that have been created for a specific number of months
-event.purge.existTime=${org.apache.unomi.event.purge.existTime:-12}
+# Purge all monthly indexes (sessions/events) that have been created for a specific number of months
+monthly.index.purge.existTime=${org.apache.unomi.monthly.index.purge.existTime:-12}
 
 # When performing segment updates, this controls the size of the scrolling query size used to iterate over all the
 # profiles that need updating