feat(server): Add --lock_on_hashtags mode. (#1611)

* feat(server): Add `--lock_on_hashtags` mode.

This new mode effectively locks hashtags (i.e. strings within {curly
braces}) instead of the full keys being used.
This can allow scripts to access undeclared keys if they all use a
common hashtag, like for the case of BullMQ.

To make sure this mode is tested, I added a way to specify flags via env
variables, and modified `ci.yml` to run all tests using this mode as well.
While at it, I also added `--cluster_mode=emulated` mode to CI.
This commit is contained in:
Shahar Mike 2023-08-03 20:13:36 +03:00 committed by GitHub
parent 8040bed10f
commit 67a4c4e6cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 229 additions and 31 deletions

View file

@ -50,6 +50,11 @@ class Transaction;
class EngineShard;
struct KeyLockArgs {
static bool IsLockHashTagEnabled();
// Before acquiring and releasing keys, one must "normalize" them via GetLockKey().
static std::string_view GetLockKey(std::string_view key);
DbIndex db_index = 0;
ArgSlice args;
unsigned key_step = 1;