Skip to content

Scan FuzzTargetJob in key order instead of by last_run in cleanup - #5585

Open
ViniciustCosta wants to merge 1 commit into
masterfrom
cleanup-fuzz-target-job-key-scan
Open

ViniciustCosta wants to merge 1 commit into
masterfrom
cleanup-fuzz-target-job-key-scan

Conversation

@ViniciustCosta

@ViniciustCosta ViniciustCosta commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Context: Fuzz tasks constantly rewrite FuzzTargetJob.last_run, which makes last_run-filtered queries frequently exceed the Datastore deadline and lets a last_run DESC paginated scan skip entities whose index position moves mid-scan, causing valid FuzzTargets to be deleted.

Tentative fix: Read the whole kind once in key order and apply the cutoff client-side, as suggested by the Datastore team in b/418807403#comment21. The kind is small and the previous < and >= queries already read all of it. Behavior is otherwise unchanged, since entities with last_run = None still match neither branch (neither deleted nor treated as valid).

Testing: Added unit testing. However, a live test is currently not possible since we don't support the cleanup cronjob in the development environment.

Bug: b/581523363, b/406250205

Fuzz tasks constantly rewrite FuzzTargetJob.last_run, which makes
last_run-filtered queries frequently exceed the Datastore deadline and
lets a last_run DESC paginated scan skip entities whose index position
moves mid-scan, causing valid FuzzTargets to be deleted.

Read the whole kind once in key order and apply the cutoff client-side,
as suggested by the Datastore team in b/418807403#comment21.

Bug: b/581523363, b/406250205
@ViniciustCosta
ViniciustCosta marked this pull request as ready for review November 9, 2026 13:55
@ViniciustCosta
ViniciustCosta requested a review from a team as a code owner November 9, 2026 13:55

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