Skip to content

Tests for deleted/expired collection job creation - #4915

Draft
tgeoghegan wants to merge 1 commit into
timg/clarify-batch-aggregation-scrubbingfrom
timg/collection-job-delete-tests
Draft

tgeoghegan wants to merge 1 commit into
timg/clarify-batch-aggregation-scrubbingfrom
timg/collection-job-delete-tests

Conversation

@tgeoghegan

Copy link
Copy Markdown
Contributor

Adds test cases for trying to re-create collection jobs that have been either deleted explicitly by a DELETE or implicitly by their constituent data expiring. Along the way, we do some pretty significant refactoring of CollectionJobTest so that various test setup routines become methods on that type.

@tgeoghegan
tgeoghegan added this pull request to stack #4914 October 19, 2026 18:30
@tgeoghegan

Copy link
Copy Markdown
Contributor Author

Draft because these tests are failing at the moment.

@tgeoghegan
tgeoghegan force-pushed the timg/collection-job-delete-tests branch from e72fed4 to c361322 Compare October 19, 2026 19:07
Adds test cases for trying to re-create collection jobs that have been
either deleted explicitly by a DELETE or implicitly by their constituent
data expiring. Along the way, we do some pretty significant refactoring
of `CollectionJobTest` so that various test setup routines become
methods on that type.
@tgeoghegan
tgeoghegan force-pushed the timg/collection-job-delete-tests branch from c361322 to 602eae9 Compare October 19, 2026 19:15
@tgeoghegan

Copy link
Copy Markdown
Contributor Author

Now we have the tests we want so that we can assure that Janus behaves correctly. Next, we have to decide how we want Janus to behave. There's eight cases of interest:

  • Leader selected, deleted job, re-create job with identical request
  • Leader selected, deleted job, re-create job with same idempotency key but mutated request
  • Leader selected, expired job, re-create job with identical request
  • Leader selected, expired job, re-create job with same idempotency key but mutated request
  • Time interval, deleted job, re-create job with identical request
  • Time interval, deleted job, re-create job with same time interval but mutated request
  • Time interval, expired job, re-create job with identical request
  • Time interval, expired job, re-create job with same time interval but mutated request

I argue that:

Regardless of whether a job was deleted or expired, trying to re-create it with the same query (idempotency key or time interval, resp.) but varying other parameters (extensions, agg param) should fail with batchOverlap.

If a job was deleted and we try to re-create it with an identical request, we should serve HTTP 204 No Content, the same response we'd give if you tried to GET a deleted collection job. Note that's 204 No Content, not 404 Not Found! We are acknowledging that the collection job ever existed.

Finally, if a job expires and we try to re-create it with identical parameters, then we could serve HTTP 200 and the CollectionJobResp. It turns out that even if the data is expired, we still have a collection_jobs row in state Finished, with aggregate shares and a checksum and everything. But I think it would be better to serve 204 No Content, on the premise that the data has expired and thus is effectively deleted, especially since the garbage collector will eventually catch up and delete it for real.

To sum up, I am proposing:

  • Leader selected, deleted job, re-create job with identical request -> 204 No Content
  • Leader selected, deleted job, re-create job with same idempotency key but mutated request -> 400 Bad Request + batchOverlap problem document
  • Leader selected, expired job, re-create job with identical request -> 204 No Content
  • Leader selected, expired job, re-create job with same idempotency key but mutated request -> 400 Bad Request + batchOverlap problem document
  • Time interval, deleted job, re-create job with identical request -> 204 No Content
  • Time interval, deleted job, re-create job with same time interval but mutated request -> 400 Bad Request + batchOverlap problem document
  • Time interval, expired job, re-create job with identical request -> 204 No Content
  • Time interval, expired job, re-create job with same time interval but mutated request -> 400 Bad Request + batchOverlap problem document

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant