Minor refactoring
This commit is contained in:
parent
8694611f7a
commit
7eea5a6cda
@ -184,7 +184,10 @@ public class DefaultDataUpdateService implements DataUpdateService {
|
||||
boolean skipAuditLogsMigration = getEnv("TB_SKIP_AUDIT_LOGS_MIGRATION", false);
|
||||
if (!skipAuditLogsMigration) {
|
||||
log.info("Updating data from version 3.4.1 to 3.4.2 ...");
|
||||
log.info("Starting audit logs migration. Can be skipped with TB_SKIP_AUDIT_LOGS_MIGRATION env variable set to true");
|
||||
auditLogDao.migrateAuditLogs();
|
||||
} else {
|
||||
log.info("Skipping audit logs migration");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -49,8 +49,8 @@ public class AuditLogsCleanUpService extends AbstractCleanUpService {
|
||||
this.partitioningRepository = partitioningRepository;
|
||||
}
|
||||
|
||||
@Scheduled(initialDelayString = "#{T(org.apache.commons.lang3.RandomUtils).nextLong(0, ${sql.ttl.audit_logs.execution_interval_ms})}",
|
||||
fixedDelayString = "${sql.ttl.audit_logs.execution_interval_ms}")
|
||||
@Scheduled(initialDelayString = "#{T(org.apache.commons.lang3.RandomUtils).nextLong(0, ${sql.ttl.audit_logs.checking_interval_ms})}",
|
||||
fixedDelayString = "${sql.ttl.audit_logs.checking_interval_ms}")
|
||||
public void cleanUp() {
|
||||
long auditLogsExpTime = System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(ttlInSec);
|
||||
if (isSystemTenantPartitionMine()) {
|
||||
|
||||
@ -308,7 +308,7 @@ sql:
|
||||
audit_logs:
|
||||
enabled: "${SQL_TTL_AUDIT_LOGS_ENABLED:true}"
|
||||
ttl: "${SQL_TTL_AUDIT_LOGS_SECS:0}" # Disabled by default. Accuracy of the cleanup depends on the sql.audit_logs.partition_size
|
||||
execution_interval_ms: "${SQL_TTL_AUDIT_LOGS_EXECUTION_INTERVAL_MS:86400000}" # Default value - 1 day
|
||||
checking_interval_ms: "${SQL_TTL_AUDIT_LOGS_CHECKING_INTERVAL_MS:86400000}" # Default value - 1 day
|
||||
relations:
|
||||
max_level: "${SQL_RELATIONS_MAX_LEVEL:50}" # //This value has to be reasonable small to prevent infinite recursion as early as possible
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ public class SqlPartitioningRepository {
|
||||
SqlPartition partition = new SqlPartition(table, partitionStartTs, partitionStartTs + partitionDurationMs, Long.toString(partitionStartTs));
|
||||
partitionCreationLock.lock();
|
||||
try {
|
||||
if (partitions.containsKey(partitionStartTs)) return;
|
||||
log.trace("Saving partition: {}", partition);
|
||||
save(partition);
|
||||
log.trace("Adding partition to map: {}", partition);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user