Make seaech URL cleanup job clustered (#5734)

* Make seaech URL cleanup job clustered

* Add changelog
This commit is contained in:
James Agnew 2024-02-23 11:16:40 -05:00 committed by GitHub
parent ec525f4457
commit e759bc0958
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 5734
title: "A scheduled job to clean up the Search URL table used to enforce uniqueness of conditional create/update jobs was created as a local job and not a clustered job. This has been fixed."

View File

@ -35,7 +35,10 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
/** /**
* This service ensures uniqueness of resources during create or create-on-update by storing the resource searchUrl. * This service ensures uniqueness of resources during create or create-on-update
* by storing the resource searchUrl.
*
* @see SearchUrlJobMaintenanceSvcImpl which deletes stale entities
*/ */
@Transactional @Transactional
@Service @Service

View File

@ -61,7 +61,7 @@ public class SearchUrlJobMaintenanceSvcImpl implements ISearchUrlJobMaintenanceS
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition(); ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
jobDetail.setId(SearchUrlMaintenanceJob.class.getName()); jobDetail.setId(SearchUrlMaintenanceJob.class.getName());
jobDetail.setJobClass(SearchUrlMaintenanceJob.class); jobDetail.setJobClass(SearchUrlMaintenanceJob.class);
theSchedulerService.scheduleLocalJob(10 * DateUtils.MILLIS_PER_MINUTE, jobDetail); theSchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_MINUTE, jobDetail);
} }
private Date calculateCutoffDate() { private Date calculateCutoffDate() {

View File

@ -29,6 +29,15 @@ import jakarta.persistence.TemporalType;
import java.util.Date; import java.util.Date;
/**
* This entity is used to enforce uniqueness on a given search URL being
* used as a conditional operation URL, e.g. a conditional create or a
* conditional update. When we perform a conditional operation that is
* creating a new resource, we store an entity with the conditional URL
* in this table. The URL is the PK of the table, so the database
* ensures that two concurrent threads don't accidentally create two
* resources with the same conditional URL.
*/
@Entity @Entity
@Table( @Table(
name = "HFJ_RES_SEARCH_URL", name = "HFJ_RES_SEARCH_URL",