Skip to content

Draft: Allow non-idempotent blocks in MultiStore pipeline

What does this MR do and why?

Changes the way we send commands in multi / pipeline commands so the block can be non-idempotent

How to set up and validate locally

  1. Setup a different Redis db in config/redis.cluster_shared_state.yml
  2. Enable use_primary_and_secondary_stores_for_shared_state feature flag

Test script:

nb = nil

::Gitlab::Redis::SharedState.with do |redis|
  redis.default_store.set('testkey', 100)
  redis.non_default_store.set('testkey', 0)
end

result = ::Gitlab::Redis::SharedState.with do |redis|
  redis.multi do |m|
    nb = m.incrbyfloat('testkey', 1000)
  end
end

puts result.first
puts nb.value

On master, it would return different values. On this branch, both will be the same.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Heinrich Lee Yu

Merge request reports