Set isolation level. Remove manual artifact cleanup at tenant delete (#471)
* Set isolation level. Remove manual artifact cleanup at tenant delete (is cascaded). Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Needs to be read commited. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -58,9 +58,6 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TargetFilterQueryRepository targetFilterQueryRepository;
|
private TargetFilterQueryRepository targetFilterQueryRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActionRepository actionRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DistributionSetRepository distributionSetRepository;
|
private DistributionSetRepository distributionSetRepository;
|
||||||
|
|
||||||
@@ -82,18 +79,12 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributionSetTagRepository distributionSetTagRepository;
|
private DistributionSetTagRepository distributionSetTagRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LocalArtifactRepository artifactRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenantConfigurationRepository tenantConfigurationRepository;
|
private TenantConfigurationRepository tenantConfigurationRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RolloutRepository rolloutRepository;
|
private RolloutRepository rolloutRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RolloutGroupRepository rolloutGroupRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenantAware tenantAware;
|
private TenantAware tenantAware;
|
||||||
|
|
||||||
@@ -196,6 +187,8 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
|||||||
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||||
def.setName("initial-tenant-creation");
|
def.setName("initial-tenant-creation");
|
||||||
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||||
|
def.setReadOnly(false);
|
||||||
|
def.setIsolationLevel(Isolation.READ_UNCOMMITTED.value());
|
||||||
return systemSecurityContext.runAsSystemAsTenant(
|
return systemSecurityContext.runAsSystemAsTenant(
|
||||||
() -> new TransactionTemplate(txManager, def).execute(status -> tenantMetaDataRepository
|
() -> new TransactionTemplate(txManager, def).execute(status -> tenantMetaDataRepository
|
||||||
.save(new JpaTenantMetaData(createStandardSoftwareDataSetup(), tenant))),
|
.save(new JpaTenantMetaData(createStandardSoftwareDataSetup(), tenant))),
|
||||||
@@ -219,7 +212,6 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
|||||||
targetRepository.deleteByTenantIgnoreCase(tenant);
|
targetRepository.deleteByTenantIgnoreCase(tenant);
|
||||||
targetFilterQueryRepository.deleteByTenantIgnoreCase(tenant);
|
targetFilterQueryRepository.deleteByTenantIgnoreCase(tenant);
|
||||||
rolloutRepository.deleteByTenantIgnoreCase(tenant);
|
rolloutRepository.deleteByTenantIgnoreCase(tenant);
|
||||||
artifactRepository.deleteByTenantIgnoreCase(tenant);
|
|
||||||
targetTagRepository.deleteByTenantIgnoreCase(tenant);
|
targetTagRepository.deleteByTenantIgnoreCase(tenant);
|
||||||
distributionSetTagRepository.deleteByTenantIgnoreCase(tenant);
|
distributionSetTagRepository.deleteByTenantIgnoreCase(tenant);
|
||||||
distributionSetRepository.deleteByTenantIgnoreCase(tenant);
|
distributionSetRepository.deleteByTenantIgnoreCase(tenant);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
@@ -87,6 +88,8 @@ public class AutoAssignChecker {
|
|||||||
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||||
def.setName("autoAssignDSToTargets");
|
def.setName("autoAssignDSToTargets");
|
||||||
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||||
|
def.setReadOnly(false);
|
||||||
|
def.setIsolationLevel(Isolation.READ_COMMITTED.value());
|
||||||
transactionTemplate = new TransactionTemplate(transactionManager, def);
|
transactionTemplate = new TransactionTemplate(transactionManager, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user