Skip to content

Add the deduplication hash to the job payload

Bob Van Landuyt requested to merge bvl-deduplication-hash-in-job into master

What does this MR do?

This adds the job-deduplication hash to the payload of the job.

When the hash is part of the job, Sidekiq-server does not need to recalculate it for the deleting it from redis. This allows us to change the way hash is calculated without breaking deduplication on the server-side.

It also fixes a bug that led us to investigating this, when the serialisation of the job-arguments is different on the server-side, the key would not correctly be deleted from Redis. This in turn would cause the client to not enqueue new jobs for the same arguments for the TTL of the key, even though they should be.

Changelog: fixed

Part of: gitlab-com/gl-infra/scalability#1090 (closed)

Screenshots (strongly suggested)

{"severity":"INFO","time":"2021-05-31T18:05:57.598Z","class":"NewNoteWorker","args":["8506"],"retry":3,"queue":"new_note","backtrace":true,"version":0,"jid":"42a09e2c060b6392dc477693","created_at":"2021-05-31T18:05:57.573Z","meta.user":"root","meta.project":"flightjs/flight","meta.root_namespace":"flightjs","meta.caller_id":"Projects::NotesController#create","meta.remote_ip":"127.0.0.1","meta.feature_category":"issue_tracking","meta.client_id":"user/1","correlation_id":"01F71SN3SD7SD2V2JBAY48YJPK","idempotency_key":"resque:gitlab:duplicate:new_note:1d04c77b4007450fbbd4981fd10fc8be4d36529b146b0c61f6bb2225d3c64253","worker_data_consistency":"always","enqueued_at":"2021-05-31T18:05:57.597Z","job_size_bytes":6,"pid":11487,"message":"NewNoteWorker JID-42a09e2c060b6392dc477693: start","job_status":"start","scheduling_latency_s":0.001245}
{"severity":"INFO","time":"2021-05-31T18:05:58.846Z","class":"ActionMailer::MailDeliveryJob","queue":"mailers","args":["[FILTERED]"],"retry":25,"backtrace":true,"jid":"5f0290f96848bf11c35b8a03","created_at":"2021-05-31T18:05:58.842Z","meta.user":"root","meta.project":"flightjs/flight","meta.root_namespace":"flightjs","meta.caller_id":"NewNoteWorker","meta.remote_ip":"127.0.0.1","meta.feature_category":"issue_tracking","meta.client_id":"user/1","correlation_id":"01F71SN3SD7SD2V2JBAY48YJPK","idempotency_key":"resque:gitlab:duplicate:mailers:945633e778f579b662566e51f7055460e60639006e9aa4827af8957267b7ce9c","enqueued_at":"2021-05-31T18:05:58.843Z","job_size_bytes":375,"pid":11487,"message":"ActionMailer::MailDeliveryJob JID-5f0290f96848bf11c35b8a03: start","job_status":"start","scheduling_latency_s":0.002557}
{"severity":"INFO","time":"2021-05-31T18:05:58.849Z","class":"ActionMailer::MailDeliveryJob","queue":"mailers","args":["[FILTERED]"],"retry":25,"backtrace":true,"jid":"154ec61114f8fc57e18332eb","created_at":"2021-05-31T18:05:58.845Z","meta.user":"root","meta.project":"flightjs/flight","meta.root_namespace":"flightjs","meta.caller_id":"NewNoteWorker","meta.remote_ip":"127.0.0.1","meta.feature_category":"issue_tracking","meta.client_id":"user/1","correlation_id":"01F71SN3SD7SD2V2JBAY48YJPK","idempotency_key":"resque:gitlab:duplicate:mailers:67cadeafa80fd3255334874b69b158751e4253960855b7f9479e2e539b078e3e","enqueued_at":"2021-05-31T18:05:58.847Z","job_size_bytes":376,"pid":11487,"message":"ActionMailer::MailDeliveryJob JID-154ec61114f8fc57e18332eb: start","job_status":"start","scheduling_latency_s":0.002411}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Bob Van Landuyt

Merge request reports

Loading