Fix stuck VSA consistency worker
What does this MR do and why?
This MR fixes the error within the VSA consistency worker class. (not user-facing)
In the previous MR (!122624 (merged)) we changed the batching logic to include records with null
end_event_timestamp
value. By doing so, the restoring of the cursor for the batching logic fails because we called .compact
on a hash which is now removing the end_event_timestamp
key and fails the validation when using keyset pagination:
Error:
RuntimeError:
Incorrect cursor values were given. Missing items: end_event_timestamp
lib/gitlab/pagination/keyset/order.rb:276:in `verify_incoming_values!',
lib/gitlab/pagination/keyset/order.rb:148:in `build_where_values',
lib/gitlab/pagination/keyset/order.rb:168:in `apply_cursor_conditions',
...
The fix is to avoid compacting the hash and allow having end_event_timestamp
with nil value.
How to set up and validate locally
Ensure that you're on ultimate and you have seeded DB.
On master branch, verify that the worker fails:
Analytics::CycleAnalytics::ConsistencyWorker.new.perform
On this branch, the same snippet shouldn't fail.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #408320 (closed)