Skip to content

Handle empty array from Redis server-side msgpack

Sylvester Chin requested to merge sc1-fix-lua-msgpack into master

What does this MR do and why?

This MR adds a check to handle Redis server-side msgpack behaviour where Lua converts empty hashes to arrays.

During feature flag migration from :always to :sticky, the bug could occur where:

  • client schedules a job with the always data consistency
  • another process elsewhere also schedules a job but it gets deduplicated and sets the deduplication flag using the LUA script and mutates the hash into an array
  • server picks up a job with the sticky data consistency (% chance varies depending on feature flag)
  • server tries to enqueue a job of the same class and argument, leading to a wal_location that is present but existing_wal_location is an array

Detailed explanation in #500401 (comment 2185406990)

More details: https://github.com/antirez/lua-cmsgpack + https://redis.io/docs/latest/develop/interact/programmability/lua-api/

An empty table is always converted into a MessagePack array, the rationale is that empty lists are much more common than empty maps (usually used to represent objects with fields).

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Sylvester Chin

Merge request reports

Loading