feat!: create the cache deletion job instead of the seeding job (MAPCO-11265) - #119
feat!: create the cache deletion job instead of the seeding job (MAPCO-11265)#119almog8k wants to merge 11 commits into
Conversation
Adds the Update_Delete_Cache / Swap_Delete_Cache job types and the cacheDeletion task config, wired through to the chart in the same change. Pins raster-shared to the build exporting GEODETIC_GRIDS.
Composes the redis key prefix from the mapproxy cache name and the configured grid, emits a prefix-wipe task for swap-update and streamed range tasks for update, and fails a partially-populated job explicitly.
…O-11265) Both ingestion finalize handlers now create an Update_Delete_Cache or Swap_Delete_Cache job instead of a seeding job, and SeedingJobCreator with its SeedMode and Seed* param types is removed. BREAKING CHANGE: overseer no longer creates seeding jobs.
…1265) The previous toMatchObject assertion used an empty parameters object, which matches anything, so ingestionJobId and ingestionJobType were unasserted. Verified the new assertion fails when they are removed.
| }, | ||
| "cacheDeletion": { | ||
| "type": "CACHE_DELETION_TASK_TYPE", | ||
| "grid": "CACHE_DELETION_GRID", |
There was a problem hiding this comment.
Discussed with Shlomi: to prevent maintaining multiple sources of truth, we shouldn't force a static grid on cache deletion.
We've updated the mapproxy-api endpoint (GET /layer/{layerName}/{cacheType}) to return the grid configuration. Since this service already calls that endpoint for the layer details, please consume the grid from that response instead.
(Check the latest mapproxy-api PR for the updated contract).
| "maxRangesPerTask": { "__name": "CACHE_DELETION_MAX_RANGES_PER_TASK", "__format": "number" }, | ||
| "taskBatchSize": { "__name": "CACHE_DELETION_TASK_BATCH_SIZE", "__format": "number" }, | ||
| "gracefulReloadMaxSeconds": { "__name": "CACHE_DELETION_GRACEFUL_RELOAD_MAX_SECONDS", "__format": "number" }, | ||
| "reloadWindowMarginSeconds": { "__name": "CACHE_DELETION_RELOAD_WINDOW_MARGIN_SECONDS", "__format": "number" } |
There was a problem hiding this comment.
I reviewed the need for this variable/mechanism and it seems redundant. Let me know if I'm missing an edge case.
According to the in-code comments, this handles a scenario where a pod hasn’t reloaded the new mapproxy-api config yet and is still serving the previous layer version. However, for cache invalidation/deletion during a swap, this shouldn't be an issue since both the layer name and grid remain identical to the previous version.
Unless there’s another scenario this covers, we can safely remove it.
There was a problem hiding this comment.
You are right about the layer name and grid- they both remain identical, but the path to the tiles(display path is changed)- so the maproxinator reloads all the pods of mapproxy in result to this.
| super(msg); | ||
| this.name = SeedJobCreationError.name; | ||
| this.stack = err.stack; | ||
| export class UnsupportedGridError extends Error { |
There was a problem hiding this comment.
Referencing the previous comment, this mechanism won't be needed if we get rid of the grid configuration.
There was a problem hiding this comment.
The mechanism is needed. Explained in previous comment.
| @@ -60,6 +62,10 @@ export interface JobConfig { | |||
|
|
|||
| export interface IngestionJobsConfig { | |||
| seed: JobConfig | undefined; | |||
There was a problem hiding this comment.
Will be removed in separated pr: https://mapcolonies.atlassian.net/browse/MAPCO-11266
|
|
||
| export interface IngestionJobsConfig { | ||
| seed: JobConfig | undefined; | ||
| /** job type for the update flow's cache deletion; selects cleaner's range-deletion strategy */ |
| }); | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Remove redundant comment.
| const cacheName = await this.mapproxyClient.getRedisCacheName({ layerName, cacheType: LayerCacheType.REDIS }); | ||
| const prefix = `${cacheName}_${this.taskConfig.grid}`; | ||
|
|
||
| logger.info({ msg: 'Composed redis key prefix', cacheName, grid: this.taskConfig.grid, prefix }); |
| } | ||
|
|
||
| /** | ||
| * Tasks are streamed to avoid memory overhead. The job is created with its first batch |
| } | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Actually this comment is relevant.
There was a problem hiding this comment.
i didn't examine tests. waiting on the mapproxy api refactor.

Related issues: MAPCO-11265 (epic MAPCO-11261)
Further information:
Replaces the MapProxy tile-cache seeding job with a cache deletion job. On ingestion finalize, overseer now tells the
cleanerworker which Redis tile keys to drop instead of drivingmapproxy-seed; tiles repopulate lazily on cache miss.Cleaner resolves its strategy from a combined job+task token, so the job type selects the behaviour while the task type stays
tiles-deletion:Update_Delete_CacheSwap_Delete_CachedelaySecondsThe Redis key prefix is composed as
${cacheName}_${grid}(mapproxyloader.py's rule) because mapproxy-api reports neither a prefix nor a grid. Verified against a production key and pinned as a regression test.GEODETIC_GRIDStherefore gates construction:footprintToTileRangesonly implements the geodetic grid, and against any other it would return plausible ranges for the wrong tiles.Not deployable on its own. job-tracker has no handler or config entry for the two new job types —
getJobHandlerthrowsBadRequestErrorfor anything outside its switch — so it would reject every task event for these jobs. Ticket pending. It also completes a job oncompletedTasks === taskCount, which needs a decision since tasks are streamed after the job is created. Cleaner work is MAPCO-11263/11264; both dependency pins are CI tarballs to be swapped for published versions before production (MAPCO-11267).BREAKING CHANGE: overseer no longer creates seeding jobs. Ingestion finalize now creates an Update_Delete_Cache or Swap_Delete_Cache job, and the Ingestion_Seed job type is no longer produced.