Merge branch 'migration-fixes' into 'master'

Migration fixes

See merge request redactmanager/persistence-service!226
This commit is contained in:
Timo Bejan 2023-11-23 20:58:36 +01:00
commit cec1c1dae9
7 changed files with 38 additions and 8 deletions

0
.dev/docker-compose.yaml Normal file → Executable file
View File

View File

@ -18,8 +18,8 @@
<bucket4j.spring.version>0.4.0</bucket4j.spring.version>
<swagger-commons.version>0.5.0</swagger-commons.version>
<keycloak-commons.version>0.18.0</keycloak-commons.version>
<jobs-commons.version>0.8.0</jobs-commons.version>
<database-tenant-commons.version>0.13.0</database-tenant-commons.version>
<jobs-commons.version>0.9.0</jobs-commons.version>
<database-tenant-commons.version>0.15.0</database-tenant-commons.version>
</properties>
<dependencies>

View File

@ -141,7 +141,7 @@ public class UserMessagingConfiguration {
@Bean(name = "userExchange")
TopicExchange tenantExchange(@Value("${fforesight.user-exchange.name}") String userExchange) {
TopicExchange userExchange(@Value("${fforesight.user-exchange.name}") String userExchange) {
return new TopicExchange(userExchange);
}

View File

@ -16,6 +16,8 @@ import com.iqser.red.service.redaction.v1.model.MigrationRequest;
import com.iqser.red.storage.commons.exception.StorageException;
import com.iqser.red.storage.commons.exception.StorageObjectDoesNotExist;
import com.iqser.red.storage.commons.service.StorageService;
import com.knecon.fforesight.databasetenantcommons.providers.TenantSyncService;
import com.knecon.fforesight.databasetenantcommons.providers.events.TenantSyncEvent;
import com.knecon.fforesight.tenantcommons.TenantContext;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -30,7 +32,7 @@ import static com.knecon.fforesight.service.layoutparser.internal.api.queue.Layo
@Slf4j
@Service
@RequiredArgsConstructor
public class SaasMigrationService {
public class SaasMigrationService implements TenantSyncService {
private final AutomaticAnalysisJob automaticAnalysisJob;
private final FileStatusPersistenceService fileStatusPersistenceService;
@ -45,6 +47,13 @@ public class SaasMigrationService {
private final SaasAnnotationIdMigrationService saasAnnotationIdMigrationService;
@Override
public void syncTenant(TenantSyncEvent tenantSyncEvent) {
startMigrationForTenant(tenantSyncEvent.getTenantId());
}
// Persistence-Service needs to be scaled to 1.
public void startMigrationForTenant(String tenantId) {
@ -90,8 +99,8 @@ public class SaasMigrationService {
public void handleError(String dossierId, String fileId, String errorCause, String retryQueue) {
var migrationEntry = saasMigrationStatusPersistenceService.findById(fileId);
int numErrors = migrationEntry.getProcessingErrorCounter();
if (numErrors <= settings.getMaxErrorRetries()) {
Integer numErrors = migrationEntry.getProcessingErrorCounter();
if (numErrors !=null && numErrors <= settings.getMaxErrorRetries()) {
saasMigrationStatusPersistenceService.updateErrorCounter(fileId, numErrors + 1, errorCause);
rabbitTemplate.convertAndSend(retryQueue, MigrationRequest.builder()
.dossierId(dossierId)
@ -138,4 +147,6 @@ public class SaasMigrationService {
}
}

View File

@ -22,6 +22,7 @@ multitenancy:
prepStmtCacheSqlLimit: 2048
liquibase:
changeLog: classpath:db/changelog/db.changelog-tenant.yaml
clear-checksums: true
monitoring:enabled: true
cors.enabled: true
@ -35,3 +36,17 @@ persistence-service:
fforesight:
springdoc:
auth-server-url: 'http://localhost:8080/auth'
jobs:
enabled: true
datasource:
url: jdbc:postgresql://${PSQL_HOST:localhost}:${PSQL_PORT:25432}/${PSQL_DATABASE:tenantmanager}?ApplicationName=${spring.application.name:}-scheduler&cachePrepStmts=true&useServerPrepStmts=true&rewriteBatchedStatements=true
driverClassName: org.postgresql.Driver
username: ${PSQL_USERNAME:tenantmanager}
password: ${PSQL_PASSWORD:r3dact3d}
platform: org.hibernate.dialect.PostgreSQL95Dialect
hikari:
maximumPoolSize: 2
data-source-properties:
cachePrepStmts: true
prepStmtCacheSize: 1000
prepStmtCacheSqlLimit: 2048

View File

@ -10,7 +10,7 @@ tenant-user-management-service.url: "http://tenant-user-management-service:8080/
application:
type: "RedactManager"
rss.component-log.enabled: false
server:
port: 8080
@ -89,6 +89,7 @@ multitenancy:
prepStmtCacheSqlLimit: 2048
liquibase:
changeLog: classpath:db/changelog/db.changelog-tenant.yaml
clear-checksums: true
bucket4j:
@ -123,6 +124,7 @@ fforesight:
user-exchange:
name: 'users-exchange'
jobs:
enabled: true
tenants:
remote: true

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.iqser.red</groupId>
<artifactId>platform-dependency</artifactId>
<version>2.2.0</version>
<version>2.19.0</version>
<relativePath/>
</parent>
@ -31,6 +31,8 @@
</modules>
<properties>
<findbugs.skip>true</findbugs.skip>
<spotbugs.skip>true</spotbugs.skip>
<redaction-service.version>4.177.0</redaction-service.version>
<search-service.version>2.71.0</search-service.version>
<pdftron-redaction-service.version>4.38.0</pdftron-redaction-service.version>