Skip to content

Use NX for set calls in redis index

Jeremiah Bonney requested to merge jbonney/redis-set-nx into master

Before raising this MR, consider whether the following are required, and complete if so:

  • Unit tests
  • Metrics
  • Documentation update(s)

If not required, please explain in brief why not.

Description

!996 (merged) added functionality to RedisIndex to check if a key already existed when going to set it and skip updating total_size if so. This used the get=True feature of the set command, which was added in Redis version 6.2 which isn't a super new version, but new enough to be disruptive. This PR switches from using that to using nx=true on set calls, which only sets the key if it doesn't exist. This is not only compatible with older versions of Redis but also a more natural fit for what the code was trying to do in the first place.

Issues addressed

Addresses issues running on Redis < 6.2

Merge request reports

Loading