Bug fix in Cache Cleanup Service
This commit is contained in:
parent
3e39791ed0
commit
1fa4aff5dc
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.service.install.update;
|
package org.thingsboard.server.service.install.update;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
@ -24,13 +25,13 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
@Profile("install")
|
@Profile("install")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DefaultCacheCleanupService implements CacheCleanupService {
|
public class DefaultCacheCleanupService implements CacheCleanupService {
|
||||||
|
|
||||||
@Autowired
|
private final CacheManager cacheManager;
|
||||||
CacheManager cacheManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup caches that can not deserialize anymore due to schema upgrade or data update using sql scripts.
|
* Cleanup caches that can not deserialize anymore due to schema upgrade or data update using sql scripts.
|
||||||
@ -43,7 +44,7 @@ public class DefaultCacheCleanupService implements CacheCleanupService {
|
|||||||
case "3.0.1":
|
case "3.0.1":
|
||||||
log.info("Clear cache to upgrade from version 3.0.1 to 3.1.0 ...");
|
log.info("Clear cache to upgrade from version 3.0.1 to 3.1.0 ...");
|
||||||
clearAllCaches();
|
clearAllCaches();
|
||||||
//do not break to show explicit calls for next versions
|
break;
|
||||||
case "3.1.1":
|
case "3.1.1":
|
||||||
log.info("Clear cache to upgrade from version 3.1.1 to 3.2.0 ...");
|
log.info("Clear cache to upgrade from version 3.1.1 to 3.2.0 ...");
|
||||||
clearCacheByName("devices");
|
clearCacheByName("devices");
|
||||||
@ -55,10 +56,9 @@ public class DefaultCacheCleanupService implements CacheCleanupService {
|
|||||||
clearCacheByName("deviceProfiles");
|
clearCacheByName("deviceProfiles");
|
||||||
clearCacheByName("tenantProfiles");
|
clearCacheByName("tenantProfiles");
|
||||||
clearCacheByName("relations");
|
clearCacheByName("relations");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unable to update cache, unsupported fromVersion: " + fromVersion);
|
//Do nothing, since cache cleanup is optional.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user